From ea58b542d6526f6b458be1901eaf49423b948a43 Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Mon, 1 Jul 2013 16:53:54 -0400 Subject: [PATCH 01/31] Re-do a lot of it using a conditional define, and legacy type information for APIs --- Zend/zend.c | 36 +++---- Zend/zend.h | 50 ++++----- Zend/zend_API.c | 185 ++++++++++++++++++--------------- Zend/zend_API.h | 154 +++++++++++++-------------- Zend/zend_builtin_functions.c | 108 +++++++++---------- Zend/zend_closures.c | 6 +- Zend/zend_compile.c | 78 +++++++------- Zend/zend_compile.h | 36 +++---- Zend/zend_execute.h | 20 ++-- Zend/zend_execute_API.c | 27 ++--- Zend/zend_hash.c | 26 ++--- Zend/zend_hash.h | 42 ++++---- Zend/zend_object_handlers.c | 20 ++-- Zend/zend_object_handlers.h | 14 +-- Zend/zend_operators.c | 72 ++++++------- Zend/zend_operators.h | 49 +++++---- Zend/zend_types.h | 13 +++ Zend/zend_vm_def.h | 12 +-- Zend/zend_vm_execute.h | 74 +++++++------ configure.in | 9 +- ext/date/php_date.c | 126 +++++++++++----------- ext/date/php_date.h | 4 +- ext/spl/spl_array.c | 22 ++-- ext/standard/array.c | 89 ++++++++-------- ext/standard/basic_functions.c | 132 +++++++++++------------ ext/standard/basic_functions.h | 4 +- ext/standard/browscap.c | 56 +++++----- 27 files changed, 757 insertions(+), 707 deletions(-) diff --git a/Zend/zend.c b/Zend/zend.c index aad6165e408a3..625c3dceeca87 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -49,22 +49,22 @@ BOOL WINAPI IsDebuggerPresent(VOID); /* true multithread-shared globals */ ZEND_API zend_class_entry *zend_standard_class_def = NULL; -ZEND_API int (*zend_printf)(const char *format, ...); +ZEND_API zend_str_size_int (*zend_printf)(const char *format, ...); ZEND_API zend_write_func_t zend_write; ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC); ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC); ZEND_API void (*zend_block_interruptions)(void); ZEND_API void (*zend_unblock_interruptions)(void); ZEND_API void (*zend_ticks_function)(int ticks); -ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); -int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap); +ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const zend_str_size_uint error_lineno, const char *format, va_list args); +zend_str_size_int (*zend_vspprintf)(char **pbuf, zend_str_size_size_t max_len, const char *format, va_list ap); ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC); -ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC); +ZEND_API char *(*zend_resolve_path)(const char *filename, zend_str_size_int filename_len TSRMLS_DC); void (*zend_on_timeout)(int seconds TSRMLS_DC); static void (*zend_message_dispatcher_p)(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, zend_str_size_uint name_length, zval *contents); static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */ { @@ -130,7 +130,7 @@ ZEND_API zval zval_used_for_init; /* True global variable */ /* version information */ static char *zend_version_info; -static uint zend_version_info_length; +static zend_str_size_uint zend_version_info_length; #define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2013 Zend Technologies\n" #define PRINT_ZVAL_INDENT 4 @@ -140,7 +140,7 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, char *string_key; HashPosition iterator; ulong num_key; - uint str_len; + zend_str_size str_len; int i; for (i = 0; i < indent; i++) { @@ -158,8 +158,8 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, case HASH_KEY_IS_STRING: if (is_object) { const char *prop_name, *class_name; - int prop_len; - int mangled = zend_unmangle_property_name_ex(string_key, str_len - 1, &class_name, &prop_name, &prop_len); + zend_str_size prop_len; + zend_str_size mangled = zend_unmangle_property_name_ex(string_key, str_len - 1, &class_name, &prop_name, &prop_len); ZEND_WRITE_EX(prop_name, prop_len); if (class_name && mangled == SUCCESS) { @@ -202,7 +202,7 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */ char *string_key; HashPosition iterator; ulong num_key; - uint str_len; + zend_str_size str_len; int i = 0; zend_hash_internal_pointer_reset_ex(ht, &iterator); @@ -358,7 +358,7 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) /* {{{ */ { HashTable *properties = NULL; const char *class_name = NULL; - zend_uint clen; + zend_str_size clen; if (Z_OBJ_HANDLER_P(expr, get_class_name)) { Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC); @@ -416,7 +416,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int { HashTable *properties; const char *class_name = NULL; - zend_uint clen; + zend_str_size clen; int is_temp; if (Z_OBJ_HANDLER_P(expr, get_class_name)) { @@ -624,7 +624,7 @@ static void php_scanner_globals_ctor(zend_php_scanner_globals *scanner_globals_p void zend_init_opcodes_handlers(void); -static zend_bool php_auto_globals_create_globals(const char *name, uint name_len TSRMLS_DC) /* {{{ */ +static zend_bool php_auto_globals_create_globals(const char *name, zend_str_size_uint name_len TSRMLS_DC) /* {{{ */ { zval *globals; @@ -863,7 +863,7 @@ void zenderror(const char *error) /* {{{ */ /* }}} */ BEGIN_EXTERN_C() -ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */ +ZEND_API void _zend_bailout(char *filename, zend_str_size_uint lineno) /* {{{ */ { TSRMLS_FETCH(); @@ -883,7 +883,7 @@ END_EXTERN_C() void zend_append_version_info(const zend_extension *extension) /* {{{ */ { char *new_info; - uint new_info_length; + zend_str_size new_info_length; new_info_length = sizeof(" with v, , by \n") + strlen(extension->name) @@ -980,7 +980,7 @@ ZEND_API void zend_message_dispatcher(long message, const void *data TSRMLS_DC) /* }}} */ END_EXTERN_C() -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, zend_str_size_uint name_length, zval *contents) /* {{{ */ { if (zend_get_configuration_directive_p) { return zend_get_configuration_directive_p(name, name_length, contents); @@ -1015,7 +1015,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ zval *retval; zval *z_error_type, *z_error_message, *z_error_filename, *z_error_lineno, *z_context; const char *error_filename; - uint error_lineno; + zend_str_size error_lineno; zval *orig_user_error_handler; zend_bool in_compilation; zend_class_entry *saved_class_entry; @@ -1364,7 +1364,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC) /* {{{ */ { const char *cur_filename; - int cur_lineno; + zend_str_size cur_lineno; char *compiled_string_description; if (zend_is_compiling(TSRMLS_C)) { diff --git a/Zend/zend.h b/Zend/zend.h index 1377fd566594b..d40500caf7b50 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -323,7 +323,7 @@ typedef union _zvalue_value { double dval; /* double value */ struct { char *val; - int len; + zend_str_size_int len; } str; HashTable *ht; /* hash table value */ zend_object_value obj; @@ -441,12 +441,12 @@ typedef struct _zend_unserialize_data zend_unserialize_data; struct _zend_trait_method_reference { const char* method_name; - unsigned int mname_len; + zend_str_size_uint mname_len; zend_class_entry *ce; const char* class_name; - unsigned int cname_len; + zend_str_size_uint cname_len; }; typedef struct _zend_trait_method_reference zend_trait_method_reference; @@ -464,7 +464,7 @@ struct _zend_trait_alias { * name for method to be added */ const char* alias; - unsigned int alias_len; + zend_str_size_uint alias_len; /** * modifiers to be set on trait method @@ -476,7 +476,7 @@ typedef struct _zend_trait_alias zend_trait_alias; struct _zend_class_entry { char type; const char *name; - zend_uint name_length; + zend_str_size_uint name_length; struct _zend_class_entry *parent; int refcount; zend_uint ce_flags; @@ -509,11 +509,11 @@ struct _zend_class_entry { zend_object_value (*create_object)(zend_class_entry *class_type TSRMLS_DC); zend_object_iterator *(*get_iterator)(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC); int (*interface_gets_implemented)(zend_class_entry *iface, zend_class_entry *class_type TSRMLS_DC); /* a class implements this interface */ - union _zend_function *(*get_static_method)(zend_class_entry *ce, char* method, int method_len TSRMLS_DC); + union _zend_function *(*get_static_method)(zend_class_entry *ce, char* method, zend_str_size_int method_len TSRMLS_DC); /* serializer callbacks */ - int (*serialize)(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC); - int (*unserialize)(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC); + zend_str_size_int (*serialize)(zval *object, unsigned char **buffer, zend_str_size_uint *buf_len, zend_serialize_data *data TSRMLS_DC); + zend_str_size_int (*unserialize)(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_str_size_uint buf_len, zend_unserialize_data *data TSRMLS_DC); zend_class_entry **interfaces; zend_uint num_interfaces; @@ -526,10 +526,10 @@ struct _zend_class_entry { union { struct { const char *filename; - zend_uint line_start; - zend_uint line_end; + zend_str_size_uint line_start; + zend_str_size_uint line_end; const char *doc_comment; - zend_uint doc_comment_len; + zend_str_size_uint doc_comment_len; } user; struct { const struct _zend_function_entry *builtin_functions; @@ -540,20 +540,20 @@ struct _zend_class_entry { #include "zend_stream.h" typedef struct _zend_utility_functions { - void (*error_function)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0); - int (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); - int (*write_function)(const char *str, uint str_length); + void (*error_function)(int type, const char *error_filename, const zend_str_size_uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0); + zend_str_size_int (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); + zend_str_size_int (*write_function)(const char *str, zend_str_size_uint str_length); FILE *(*fopen_function)(const char *filename, char **opened_path TSRMLS_DC); void (*message_handler)(long message, const void *data TSRMLS_DC); void (*block_interruptions)(void); void (*unblock_interruptions)(void); - int (*get_configuration_directive)(const char *name, uint name_length, zval *contents); + int (*get_configuration_directive)(const char *name, zend_str_size_uint name_length, zval *contents); void (*ticks_function)(int ticks); void (*on_timeout)(int seconds TSRMLS_DC); int (*stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC); - int (*vspprintf_function)(char **pbuf, size_t max_len, const char *format, va_list ap); - char *(*getenv_function)(char *name, size_t name_len TSRMLS_DC); - char *(*resolve_path_function)(const char *filename, int filename_len TSRMLS_DC); + zend_str_size_int (*vspprintf_function)(char **pbuf, zend_str_size_size_t max_len, const char *format, va_list ap); + char *(*getenv_function)(char *name, zend_str_size_size_t name_len TSRMLS_DC); + char *(*resolve_path_function)(const char *filename, zend_str_size_int filename_len TSRMLS_DC); } zend_utility_functions; typedef struct _zend_utility_values { @@ -609,7 +609,7 @@ void zend_post_startup(TSRMLS_D); void zend_set_utility_values(zend_utility_values *utility_values); BEGIN_EXTERN_C() -ZEND_API void _zend_bailout(char *filename, uint lineno); +ZEND_API void _zend_bailout(char *filename, zend_str_size_uint lineno); END_EXTERN_C() #define zend_bailout() _zend_bailout(__FILE__, __LINE__) @@ -686,18 +686,18 @@ END_EXTERN_C() #define ZEND_PUTC(c) zend_write(&(c), 1), (c) BEGIN_EXTERN_C() -extern ZEND_API int (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); +extern ZEND_API zend_str_size_int (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); extern ZEND_API zend_write_func_t zend_write; extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC); extern ZEND_API void (*zend_block_interruptions)(void); extern ZEND_API void (*zend_unblock_interruptions)(void); extern ZEND_API void (*zend_ticks_function)(int ticks); -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 zend_str_size_uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0); extern ZEND_API void (*zend_on_timeout)(int seconds TSRMLS_DC); extern ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC); -extern int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap); -extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC); -extern ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC); +extern zend_str_size_int (*zend_vspprintf)(char **pbuf, zend_str_size_size_t max_len, const char *format, va_list ap); +extern ZEND_API char *(*zend_getenv)(char *name, zend_str_size_size_t name_len TSRMLS_DC); +extern ZEND_API char *(*zend_resolve_path)(const char *filename, zend_str_size_int filename_len TSRMLS_DC); ZEND_API void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); @@ -726,7 +726,7 @@ END_EXTERN_C() BEGIN_EXTERN_C() ZEND_API void zend_message_dispatcher(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, zend_str_size_uint name_length, zval *contents); END_EXTERN_C() /* Messages for applications of Zend */ diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 23ad158b17d44..d993df0baaa37 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -244,7 +244,7 @@ ZEND_API zend_class_entry *zend_get_class_entry(const zval *zobject TSRMLS_DC) / /* }}} */ /* returns 1 if you need to copy result, 0 if it's already a copy */ -ZEND_API int zend_get_object_classname(const zval *object, const char **class_name, zend_uint *class_name_len TSRMLS_DC) /* {{{ */ +ZEND_API int zend_get_object_classname(const zval *object, const char **class_name, zend_str_size_uint *class_name_len TSRMLS_DC) /* {{{ */ { if (Z_OBJ_HT_P(object)->get_class_name == NULL || Z_OBJ_HT_P(object)->get_class_name(object, class_name, class_name_len, 0 TSRMLS_CC) != SUCCESS) { @@ -258,7 +258,7 @@ ZEND_API int zend_get_object_classname(const zval *object, const char **class_na } /* }}} */ -static int parse_arg_object_to_string(zval **arg, char **p, int *pl, int type TSRMLS_DC) /* {{{ */ +static int parse_arg_object_to_string(zval **arg, char **p, zend_str_size_int *pl, int type TSRMLS_DC) /* {{{ */ { if (Z_OBJ_HANDLER_PP(arg, cast_object)) { zval *obj; @@ -420,17 +420,28 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con } } break; - - case 'p': - case 's': +#ifdef ZEND_USE_LEGACY_STRING_TYPES + case 'p': /* Deprecated, Legacy int size */ + case 's': /* Deprecated, Legacy int size */ +#endif + case 'P': /* New zend_str_size size */ + case 'S': /* New zend_str_size size */ { char **p = va_arg(*va, char **); - int *pl = va_arg(*va, int *); + zend_str_size pl; + zend_str_size *plsize; + int *plint; + + if (c == 'p' || c == 's') { + plint = va_arg(*va, int *); + } else { + plsize = va_arg(*va, zend_str_size *); + } switch (Z_TYPE_PP(arg)) { case IS_NULL: if (check_null) { *p = NULL; - *pl = 0; + pl = 0; break; } /* break omitted intentionally */ @@ -447,15 +458,15 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con SEPARATE_ZVAL(arg); } *p = Z_STRVAL_PP(arg); - *pl = Z_STRLEN_PP(arg); - if (c == 'p' && CHECK_ZVAL_NULL_PATH(*arg)) { + pl = Z_STRLEN_PP(arg); + if ((c == 'p' || c == 'P') && CHECK_ZVAL_NULL_PATH(*arg)) { return "a valid path"; } break; case IS_OBJECT: - if (parse_arg_object_to_string(arg, p, pl, IS_STRING TSRMLS_CC) == SUCCESS) { - if (c == 'p' && CHECK_ZVAL_NULL_PATH(*arg)) { + if (parse_arg_object_to_string(arg, p, &pl, IS_STRING TSRMLS_CC) == SUCCESS) { + if ((c == 'p' || c == 'P') && CHECK_ZVAL_NULL_PATH(*arg)) { return "a valid path"; } break; @@ -464,7 +475,12 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con case IS_ARRAY: case IS_RESOURCE: default: - return c == 's' ? "string" : "a valid path"; + return (c == 's' || c == 'S') ? "string" : "a valid path"; + } + if (c == 'p' || c == 's') { + *plint = (int) pl; + } else { + *plsize = pl; } } break; @@ -751,6 +767,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va, case 'C': case 'h': case 'f': case 'A': case 'H': case 'p': + case 'S': case 'P': max_num_args++; break; @@ -1222,7 +1239,7 @@ ZEND_API int add_assoc_function(zval *arg, const char *key, void (*function_ptr) } /* }}} */ -ZEND_API int add_assoc_long_ex(zval *arg, const char *key, uint key_len, long n) /* {{{ */ +ZEND_API int add_assoc_long_ex(zval *arg, const char *key, zend_str_size_uint key_len, long n) /* {{{ */ { zval *tmp; @@ -1233,7 +1250,7 @@ ZEND_API int add_assoc_long_ex(zval *arg, const char *key, uint key_len, 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, zend_str_size_uint key_len) /* {{{ */ { zval *tmp; @@ -1244,7 +1261,7 @@ 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, zend_str_size_uint key_len, int b) /* {{{ */ { zval *tmp; @@ -1255,7 +1272,7 @@ 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, int r) /* {{{ */ +ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, zend_str_size_uint key_len, int r) /* {{{ */ { zval *tmp; @@ -1266,7 +1283,7 @@ ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, int } /* }}} */ -ZEND_API int add_assoc_double_ex(zval *arg, const char *key, uint key_len, double d) /* {{{ */ +ZEND_API int add_assoc_double_ex(zval *arg, const char *key, zend_str_size_uint key_len, double d) /* {{{ */ { zval *tmp; @@ -1277,7 +1294,7 @@ ZEND_API int add_assoc_double_ex(zval *arg, const char *key, uint key_len, doubl } /* }}} */ -ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate) /* {{{ */ +ZEND_API int add_assoc_string_ex(zval *arg, const char *key, zend_str_size_uint key_len, char *str, int duplicate) /* {{{ */ { zval *tmp; @@ -1288,7 +1305,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, int duplicate) /* {{{ */ +ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, zend_str_size_uint key_len, char *str, zend_str_size_uint length, int duplicate) /* {{{ */ { zval *tmp; @@ -1299,7 +1316,7 @@ ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char } /* }}} */ -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, zend_str_size_uint key_len, zval *value) /* {{{ */ { return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &value, sizeof(zval *), NULL); } @@ -1371,7 +1388,7 @@ ZEND_API int add_index_string(zval *arg, ulong index, const char *str, int dupli } /* }}} */ -ZEND_API int add_index_stringl(zval *arg, ulong index, const char *str, uint length, int duplicate) /* {{{ */ +ZEND_API int add_index_stringl(zval *arg, ulong index, const char *str, zend_str_size_uint length, int duplicate) /* {{{ */ { zval *tmp; @@ -1454,7 +1471,7 @@ ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate) /* } /* }}} */ -ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate) /* {{{ */ +ZEND_API int add_next_index_stringl(zval *arg, const char *str, zend_str_size_uint length, int duplicate) /* {{{ */ { zval *tmp; @@ -1471,7 +1488,7 @@ ZEND_API int add_next_index_zval(zval *arg, zval *value) /* {{{ */ } /* }}} */ -ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, void **dest, int duplicate) /* {{{ */ +ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, zend_str_size_uint key_len, const char *str, void **dest, int duplicate) /* {{{ */ { zval *tmp; @@ -1482,7 +1499,7 @@ ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, c } /* }}} */ -ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, void **dest, int duplicate) /* {{{ */ +ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, zend_str_size_uint key_len, const char *str, zend_str_size_uint length, void **dest, int duplicate) /* {{{ */ { zval *tmp; @@ -1526,7 +1543,7 @@ ZEND_API int add_get_index_string(zval *arg, ulong index, const char *str, void } /* }}} */ -ZEND_API int add_get_index_stringl(zval *arg, ulong index, const char *str, uint length, void **dest, int duplicate) /* {{{ */ +ZEND_API int add_get_index_stringl(zval *arg, ulong index, const char *str, zend_str_size_uint length, void **dest, int duplicate) /* {{{ */ { zval *tmp; @@ -1571,7 +1588,7 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */ } /* }}} */ -ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, long n TSRMLS_DC) /* {{{ */ +ZEND_API int add_property_long_ex(zval *arg, const char *key, zend_str_size_uint key_len, long n TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; @@ -1589,7 +1606,7 @@ ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, long } /* }}} */ -ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, int b TSRMLS_DC) /* {{{ */ +ZEND_API int add_property_bool_ex(zval *arg, const char *key, zend_str_size_uint key_len, int b TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; @@ -1607,7 +1624,7 @@ ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, int } /* }}} */ -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, zend_str_size_uint key_len TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; @@ -1625,7 +1642,7 @@ ZEND_API int add_property_null_ex(zval *arg, const char *key, uint key_len TSRML } /* }}} */ -ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, long n TSRMLS_DC) /* {{{ */ +ZEND_API int add_property_resource_ex(zval *arg, const char *key, zend_str_size_uint key_len, long n TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; @@ -1643,7 +1660,7 @@ ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, } /* }}} */ -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, zend_str_size_uint key_len, double d TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; @@ -1661,7 +1678,7 @@ ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, do } /* }}} */ -ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate TSRMLS_DC) /* {{{ */ +ZEND_API int add_property_string_ex(zval *arg, const char *key, zend_str_size_uint key_len, const char *str, int duplicate TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; @@ -1679,7 +1696,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, int duplicate TSRMLS_DC) /* {{{ */ +ZEND_API int add_property_stringl_ex(zval *arg, const char *key, zend_str_size_uint key_len, const char *str, zend_str_size_uint length, int duplicate TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; @@ -1697,7 +1714,7 @@ ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, c } /* }}} */ -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, zend_str_size_uint key_len, zval *value TSRMLS_DC) /* {{{ */ { zval *z_key; @@ -1712,7 +1729,7 @@ ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC) /* {{{ */ { - int name_len; + zend_str_size name_len; char *lcname; if (module->module_started) { @@ -1898,7 +1915,7 @@ ZEND_API void zend_destroy_modules(void) /* {{{ */ ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC) /* {{{ */ { - int name_len; + zend_str_size name_len; char *lcname; zend_module_entry *module_ptr; @@ -1965,7 +1982,7 @@ ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *mod ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce, const zend_function *fptr, int error_type TSRMLS_DC) /* {{{ */ { char lcname[16]; - int name_len; + zend_str_size name_len; /* we don't care if the function name is longer, in fact lowercasing only * the beginning of the name speeds up the check process */ @@ -2034,9 +2051,9 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio int error_type; zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__callstatic = NULL, *__tostring = NULL; const char *lowercase_name; - int fname_len; + zend_str_size fname_len; const char *lc_class_name = NULL; - int class_name_len = 0; + zend_str_size class_name_len = 0; if (type==MODULE_PERSISTENT) { error_type = E_CORE_WARNING; @@ -2572,7 +2589,7 @@ ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *or } /* }}} */ -ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_class_entry *ce TSRMLS_DC) /* {{{ */ +ZEND_API int zend_register_class_alias_ex(const char *name, zend_str_size_int name_len, zend_class_entry *ce TSRMLS_DC) /* {{{ */ { char *lcname = zend_str_tolower_dup(name, name_len); int ret; @@ -2586,7 +2603,7 @@ ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_c } /* }}} */ -ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, int name_length, zend_bool is_ref, int num_symbol_tables, ...) /* {{{ */ +ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, zend_str_size_int name_length, zend_bool is_ref, int num_symbol_tables, ...) /* {{{ */ { HashTable *symbol_table; va_list symbol_table_list; @@ -2621,7 +2638,7 @@ static zend_function_entry disabled_function[] = { ZEND_FE_END }; -ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC) /* {{{ */ +ZEND_API int zend_disable_function(char *function_name, zend_str_size_uint function_name_length TSRMLS_DC) /* {{{ */ { if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) { return FAILURE; @@ -2651,7 +2668,7 @@ static const zend_function_entry disabled_class_new[] = { ZEND_FE_END }; -ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC) /* {{{ */ +ZEND_API int zend_disable_class(char *class_name, zend_str_size_uint class_name_length TSRMLS_DC) /* {{{ */ { zend_class_entry **disabled_class; @@ -2666,7 +2683,7 @@ ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_ } /* }}} */ -static int zend_is_callable_check_class(const char *name, int name_len, zend_fcall_info_cache *fcc, int *strict_class, char **error TSRMLS_DC) /* {{{ */ +static int zend_is_callable_check_class(const char *name, zend_str_size_int name_len, zend_fcall_info_cache *fcc, int *strict_class, char **error TSRMLS_DC) /* {{{ */ { int ret = 0; zend_class_entry **pce; @@ -2741,7 +2758,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca int retval = 0; char *mname, *lmname; const char *colon; - int clen, mlen; + zend_str_size clen, mlen; zend_class_entry *last_scope; HashTable *ftable; int call_via_handler = 0; @@ -2996,10 +3013,10 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca } /* }}} */ -ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint check_flags, char **callable_name, int *callable_name_len, zend_fcall_info_cache *fcc, char **error TSRMLS_DC) /* {{{ */ +ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint check_flags, char **callable_name, zend_str_size_int *callable_name_len, zend_fcall_info_cache *fcc, char **error TSRMLS_DC) /* {{{ */ { zend_bool ret; - int callable_name_len_local; + zend_str_size callable_name_len_local; zend_fcall_info_cache fcc_local; if (callable_name) { @@ -3406,7 +3423,7 @@ ZEND_API const char *zend_get_module_version(const char *module_name) /* {{{ */ } /* }}} */ -ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type, const char *doc_comment, int doc_comment_len TSRMLS_DC) /* {{{ */ +ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, zend_str_size_int name_length, zval *property, int access_type, const char *doc_comment, zend_str_size_int doc_comment_len TSRMLS_DC) /* {{{ */ { zend_property_info property_info, *property_info_ptr; const char *interned_name; @@ -3456,7 +3473,7 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, in switch (access_type & ZEND_ACC_PPP_MASK) { case ZEND_ACC_PRIVATE: { char *priv_name; - int priv_name_length; + zend_str_size priv_name_length; zend_mangle_property_name(&priv_name, &priv_name_length, ce->name, ce->name_length, name, name_length, ce->type & ZEND_INTERNAL_CLASS); property_info.name = priv_name; @@ -3465,7 +3482,7 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, in break; case ZEND_ACC_PROTECTED: { char *prot_name; - int prot_name_length; + zend_str_size prot_name_length; zend_mangle_property_name(&prot_name, &prot_name_length, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS); property_info.name = prot_name; @@ -3506,13 +3523,13 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, in } /* }}} */ -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, zend_str_size_int name_length, zval *property, int access_type TSRMLS_DC) /* {{{ */ { return zend_declare_property_ex(ce, name, name_length, property, access_type, NULL, 0 TSRMLS_CC); } /* }}} */ -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, zend_str_size_int name_length, int access_type TSRMLS_DC) /* {{{ */ { zval *property; @@ -3526,7 +3543,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, long value, int access_type TSRMLS_DC) /* {{{ */ +ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, zend_str_size_int name_length, long value, int access_type TSRMLS_DC) /* {{{ */ { zval *property; @@ -3541,7 +3558,7 @@ ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, } /* }}} */ -ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC) /* {{{ */ +ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, zend_str_size_int name_length, long value, int access_type TSRMLS_DC) /* {{{ */ { zval *property; @@ -3556,7 +3573,7 @@ ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, } /* }}} */ -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, zend_str_size_int name_length, double value, int access_type TSRMLS_DC) /* {{{ */ { zval *property; @@ -3571,10 +3588,10 @@ ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name } /* }}} */ -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, zend_str_size_int name_length, const char *value, int access_type TSRMLS_DC) /* {{{ */ { zval *property; - int len = strlen(value); + zend_str_size len = strlen(value); if (ce->type & ZEND_INTERNAL_CLASS) { ALLOC_PERMANENT_ZVAL(property); @@ -3588,7 +3605,7 @@ ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name } /* }}} */ -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, zend_str_size_int name_length, const char *value, zend_str_size_int value_len, int access_type TSRMLS_DC) /* {{{ */ { zval *property; @@ -3604,13 +3621,13 @@ ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *nam } /* }}} */ -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, zend_str_size_size_t name_length, zval *value TSRMLS_DC) /* {{{ */ { return zend_hash_update(&ce->constants_table, name, name_length+1, &value, sizeof(zval *), NULL); } /* }}} */ -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, zend_str_size_size_t name_length TSRMLS_DC) /* {{{ */ { zval *constant; @@ -3625,7 +3642,7 @@ ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char * } /* }}} */ -ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, long value TSRMLS_DC) /* {{{ */ +ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, long value TSRMLS_DC) /* {{{ */ { zval *constant; @@ -3640,7 +3657,7 @@ ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char * } /* }}} */ -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, zend_str_size_size_t name_length, zend_bool value TSRMLS_DC) /* {{{ */ { zval *constant; @@ -3655,7 +3672,7 @@ ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char * } /* }}} */ -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, zend_str_size_size_t name_length, double value TSRMLS_DC) /* {{{ */ { zval *constant; @@ -3670,7 +3687,7 @@ ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char } /* }}} */ -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, zend_str_size_size_t name_length, const char *value, zend_str_size_size_t value_length TSRMLS_DC) /* {{{ */ { zval *constant; @@ -3686,13 +3703,13 @@ ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const cha } /* }}} */ -ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value TSRMLS_DC) /* {{{ */ +ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, const char *value TSRMLS_DC) /* {{{ */ { return zend_declare_class_constant_stringl(ce, name, name_length, value, strlen(value) TSRMLS_CC); } /* }}} */ -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, zend_str_size_int name_length, zval *value TSRMLS_DC) /* {{{ */ { zval *property; zend_class_entry *old_scope = EG(scope); @@ -3701,7 +3718,7 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const if (!Z_OBJ_HT_P(object)->write_property) { const char *class_name; - zend_uint class_name_len; + zend_str_size class_name_len; zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC); @@ -3716,7 +3733,7 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const } /* }}} */ -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, zend_str_size_int name_length TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3728,7 +3745,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, long value TSRMLS_DC) /* {{{ */ +ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, long value TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3740,7 +3757,7 @@ ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, c } /* }}} */ -ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */ +ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, long value TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3752,7 +3769,7 @@ ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, c } /* }}} */ -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, zend_str_size_int name_length, double value TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3764,7 +3781,7 @@ ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, } /* }}} */ -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, zend_str_size_int name_length, const char *value TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3776,7 +3793,7 @@ ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, } /* }}} */ -ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */ +ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, const char *value, zend_str_size_int value_len TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3788,7 +3805,7 @@ 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, zend_str_size_int name_length, zval *value TSRMLS_DC) /* {{{ */ { zval **property; zend_class_entry *old_scope = EG(scope); @@ -3825,7 +3842,7 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *na } /* }}} */ -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, zend_str_size_int name_length TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3837,7 +3854,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, long value TSRMLS_DC) /* {{{ */ +ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, zend_str_size_int name_length, long value TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3849,7 +3866,7 @@ ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const cha } /* }}} */ -ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */ +ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, zend_str_size_int name_length, long value TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3861,7 +3878,7 @@ ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const cha } /* }}} */ -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, zend_str_size_int name_length, double value TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3873,7 +3890,7 @@ ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const c } /* }}} */ -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, zend_str_size_int name_length, const char *value TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3885,7 +3902,7 @@ ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const c } /* }}} */ -ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */ +ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, zend_str_size_int name_length, const char *value, zend_str_size_int value_len TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3897,7 +3914,7 @@ ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const } /* }}} */ -ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_bool silent TSRMLS_DC) /* {{{ */ +ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, zend_bool silent TSRMLS_DC) /* {{{ */ { zval *property, *value; zend_class_entry *old_scope = EG(scope); @@ -3906,7 +3923,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const c if (!Z_OBJ_HT_P(object)->read_property) { const char *class_name; - zend_uint class_name_len; + zend_str_size class_name_len; zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC); zend_error(E_CORE_ERROR, "Property %s of class %s cannot be read", name, class_name); @@ -3922,7 +3939,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const c } /* }}} */ -ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, int name_length, zend_bool silent TSRMLS_DC) /* {{{ */ +ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, zend_str_size_int name_length, zend_bool silent TSRMLS_DC) /* {{{ */ { zval **property; zend_class_entry *old_scope = EG(scope); @@ -3976,7 +3993,7 @@ ZEND_API void zend_restore_error_handling(zend_error_handling *saved TSRMLS_DC) } /* }}} */ -ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name, zend_uint len) /* {{{ */ +ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name, zend_str_size_uint len) /* {{{ */ { zend_trait_alias *alias, **alias_ptr; @@ -4013,7 +4030,7 @@ ZEND_API const char* zend_resolve_method_name(zend_class_entry *ce, zend_functio while (zend_hash_get_current_data_ex(function_table, (void **)&func, &iterator) == SUCCESS) { if (func == f) { char *name; - uint len; + zend_str_size len; ulong idx; if (zend_hash_get_current_key_ex(function_table, &name, &len, &idx, 0, &iterator) != HASH_KEY_IS_STRING) { diff --git a/Zend/zend_API.h b/Zend/zend_API.h index ecc8d9acd9f43..1ac2d33c756d0 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -28,7 +28,7 @@ #include "zend_operators.h" #include "zend_variables.h" #include "zend_execute.h" - +#include "zend_types.h" BEGIN_EXTERN_C() @@ -169,7 +169,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) \ { \ const char *cl_name = class_name; \ - int _len = class_name_len; \ + zend_str_size _len = class_name_len; \ class_container.name = zend_new_interned_string(cl_name, _len+1, 0 TSRMLS_CC); \ if (class_container.name == cl_name) { \ class_container.name = zend_strndup(cl_name, _len); \ @@ -278,15 +278,15 @@ ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *cla ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *orig_class_entry TSRMLS_DC); ZEND_API void zend_class_implements(zend_class_entry *class_entry TSRMLS_DC, int num_interfaces, ...); -ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_class_entry *ce TSRMLS_DC); +ZEND_API int zend_register_class_alias_ex(const char *name, zend_str_size_int name_len, zend_class_entry *ce TSRMLS_DC); #define zend_register_class_alias(name, ce) \ zend_register_class_alias_ex(name, sizeof(name)-1, ce TSRMLS_CC) #define zend_register_ns_class_alias(ns, name, ce) \ zend_register_class_alias_ex(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, ce TSRMLS_CC) -ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC); -ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC); +ZEND_API int zend_disable_function(char *function_name, zend_str_size_uint function_name_length TSRMLS_DC); +ZEND_API int zend_disable_class(char *class_name, zend_str_size_uint class_name_length TSRMLS_DC); ZEND_API void zend_wrong_param_count(TSRMLS_D); @@ -297,51 +297,51 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D); #define IS_CALLABLE_STRICT (IS_CALLABLE_CHECK_IS_STATIC) -ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint check_flags, char **callable_name, int *callable_name_len, zend_fcall_info_cache *fcc, char **error TSRMLS_DC); +ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint check_flags, char **callable_name, zend_str_size_int *callable_name_len, zend_fcall_info_cache *fcc, char **error TSRMLS_DC); ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name TSRMLS_DC); ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC); ZEND_API const char *zend_get_module_version(const char *module_name); ZEND_API int zend_get_module_started(const char *module_name); -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_ex(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type, const char *doc_comment, int doc_comment_len 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, long value, int access_type TSRMLS_DC); -ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC); -ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, int name_length, double value, int access_type TSRMLS_DC); -ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, int name_length, const char *value, int access_type TSRMLS_DC); -ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, int name_length, const char *value, int value_len, int access_type TSRMLS_DC); - -ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value TSRMLS_DC); -ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length TSRMLS_DC); -ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, long value TSRMLS_DC); -ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_bool value TSRMLS_DC); -ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char *name, size_t name_length, double value TSRMLS_DC); -ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_length TSRMLS_DC); -ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value TSRMLS_DC); +ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, zend_str_size_int name_length, zval *property, int access_type TSRMLS_DC); +ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, zend_str_size_int name_length, zval *property, int access_type, const char *doc_comment, zend_str_size_int doc_comment_len TSRMLS_DC); +ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, zend_str_size_int name_length, int access_type TSRMLS_DC); +ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, zend_str_size_int name_length, long value, int access_type TSRMLS_DC); +ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, zend_str_size_int name_length, long value, int access_type TSRMLS_DC); +ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, zend_str_size_int name_length, double value, int access_type TSRMLS_DC); +ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, zend_str_size_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, zend_str_size_int name_length, const char *value, zend_str_size_int value_len, int access_type TSRMLS_DC); + +ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, zval *value TSRMLS_DC); +ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length TSRMLS_DC); +ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, long value TSRMLS_DC); +ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, zend_bool value TSRMLS_DC); +ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, double value TSRMLS_DC); +ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, const char *value, zend_str_size_size_t value_length TSRMLS_DC); +ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, const char *value 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_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, long value TSRMLS_DC); -ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, int name_length, 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_string(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value TSRMLS_DC); -ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value, int value_length 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_bool(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC); -ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC); -ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, int name_length, double value TSRMLS_DC); -ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, int name_length, const char *value TSRMLS_DC); -ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, int name_length, const char *value, int value_length TSRMLS_DC); - -ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_bool silent TSRMLS_DC); - -ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, int name_length, zend_bool silent TSRMLS_DC); +ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, zval *value TSRMLS_DC); +ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length TSRMLS_DC); +ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, long value TSRMLS_DC); +ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, long value TSRMLS_DC); +ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, double value TSRMLS_DC); +ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, const char *value TSRMLS_DC); +ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, const char *value, zend_str_size_int value_length TSRMLS_DC); + +ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, zend_str_size_int name_length, zval *value TSRMLS_DC); +ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, zend_str_size_int name_length TSRMLS_DC); +ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, zend_str_size_int name_length, long value TSRMLS_DC); +ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, zend_str_size_int name_length, long value TSRMLS_DC); +ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, zend_str_size_int name_length, double value TSRMLS_DC); +ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, zend_str_size_int name_length, const char *value TSRMLS_DC); +ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, zend_str_size_int name_length, const char *value, zend_str_size_int value_length TSRMLS_DC); + +ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, zend_bool silent TSRMLS_DC); + +ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, zend_str_size_int name_length, zend_bool silent TSRMLS_DC); ZEND_API zend_class_entry *zend_get_class_entry(const zval *zobject TSRMLS_DC); -ZEND_API int zend_get_object_classname(const zval *object, const char **class_name, zend_uint *class_name_len TSRMLS_DC); +ZEND_API int zend_get_object_classname(const zval *object, const char **class_name, zend_str_size_uint *class_name_len TSRMLS_DC); ZEND_API char *zend_get_type_by_const(int type); #define getThis() (this_ptr) @@ -373,14 +373,14 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro /* 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_long_ex(zval *arg, const char *key, uint key_len, long n); -ZEND_API int add_assoc_null_ex(zval *arg, const char *key, uint key_len); -ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, uint key_len, int b); -ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, int r); -ZEND_API int add_assoc_double_ex(zval *arg, const char *key, uint key_len, double d); -ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate); -ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate); -ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value); +ZEND_API int add_assoc_long_ex(zval *arg, const char *key, zend_str_size_uint key_len, long n); +ZEND_API int add_assoc_null_ex(zval *arg, const char *key, zend_str_size_uint key_len); +ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, zend_str_size_uint key_len, int b); +ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, zend_str_size_uint key_len, int r); +ZEND_API int add_assoc_double_ex(zval *arg, const char *key, zend_str_size_uint key_len, double d); +ZEND_API int add_assoc_string_ex(zval *arg, const char *key, zend_str_size_uint key_len, char *str, int duplicate); +ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, zend_str_size_uint key_len, char *str, zend_str_size_uint length, int duplicate); +ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, zend_str_size_uint key_len, zval *value); #define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n) #define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1) @@ -403,7 +403,7 @@ ZEND_API int add_index_bool(zval *arg, ulong idx, int b); ZEND_API int add_index_resource(zval *arg, ulong idx, int r); ZEND_API int add_index_double(zval *arg, ulong idx, double d); ZEND_API int add_index_string(zval *arg, ulong idx, const char *str, int duplicate); -ZEND_API int add_index_stringl(zval *arg, ulong idx, const char *str, uint length, int duplicate); +ZEND_API int add_index_stringl(zval *arg, ulong idx, const char *str, zend_str_size_uint length, int duplicate); ZEND_API int add_index_zval(zval *arg, ulong index, zval *value); ZEND_API int add_next_index_long(zval *arg, long n); @@ -412,11 +412,11 @@ ZEND_API int add_next_index_bool(zval *arg, int b); ZEND_API int add_next_index_resource(zval *arg, int r); ZEND_API int add_next_index_double(zval *arg, double d); ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate); -ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate); +ZEND_API int add_next_index_stringl(zval *arg, const char *str, zend_str_size_uint length, int duplicate); ZEND_API int add_next_index_zval(zval *arg, zval *value); -ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, void **dest, int duplicate); -ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, void **dest, int duplicate); +ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, zend_str_size_uint key_len, const char *str, void **dest, int duplicate); +ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, zend_str_size_uint key_len, const char *str, zend_str_size_uint length, void **dest, int duplicate); #define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate) #define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate) @@ -424,18 +424,18 @@ ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, ZEND_API int add_get_index_long(zval *arg, ulong idx, long l, void **dest); ZEND_API int add_get_index_double(zval *arg, ulong idx, double d, void **dest); ZEND_API int add_get_index_string(zval *arg, ulong idx, const char *str, void **dest, int duplicate); -ZEND_API int add_get_index_stringl(zval *arg, ulong idx, const char *str, uint length, void **dest, int duplicate); +ZEND_API int add_get_index_stringl(zval *arg, ulong idx, const char *str, zend_str_size_uint length, void **dest, int duplicate); ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value); -ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, long l TSRMLS_DC); -ZEND_API int add_property_null_ex(zval *arg, const char *key, uint key_len TSRMLS_DC); -ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, int b TSRMLS_DC); -ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, long 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_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate TSRMLS_DC); -ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate 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_long_ex(zval *arg, const char *key, zend_str_size_uint key_len, long l TSRMLS_DC); +ZEND_API int add_property_null_ex(zval *arg, const char *key, zend_str_size_uint key_len TSRMLS_DC); +ZEND_API int add_property_bool_ex(zval *arg, const char *key, zend_str_size_uint key_len, int b TSRMLS_DC); +ZEND_API int add_property_resource_ex(zval *arg, const char *key, zend_str_size_uint key_len, long r TSRMLS_DC); +ZEND_API int add_property_double_ex(zval *arg, const char *key, zend_str_size_uint key_len, double d TSRMLS_DC); +ZEND_API int add_property_string_ex(zval *arg, const char *key, zend_str_size_uint key_len, const char *str, int duplicate TSRMLS_DC); +ZEND_API int add_property_stringl_ex(zval *arg, const char *key, zend_str_size_uint key_len, const char *str, zend_str_size_uint length, int duplicate TSRMLS_DC); +ZEND_API int add_property_zval_ex(zval *arg, const char *key, zend_str_size_uint key_len, zval *value TSRMLS_DC); #define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key)+1, __n TSRMLS_CC) #define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) + 1 TSRMLS_CC) @@ -509,19 +509,19 @@ ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *f ZEND_API int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC); -ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, int name_length, zend_bool is_ref, int num_symbol_tables, ...); +ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, zend_str_size_int name_length, zend_bool is_ref, int num_symbol_tables, ...); -ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const char *name, int name_len, ulong hash_value TSRMLS_DC); +ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const char *name, zend_str_size_int name_len, ulong hash_value TSRMLS_DC); -ZEND_API int zend_delete_global_variable(const char *name, int name_len TSRMLS_DC); +ZEND_API int zend_delete_global_variable(const char *name, zend_str_size_int name_len TSRMLS_DC); -ZEND_API int zend_delete_global_variable_ex(const char *name, int name_len, ulong hash_value TSRMLS_DC); +ZEND_API int zend_delete_global_variable_ex(const char *name, zend_str_size_int name_len, ulong hash_value TSRMLS_DC); ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC); ZEND_API void zend_rebuild_symbol_table(TSRMLS_D); -ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name, zend_uint len); +ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name, zend_str_size_uint len); ZEND_API const char* zend_resolve_method_name(zend_class_entry *ce, zend_function *f); #define add_method(arg, key, method) add_assoc_function((arg), (key), (method)) @@ -532,15 +532,15 @@ END_EXTERN_C() #if ZEND_DEBUG #define CHECK_ZVAL_STRING(z) \ - if (Z_STRVAL_P(z)[ Z_STRLEN_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", Z_STRVAL_P(z)); } + if (Z_STRVAL_P(z)[ Z_STRSIZE_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", Z_STRVAL_P(z)); } #define CHECK_ZVAL_STRING_REL(z) \ - if (Z_STRVAL_P(z)[ Z_STRLEN_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", Z_STRVAL_P(z) ZEND_FILE_LINE_RELAY_CC); } + if (Z_STRVAL_P(z)[ Z_STRSIZE_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", Z_STRVAL_P(z) ZEND_FILE_LINE_RELAY_CC); } #else #define CHECK_ZVAL_STRING(z) #define CHECK_ZVAL_STRING_REL(z) #endif -#define CHECK_ZVAL_NULL_PATH(p) (Z_STRLEN_P(p) != strlen(Z_STRVAL_P(p))) +#define CHECK_ZVAL_NULL_PATH(p) (Z_STRSIZE_P(p) != strlen(Z_STRVAL_P(p))) #define CHECK_NULL_PATH(p, l) (strlen(p) != l) #define ZVAL_RESOURCE(z, l) do { \ @@ -574,22 +574,22 @@ END_EXTERN_C() #define ZVAL_STRING(z, s, duplicate) do { \ const char *__s=(s); \ zval *__z = (z); \ - Z_STRLEN_P(__z) = strlen(__s); \ - Z_STRVAL_P(__z) = (duplicate?estrndup(__s, Z_STRLEN_P(__z)):(char*)__s);\ + Z_STRSIZE_P(__z) = strlen(__s); \ + Z_STRVAL_P(__z) = (duplicate?estrndup(__s, Z_STRSIZE_P(__z)):(char*)__s);\ Z_TYPE_P(__z) = IS_STRING; \ } while (0) #define ZVAL_STRINGL(z, s, l, duplicate) do { \ - const char *__s=(s); int __l=l; \ + const char *__s=(s); zend_str_size __l=l; \ zval *__z = (z); \ - Z_STRLEN_P(__z) = __l; \ + Z_STRSIZE_P(__z) = __l; \ Z_STRVAL_P(__z) = (duplicate?estrndup(__s, __l):(char*)__s);\ Z_TYPE_P(__z) = IS_STRING; \ } while (0) #define ZVAL_EMPTY_STRING(z) do { \ zval *__z = (z); \ - Z_STRLEN_P(__z) = 0; \ + Z_STRSIZE_P(__z) = 0; \ Z_STRVAL_P(__z) = STR_EMPTY_ALLOC();\ Z_TYPE_P(__z) = IS_STRING; \ } while (0) @@ -716,7 +716,7 @@ END_EXTERN_C() #define ZEND_DEFINE_PROPERTY(class_ptr, name, value, mask) \ { \ char *_name = (name); \ - int namelen = strlen(_name); \ + zend_str_size namelen = strlen(_name); \ zend_declare_property(class_ptr, _name, namelen, value, mask TSRMLS_CC); \ } diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 47fb4d2d9b548..1e4dc7598a1f8 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -478,13 +478,13 @@ ZEND_FUNCTION(func_get_args) ZEND_FUNCTION(strlen) { char *s1; - int s1_len; + zend_str_size s1_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &s1, &s1_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &s1, &s1_len) == FAILURE) { return; } - RETVAL_LONG(s1_len); + RETVAL_LONG((long) s1_len); } /* }}} */ @@ -494,9 +494,9 @@ ZEND_FUNCTION(strlen) ZEND_FUNCTION(strcmp) { char *s1, *s2; - int s1_len, s2_len; + zend_str_size s1_len, s2_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &s1, &s1_len, &s2, &s2_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &s1, &s1_len, &s2, &s2_len) == FAILURE) { return; } @@ -510,10 +510,10 @@ ZEND_FUNCTION(strcmp) ZEND_FUNCTION(strncmp) { char *s1, *s2; - int s1_len, s2_len; + zend_str_size s1_len, s2_len; long len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl", &s1, &s1_len, &s2, &s2_len, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSl", &s1, &s1_len, &s2, &s2_len, &len) == FAILURE) { return; } @@ -532,9 +532,9 @@ ZEND_FUNCTION(strncmp) ZEND_FUNCTION(strcasecmp) { char *s1, *s2; - int s1_len, s2_len; + zend_str_size s1_len, s2_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &s1, &s1_len, &s2, &s2_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &s1, &s1_len, &s2, &s2_len) == FAILURE) { return; } @@ -548,10 +548,10 @@ ZEND_FUNCTION(strcasecmp) ZEND_FUNCTION(strncasecmp) { char *s1, *s2; - int s1_len, s2_len; + zend_str_size s1_len, s2_len; long len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl", &s1, &s1_len, &s2, &s2_len, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSl", &s1, &s1_len, &s2, &s2_len, &len) == FAILURE) { return; } @@ -571,7 +571,7 @@ ZEND_FUNCTION(each) { zval *array, *entry, **entry_ptr, *tmp; char *string_key; - uint string_key_len; + zend_str_size string_key_len; ulong num_key; zval **inserted_pointer; HashTable *target_hash; @@ -648,14 +648,14 @@ ZEND_FUNCTION(error_reporting) ZEND_FUNCTION(define) { char *name; - int name_len; + zend_str_size name_len; zval *val; zval *val_free = NULL; zend_bool non_cs = 0; int case_sensitive = CONST_CS; zend_constant c; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|b", &name, &name_len, &val, &non_cs) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|b", &name, &name_len, &val, &non_cs) == FAILURE) { return; } @@ -726,10 +726,10 @@ ZEND_FUNCTION(define) ZEND_FUNCTION(defined) { char *name; - int name_len; + zend_str_size name_len; zval c; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { return; } @@ -749,7 +749,7 @@ ZEND_FUNCTION(get_class) { zval *obj = NULL; const char *name = ""; - zend_uint name_len = 0; + zend_str_size name_len = 0; int dup; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|o!", &obj) == FAILURE) { @@ -797,7 +797,7 @@ ZEND_FUNCTION(get_parent_class) zval *arg; zend_class_entry *ce = NULL; const char *name; - zend_uint name_length; + zend_str_size name_length; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &arg) == FAILURE) { return; @@ -840,13 +840,13 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) { zval *obj; char *class_name; - int class_name_len; + zend_str_size class_name_len; zend_class_entry *instance_ce; zend_class_entry **ce; zend_bool allow_string = only_subclass; zend_bool retval; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs|b", &obj, &class_name, &class_name_len, &allow_string) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS|b", &obj, &class_name, &class_name_len, &allow_string) == FAILURE) { return; } /* @@ -907,7 +907,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value zend_property_info *prop_info; zval *prop, *prop_copy; char *key; - uint key_len; + zend_str_size key_len; ulong num_index; zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos); @@ -958,10 +958,10 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value ZEND_FUNCTION(get_class_vars) { char *class_name; - int class_name_len; + zend_str_size class_name_len; zend_class_entry **pce; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &class_name, &class_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &class_name, &class_name_len) == FAILURE) { return; } @@ -987,7 +987,7 @@ ZEND_FUNCTION(get_object_vars) HashPosition pos; char *key; const char *prop_name, *class_name; - uint key_len, prop_len; + zend_str_size key_len, prop_len; ulong num_index; zend_object *zobj; @@ -1025,7 +1025,7 @@ ZEND_FUNCTION(get_object_vars) } /* }}} */ -static int same_name(const char *key, const char *name, zend_uint name_len) +static int same_name(const char *key, const char *name, zend_str_size_uint name_len) { char *lcname = zend_str_tolower_dup(name, name_len); int ret = memcmp(lcname, key, name_len) == 0; @@ -1074,9 +1074,9 @@ ZEND_FUNCTION(get_class_methods) || ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) && EG(scope) == mptr->common.scope)))) { char *key; - uint key_len; + zend_str_size key_len; ulong num_index; - uint len = strlen(mptr->common.function_name); + zend_str_size len = strlen(mptr->common.function_name); /* Do not display old-style inherited constructors */ if (zend_hash_get_current_key_ex(&ce->function_table, &key, &key_len, &num_index, 0, &pos) != HASH_KEY_IS_STRING) { @@ -1113,11 +1113,11 @@ ZEND_FUNCTION(method_exists) { zval *klass; char *method_name; - int method_len; + zend_str_size method_len; char *lcname; zend_class_entry * ce, **pce; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &klass, &method_name, &method_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &klass, &method_name, &method_len) == FAILURE) { return; } if (Z_TYPE_P(klass) == IS_OBJECT) { @@ -1170,13 +1170,13 @@ ZEND_FUNCTION(property_exists) { zval *object; char *property; - int property_len; + zend_str_size property_len; zend_class_entry *ce, **pce; zend_property_info *property_info; zval property_z; ulong h; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &object, &property, &property_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &object, &property, &property_len) == FAILURE) { return; } @@ -1220,18 +1220,18 @@ ZEND_FUNCTION(class_exists) { char *class_name, *lc_name; zend_class_entry **ce; - int class_name_len; + zend_str_size class_name_len; int found; zend_bool autoload = 1; ALLOCA_FLAG(use_heap) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &class_name, &class_name_len, &autoload) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &class_name, &class_name_len, &autoload) == FAILURE) { return; } if (!autoload) { char *name; - int len; + zend_str_size len; lc_name = do_alloca(class_name_len + 1, use_heap); zend_str_tolower_copy(lc_name, class_name, class_name_len); @@ -1263,18 +1263,18 @@ ZEND_FUNCTION(interface_exists) { char *iface_name, *lc_name; zend_class_entry **ce; - int iface_name_len; + zend_str_size iface_name_len; int found; zend_bool autoload = 1; ALLOCA_FLAG(use_heap) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &iface_name, &iface_name_len, &autoload) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &iface_name, &iface_name_len, &autoload) == FAILURE) { return; } if (!autoload) { char *name; - int len; + zend_str_size len; lc_name = do_alloca(iface_name_len + 1, use_heap); zend_str_tolower_copy(lc_name, iface_name, iface_name_len); @@ -1306,18 +1306,18 @@ ZEND_FUNCTION(trait_exists) { char *trait_name, *lc_name; zend_class_entry **ce; - int trait_name_len; + zend_str_size trait_name_len; int found; zend_bool autoload = 1; ALLOCA_FLAG(use_heap) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &trait_name, &trait_name_len, &autoload) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &trait_name, &trait_name_len, &autoload) == FAILURE) { return; } if (!autoload) { char *name; - int len; + zend_str_size len; lc_name = do_alloca(trait_name_len + 1, use_heap); zend_str_tolower_copy(lc_name, trait_name, trait_name_len); @@ -1390,12 +1390,12 @@ ZEND_FUNCTION(class_alias) { char *class_name, *lc_name, *alias_name; zend_class_entry **ce; - int class_name_len, alias_name_len; + zend_str_size class_name_len, alias_name_len; int found; zend_bool autoload = 1; ALLOCA_FLAG(use_heap) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|b", &class_name, &class_name_len, &alias_name, &alias_name_len, &autoload) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|b", &class_name, &class_name_len, &alias_name, &alias_name_len, &autoload) == FAILURE) { return; } @@ -1502,9 +1502,9 @@ ZEND_FUNCTION(trigger_error) { long error_type = E_USER_NOTICE; char *message; - int message_len; + zend_str_size message_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &message, &message_len, &error_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &message, &message_len, &error_type) == FAILURE) { return; } @@ -1794,11 +1794,11 @@ ZEND_FUNCTION(get_defined_vars) ZEND_FUNCTION(create_function) { char *eval_code, *function_name, *function_args, *function_code; - int eval_code_length, function_name_length, function_args_len, function_code_len; + zend_str_size eval_code_length, function_name_length, function_args_len, function_code_len; int retval; char *eval_name; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &function_args, &function_args_len, &function_code, &function_code_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &function_args, &function_args_len, &function_code, &function_code_len) == FAILURE) { return; } @@ -2057,7 +2057,7 @@ void debug_print_backtrace_args(zval *arg_array TSRMLS_DC) ZEND_FUNCTION(debug_print_backtrace) { zend_execute_data *ptr, *skip; - int lineno, frameno = 0; + zend_str_size lineno, frameno = 0; const char *function_name; const char *filename; const char *class_name = NULL; @@ -2117,7 +2117,7 @@ ZEND_FUNCTION(debug_print_backtrace) if (ptr->function_state.function->common.scope) { class_name = ptr->function_state.function->common.scope->name; } else { - zend_uint class_name_len; + zend_str_size class_name_len; int dup; dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC); @@ -2225,7 +2225,7 @@ ZEND_FUNCTION(debug_print_backtrace) ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int limit TSRMLS_DC) { zend_execute_data *ptr, *skip; - int lineno, frameno = 0; + zend_str_size lineno, frameno = 0; const char *function_name; const char *filename; const char *class_name; @@ -2307,7 +2307,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int if (ptr->function_state.function->common.scope) { add_assoc_string_ex(stack_frame, "class", sizeof("class"), (char*)ptr->function_state.function->common.scope->name, 1); } else { - zend_uint class_name_len; + zend_str_size class_name_len; int dup; dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC); @@ -2412,10 +2412,10 @@ ZEND_FUNCTION(debug_backtrace) ZEND_FUNCTION(extension_loaded) { char *extension_name; - int extension_name_len; + zend_str_size extension_name_len; char *lcname; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension_name, &extension_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &extension_name, &extension_name_len) == FAILURE) { return; } @@ -2435,11 +2435,11 @@ ZEND_FUNCTION(extension_loaded) ZEND_FUNCTION(get_extension_funcs) { char *extension_name; - int extension_name_len; + zend_str_size extension_name_len; zend_module_entry *module; const zend_function_entry *func; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension_name, &extension_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &extension_name, &extension_name_len) == FAILURE) { return; } diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 5faefbd2241a4..6f72cac8929cc 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -101,7 +101,7 @@ ZEND_METHOD(Closure, bind) ce = NULL; } else { char *class_name; - int class_name_len; + zend_str_size class_name_len; zval tmp_zval; INIT_ZVAL(tmp_zval); @@ -180,7 +180,7 @@ ZEND_API zval* zend_get_closure_this_ptr(zval *obj TSRMLS_DC) /* {{{ */ } /* }}} */ -static zend_function *zend_closure_get_method(zval **object_ptr, char *method_name, int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */ +static zend_function *zend_closure_get_method(zval **object_ptr, char *method_name, zend_str_size_int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */ { char *lc_name; ALLOCA_FLAG(use_heap) @@ -351,7 +351,7 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_ for (i = 0; i < closure->func.common.num_args; i++) { char *name, *info; - int name_len, info_len; + zend_str_size name_len, info_len; if (arg_info->name) { name_len = zend_spprintf(&name, 0, "%s$%s", arg_info->pass_by_reference ? "&" : "", diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index faef3a9197d0b..0645bfa012b6f 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -139,10 +139,10 @@ static void zend_destroy_property_info_internal(zend_property_info *property_inf } /* }}} */ -static void build_runtime_defined_function_key(zval *result, const char *name, int name_length TSRMLS_DC) /* {{{ */ +static void build_runtime_defined_function_key(zval *result, const char *name, zend_str_size_int name_length TSRMLS_DC) /* {{{ */ { char char_pos_buf[32]; - uint char_pos_len; + zend_str_size char_pos_len; const char *filename; char_pos_len = zend_sprintf(char_pos_buf, "%p", LANG_SCNG(yy_text)); @@ -249,7 +249,7 @@ void shutdown_compiler(TSRMLS_D) /* {{{ */ ZEND_API char *zend_set_compiled_filename(const char *new_compiled_filename TSRMLS_DC) /* {{{ */ { char **pp, *p; - int length = strlen(new_compiled_filename); + zend_str_size length = strlen(new_compiled_filename); if (zend_hash_find(&CG(filenames_table), new_compiled_filename, length+1, (void **) &pp) == SUCCESS) { CG(compiled_filename) = *pp; @@ -274,7 +274,7 @@ ZEND_API char *zend_get_compiled_filename(TSRMLS_D) /* {{{ */ } /* }}} */ -ZEND_API int zend_get_compiled_lineno(TSRMLS_D) /* {{{ */ +ZEND_API zend_str_size_int zend_get_compiled_lineno(TSRMLS_D) /* {{{ */ { return CG(zend_lineno); } @@ -292,7 +292,7 @@ static zend_uint get_temporary_variable(zend_op_array *op_array) /* {{{ */ } /* }}} */ -static int lookup_cv(zend_op_array *op_array, char* name, int name_len, ulong hash TSRMLS_DC) /* {{{ */ +static int lookup_cv(zend_op_array *op_array, char* name, zend_str_size_int name_len, ulong hash TSRMLS_DC) /* {{{ */ { int i = 0; ulong hash_value = hash ? hash : zend_inline_hash_func(name, name_len+1); @@ -406,7 +406,7 @@ int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS int ret; char *lc_name; const char *ns_separator; - int lc_len; + zend_str_size lc_len; zval c; int lc_literal; @@ -439,7 +439,7 @@ int zend_add_class_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_D { int ret; char *lc_name; - int lc_len; + zend_str_size lc_len; zval c; int lc_literal; @@ -474,7 +474,7 @@ int zend_add_const_name_literal(zend_op_array *op_array, const zval *zv, int unq int ret, tmp_literal; char *name, *tmp_name; const char *ns_separator; - int name_len, ns_len; + zend_str_size name_len, ns_len; zval c; if (op_array->last_literal > 0 && @@ -1527,8 +1527,8 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n { zend_op_array op_array; char *name = function_name->u.constant.value.str.val; - int name_len = function_name->u.constant.value.str.len; - int function_begin_line = function_token->u.op.opline_num; + zend_str_size name_len = function_name->u.constant.value.str.len; + zend_str_size function_begin_line = function_token->u.op.opline_num; zend_uint fn_flags; const char *lcname; zend_bool orig_interactive; @@ -1803,7 +1803,7 @@ void zend_do_handle_exception(TSRMLS_D) /* {{{ */ void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC) /* {{{ */ { char lcname[16]; - int name_len; + zend_str_size name_len; zend_do_extended_info(TSRMLS_C); zend_do_return(NULL, 0 TSRMLS_CC); @@ -2079,7 +2079,7 @@ void zend_do_begin_dynamic_function_call(znode *function_name, int ns_call TSRML void zend_resolve_non_class_name(znode *element_name, zend_bool check_namespace TSRMLS_DC) /* {{{ */ { znode tmp; - int len; + zend_str_size len; zval **ns; char *lcname, *compound = memchr(Z_STRVAL(element_name->u.constant), '\\', Z_STRLEN(element_name->u.constant)); @@ -2180,7 +2180,7 @@ void zend_resolve_class_name(znode *class_name, ulong fetch_type, int check_ns_n char *lcname; zval **ns; znode tmp; - int len; + zend_str_size len; compound = memchr(Z_STRVAL(class_name->u.constant), '\\', Z_STRLEN(class_name->u.constant)); if (compound) { @@ -2410,7 +2410,7 @@ void zend_release_labels(int temporary TSRMLS_DC) /* {{{ */ void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_class_member TSRMLS_DC) /* {{{ */ { - zend_uint length; + zend_str_size length; if (!result) { result = prefix; @@ -3165,7 +3165,7 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c if (fe->common.arg_info[i].class_name) { const char *fe_class_name, *proto_class_name; - zend_uint fe_class_name_len, proto_class_name_len; + zend_str_size fe_class_name_len, proto_class_name_len; if (!strcasecmp(fe->common.arg_info[i].class_name, "parent") && proto->common.scope) { fe_class_name = proto->common.scope->name; @@ -3244,7 +3244,7 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{{ */ { char *offset, *buf; - zend_uint length = 1024; + zend_str_size length = 1024; offset = buf = (char *)emalloc(length * sizeof(char)); if (fptr->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE) { @@ -3275,7 +3275,7 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{ for (i = 0; i < fptr->common.num_args;) { if (arg_info->class_name) { const char *class_name; - zend_uint class_name_len; + zend_str_size class_name_len; if (!strcasecmp(arg_info->class_name, "self") && fptr->common.scope ) { class_name = fptr->common.scope->name; class_name_len = fptr->common.scope->name_length; @@ -3291,7 +3291,7 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{ offset += class_name_len; *(offset++) = ' '; } else if (arg_info->type_hint) { - zend_uint type_name_len; + zend_str_size type_name_len; char *type_name = zend_get_type_by_const(arg_info->type_hint); type_name_len = strlen(type_name); REALLOC_BUF_IF_EXCEED(buf, offset, length, type_name_len); @@ -3838,7 +3838,7 @@ static zend_bool zend_traits_method_compatibility_check(zend_function *fn, zend_ } /* }}} */ -static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint mname_len, zend_function* fe TSRMLS_DC) /* {{{ */ +static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, zend_str_size_uint mname_len, zend_function* fe TSRMLS_DC) /* {{{ */ { if (!strncmp(mname, ZEND_CLONE_FUNC_NAME, mname_len)) { ce->clone = fe; fe->common.fn_flags |= ZEND_ACC_CLONE; @@ -3879,7 +3879,7 @@ static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint } /* }}} */ -static void zend_add_trait_method(zend_class_entry *ce, const char *name, const char *arKey, uint nKeyLength, zend_function *fn, HashTable **overriden TSRMLS_DC) /* {{{ */ +static void zend_add_trait_method(zend_class_entry *ce, const char *name, const char *arKey, zend_str_size_uint nKeyLength, zend_function *fn, HashTable **overriden TSRMLS_DC) /* {{{ */ { zend_function *existing_fn = NULL; ulong h = zend_hash_func(arKey, nKeyLength); @@ -3976,7 +3976,7 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args, zend_trait_alias *alias, **alias_ptr; HashTable *exclude_table; char *lcname; - unsigned int fnname_len; + zend_str_size fnname_len; zend_function fn_copy; void *dummy; @@ -4114,7 +4114,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* j = 0; while (cur_precedence->exclude_from_classes[j]) { char* class_name = (char*)cur_precedence->exclude_from_classes[j]; - zend_uint name_length = strlen(class_name); + zend_str_size name_length = strlen(class_name); if (!(cur_precedence->exclude_from_classes[j] = zend_fetch_class(class_name, name_length, ZEND_FETCH_CLASS_TRAIT |ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) { zend_error(E_COMPILE_ERROR, "Could not find trait %s", class_name); @@ -4180,7 +4180,7 @@ static void zend_traits_compile_exclude_table(HashTable* exclude_table, zend_tra j = 0; while (precedences[i]->exclude_from_classes[j]) { if (precedences[i]->exclude_from_classes[j] == trait) { - zend_uint lcname_len = precedences[i]->trait_method->mname_len; + zend_str_size lcname_len = precedences[i]->trait_method->mname_len; char *lcname = zend_str_tolower_dup(precedences[i]->trait_method->method_name, lcname_len); if (zend_hash_add(exclude_table, lcname, lcname_len, NULL, 0, NULL) == FAILURE) { @@ -4229,7 +4229,7 @@ static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{ } /* }}} */ -static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t current_trait, const char* prop_name, int prop_name_length, ulong prop_hash, zend_class_entry *coliding_ce) /* {{{ */ +static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t current_trait, const char* prop_name, zend_str_size_int prop_name_length, ulong prop_hash, zend_class_entry *coliding_ce) /* {{{ */ { size_t i; @@ -4252,7 +4252,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* { zend_property_info *coliding_prop; zval compare_result; const char* prop_name; - int prop_name_length; + zend_str_size prop_name_length; ulong prop_hash; const char* class_name_unused; zend_bool not_compatible; @@ -5211,10 +5211,10 @@ void zend_do_use_trait(znode *trait_name TSRMLS_DC) /* {{{ */ } /* }}} */ -ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, const char *src1, int src1_length, const char *src2, int src2_length, int internal) /* {{{ */ +ZEND_API void zend_mangle_property_name(char **dest, zend_str_size_int *dest_length, const char *src1, zend_str_size_int src1_length, const char *src2, zend_str_size_int src2_length, int internal) /* {{{ */ { char *prop_name; - int prop_name_length; + zend_str_size_int prop_name_length; prop_name_length = 1 + src1_length + 1 + src2_length; prop_name = pemalloc(prop_name_length + 1, internal); @@ -5227,17 +5227,17 @@ ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, const cha } /* }}} */ -static int zend_strnlen(const char* s, int maxlen) /* {{{ */ +static zend_str_size_int zend_strnlen(const char* s, zend_str_size_int maxlen) /* {{{ */ { - int len = 0; + zend_str_size_int len = 0; while (*s++ && maxlen--) len++; return len; } /* }}} */ -ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, int len, const char **class_name, const char **prop_name, int *prop_len) /* {{{ */ +ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, zend_str_size_int len, const char **class_name, const char **prop_name, zend_str_size_int *prop_len) /* {{{ */ { - int class_name_len; + zend_str_size class_name_len; *class_name = NULL; @@ -5280,7 +5280,7 @@ void zend_do_declare_property(const znode *var_name, const znode *value, zend_ui zval *property; zend_property_info *existing_property_info; char *comment = NULL; - int comment_len = 0; + zend_str_size comment_len = 0; if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) { zend_error(E_COMPILE_ERROR, "Interfaces may not include member variables"); @@ -5437,7 +5437,7 @@ void zend_do_halt_compiler_register(TSRMLS_D) /* {{{ */ { char *name, *cfilename; char haltoff[] = "__COMPILER_HALT_OFFSET__"; - int len, clen; + zend_str_size len, clen; if (CG(has_bracketed_namespaces) && CG(in_namespace)) { zend_error(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope"); @@ -6710,7 +6710,7 @@ void zend_do_ticks(TSRMLS_D) /* {{{ */ } /* }}} */ -zend_bool zend_is_auto_global_quick(const char *name, uint name_len, ulong hashval TSRMLS_DC) /* {{{ */ +zend_bool zend_is_auto_global_quick(const char *name, zend_str_size_uint name_len, ulong hashval TSRMLS_DC) /* {{{ */ { zend_auto_global *auto_global; ulong hash = hashval ? hashval : zend_hash_func(name, name_len+1); @@ -6725,13 +6725,13 @@ zend_bool zend_is_auto_global_quick(const char *name, uint name_len, ulong hashv } /* }}} */ -zend_bool zend_is_auto_global(const char *name, uint name_len TSRMLS_DC) /* {{{ */ +zend_bool zend_is_auto_global(const char *name, zend_str_size_uint name_len TSRMLS_DC) /* {{{ */ { return zend_is_auto_global_quick(name, name_len, 0 TSRMLS_CC); } /* }}} */ -int zend_register_auto_global(const char *name, uint name_len, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC) /* {{{ */ +int zend_register_auto_global(const char *name, zend_str_size_uint name_len, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC) /* {{{ */ { zend_auto_global auto_global; @@ -6874,7 +6874,7 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify } /* }}} */ -int zend_get_class_fetch_type(const char *class_name, uint class_name_len) /* {{{ */ +int zend_get_class_fetch_type(const char *class_name, zend_str_size_uint class_name_len) /* {{{ */ { if ((class_name_len == sizeof("self")-1) && !strncasecmp(class_name, "self", sizeof("self")-1)) { @@ -6891,7 +6891,7 @@ int zend_get_class_fetch_type(const char *class_name, uint class_name_len) /* {{ } /* }}} */ -ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, int* name_len) /* {{{ */ +ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, zend_str_size_int* name_len) /* {{{ */ { if (name_len) { *name_len = op_array->vars[var].name_len; @@ -7156,7 +7156,7 @@ void zend_do_end_compilation(TSRMLS_D) /* {{{ */ ZEND_API size_t zend_dirname(char *path, size_t len) { register char *end = path + len - 1; - unsigned int len_adjust = 0; + zend_str_size len_adjust = 0; #ifdef PHP_WIN32 /* Note that on Win32 CWD is per drive (heritage from CP/M). diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 9c55b5ebe8812..292f533d1e30a 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -112,7 +112,7 @@ struct _zend_op { znode_op op2; znode_op result; ulong extended_value; - uint lineno; + zend_str_size_uint lineno; zend_uchar opcode; zend_uchar op1_type; zend_uchar op2_type; @@ -230,9 +230,9 @@ typedef struct _zend_property_info { typedef struct _zend_arg_info { const char *name; - zend_uint name_len; + zend_str_size_uint name_len; const char *class_name; - zend_uint class_name_len; + zend_str_size_uint class_name_len; zend_uchar type_hint; zend_bool allow_null; zend_bool pass_by_reference; @@ -244,9 +244,9 @@ typedef struct _zend_arg_info { */ typedef struct _zend_internal_function_info { const char *_name; - zend_uint _name_len; + zend_str_size_uint _name_len; const char *_class_name; - zend_uint required_num_args; + zend_str_size_uint required_num_args; zend_uchar _type_hint; zend_bool return_reference; zend_bool pass_rest_by_reference; @@ -254,7 +254,7 @@ typedef struct _zend_internal_function_info { typedef struct _zend_compiled_variable { const char *name; - int name_len; + zend_str_size_int name_len; ulong hash_value; } zend_compiled_variable; @@ -296,10 +296,10 @@ struct _zend_op_array { zend_uint this_var; const char *filename; - zend_uint line_start; - zend_uint line_end; + zend_str_size_uint line_start; + zend_str_size_uint line_end; const char *doc_comment; - zend_uint doc_comment_len; + zend_str_size_uint doc_comment_len; zend_uint early_binding; /* the linked list of delayed declarations */ zend_literal *literals; @@ -434,12 +434,12 @@ void shutdown_scanner(TSRMLS_D); ZEND_API char *zend_set_compiled_filename(const char *new_compiled_filename TSRMLS_DC); ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename TSRMLS_DC); ZEND_API char *zend_get_compiled_filename(TSRMLS_D); -ZEND_API int zend_get_compiled_lineno(TSRMLS_D); +ZEND_API zend_str_size_int zend_get_compiled_lineno(TSRMLS_D); ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D); void zend_resolve_non_class_name(znode *element_name, zend_bool check_namespace TSRMLS_DC); void zend_resolve_class_name(znode *class_name, ulong fetch_type, int check_ns_name TSRMLS_DC); -ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, int* name_len); +ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, zend_str_size_int* name_len); #ifdef ZTS const char *zend_get_zendtext(TSRMLS_D); @@ -672,10 +672,10 @@ ZEND_API void zend_function_dtor(zend_function *function); ZEND_API void destroy_zend_class(zend_class_entry **pce); void zend_class_add_ref(zend_class_entry **ce); -ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, const char *src1, int src1_length, const char *src2, int src2_length, int internal); +ZEND_API void zend_mangle_property_name(char **dest, zend_str_size_int *dest_length, const char *src1, zend_str_size_int src1_length, const char *src2, zend_str_size_int src2_length, int internal); #define zend_unmangle_property_name(mangled_property, mangled_property_len, class_name, prop_name) \ zend_unmangle_property_name_ex(mangled_property, mangled_property_len, class_name, prop_name, NULL) -ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, int mangled_property_len, const char **class_name, const char **prop_name, int *prop_len); +ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, zend_str_size_int mangled_property_len, const char **class_name, const char **prop_name, zend_str_size_int *prop_len); #define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor #define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class @@ -693,9 +693,9 @@ void zend_do_mark_last_catch(const znode *first_catch, const znode *last_additio ZEND_API zend_bool zend_is_compiling(TSRMLS_D); ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC); ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC); -int zend_get_class_fetch_type(const char *class_name, uint class_name_len); +int zend_get_class_fetch_type(const char *class_name, zend_str_size_uint class_name_len); -typedef zend_bool (*zend_auto_global_callback)(const char *name, uint name_len TSRMLS_DC); +typedef zend_bool (*zend_auto_global_callback)(const char *name, zend_str_size_uint name_len TSRMLS_DC); typedef struct _zend_auto_global { const char *name; uint name_len; @@ -704,10 +704,10 @@ typedef struct _zend_auto_global { zend_bool armed; } zend_auto_global; -ZEND_API int zend_register_auto_global(const char *name, uint name_len, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC); +ZEND_API int zend_register_auto_global(const char *name, zend_str_size_uint name_len, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC); ZEND_API void zend_activate_auto_globals(TSRMLS_D); -ZEND_API zend_bool zend_is_auto_global(const char *name, uint name_len TSRMLS_DC); -ZEND_API zend_bool zend_is_auto_global_quick(const char *name, uint name_len, ulong hashval TSRMLS_DC); +ZEND_API zend_bool zend_is_auto_global(const char *name, zend_str_size_uint name_len TSRMLS_DC); +ZEND_API zend_bool zend_is_auto_global_quick(const char *name, zend_str_size_uint name_len, ulong hashval TSRMLS_DC); ZEND_API size_t zend_dirname(char *path, size_t len); int zendlex(znode *zendlval TSRMLS_DC); diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index a17f10b312e53..e5b55b3af76b1 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -37,7 +37,7 @@ typedef union _temp_variable { struct { zval **ptr_ptr; /* shared with var.ptr_ptr */ zval *str; - zend_uint offset; + zend_str_size_uint offset; } str_offset; struct { zval **ptr_ptr; /* shared with var.ptr_ptr */ @@ -61,12 +61,12 @@ ZEND_API void zend_execute(zend_op_array *op_array TSRMLS_DC); ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC); ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, struct _zend_fcall_info *fci, int return_value_used TSRMLS_DC); ZEND_API int zend_is_true(zval *op); -ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC); -ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC); +ZEND_API int zend_lookup_class(const char *name, zend_str_size_int name_length, zend_class_entry ***ce TSRMLS_DC); +ZEND_API int zend_lookup_class_ex(const char *name, zend_str_size_int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC); ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC); -ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *string_name TSRMLS_DC); +ZEND_API int zend_eval_stringl(char *str, zend_str_size_int str_len, zval *retval_ptr, char *string_name 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, zend_str_size_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, ulong fetch_type, const char **class_name, zend_class_entry **pce TSRMLS_DC); ZEND_API int 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 TSRMLS_DC); @@ -108,8 +108,8 @@ static zend_always_inline int i_zend_is_true(zval *op) result = (Z_DVAL_P(op) ? 1 : 0); break; case IS_STRING: - if (Z_STRLEN_P(op) == 0 - || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { + if (Z_STRSIZE_P(op) == 0 + || (Z_STRSIZE_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { result = 0; } else { result = 1; @@ -342,14 +342,14 @@ void execute_new_code(TSRMLS_D); ZEND_API const char *get_active_class_name(const char **space TSRMLS_DC); ZEND_API const char *get_active_function_name(TSRMLS_D); ZEND_API const char *zend_get_executed_filename(TSRMLS_D); -ZEND_API uint zend_get_executed_lineno(TSRMLS_D); +ZEND_API zend_str_size_uint zend_get_executed_lineno(TSRMLS_D); ZEND_API zend_bool zend_is_executing(TSRMLS_D); ZEND_API void zend_set_timeout(long seconds, int reset_signals); ZEND_API void zend_unset_timeout(TSRMLS_D); ZEND_API void zend_timeout(int dummy); -ZEND_API zend_class_entry *zend_fetch_class(const char *class_name, uint class_name_len, int fetch_type TSRMLS_DC); -ZEND_API zend_class_entry *zend_fetch_class_by_name(const char *class_name, uint class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC); +ZEND_API zend_class_entry *zend_fetch_class(const char *class_name, zend_str_size_uint class_name_len, int fetch_type TSRMLS_DC); +ZEND_API zend_class_entry *zend_fetch_class_by_name(const char *class_name, zend_str_size_uint class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC); void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC); #ifdef ZEND_WIN32 diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index d831b107a1a38..bc4027b03757b 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -401,7 +401,7 @@ ZEND_API const char *zend_get_executed_filename(TSRMLS_D) /* {{{ */ } /* }}} */ -ZEND_API uint zend_get_executed_lineno(TSRMLS_D) /* {{{ */ +ZEND_API zend_str_size_uint zend_get_executed_lineno(TSRMLS_D) /* {{{ */ { if(EG(exception) && EG(opline_ptr) && active_opline->opcode == ZEND_HANDLE_EXCEPTION && active_opline->lineno == 0 && EG(opline_before_exception)) { @@ -504,7 +504,7 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco } } else { char *save = actual, *slash; - int actual_len = Z_STRLEN_P(p); + zend_str_size actual_len = Z_STRLEN_P(p); if ((Z_TYPE_P(p) & IS_CONSTANT_UNQUALIFIED) && (slash = (char *)zend_memrchr(actual, '\\', actual_len))) { actual = slash + 1; actual_len -= (actual - Z_STRVAL_P(p)); @@ -561,7 +561,7 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco } else if (Z_TYPE_P(p) == IS_CONSTANT_ARRAY) { zval **element, *new_val; char *str_index; - uint str_index_len; + zend_str_size str_index_len; ulong num_index; int ret; @@ -1010,13 +1010,14 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS } /* }}} */ -ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC) /* {{{ */ +ZEND_API int zend_lookup_class_ex(const char *name, zend_str_size_int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC) /* {{{ */ { zval **args[1]; zval autoload_function; zval *class_name_ptr; zval *retval_ptr = NULL; - int retval, lc_length; + int retval; + zend_str_size lc_length; char *lc_name; char *lc_free; zend_fcall_info fcall_info; @@ -1127,13 +1128,13 @@ ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_ } /* }}} */ -ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC) /* {{{ */ +ZEND_API int zend_lookup_class(const char *name, zend_str_size_int name_length, zend_class_entry ***ce TSRMLS_DC) /* {{{ */ { return zend_lookup_class_ex(name, name_length, NULL, 1, ce TSRMLS_CC); } /* }}} */ -ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *string_name TSRMLS_DC) /* {{{ */ +ZEND_API int zend_eval_stringl(char *str, zend_str_size_int str_len, zval *retval_ptr, char *string_name TSRMLS_DC) /* {{{ */ { zval pv; zend_op_array *new_op_array; @@ -1219,7 +1220,7 @@ ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSR } /* }}} */ -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, zend_str_size_int str_len, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC) /* {{{ */ { int result; @@ -1524,7 +1525,7 @@ void zend_unset_timeout(TSRMLS_D) /* {{{ */ } /* }}} */ -zend_class_entry *zend_fetch_class(const char *class_name, uint class_name_len, int fetch_type TSRMLS_DC) /* {{{ */ +zend_class_entry *zend_fetch_class(const char *class_name, zend_str_size_uint class_name_len, int fetch_type TSRMLS_DC) /* {{{ */ { zend_class_entry **pce; int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0; @@ -1579,7 +1580,7 @@ zend_class_entry *zend_fetch_class(const char *class_name, uint class_name_len, } /* }}} */ -zend_class_entry *zend_fetch_class_by_name(const char *class_name, uint class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC) /* {{{ */ +zend_class_entry *zend_fetch_class_by_name(const char *class_name, zend_str_size_uint class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC) /* {{{ */ { zend_class_entry **pce; int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0; @@ -1674,7 +1675,7 @@ ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC) /* {{{ */ } /* }}} */ -ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const char *name, int name_len, ulong hash_value TSRMLS_DC) /* {{{ */ +ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const char *name, zend_str_size_int name_len, ulong hash_value TSRMLS_DC) /* {{{ */ { if (zend_hash_quick_del(ht, name, name_len, hash_value) == SUCCESS) { name_len--; @@ -1697,7 +1698,7 @@ ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const c } /* }}} */ -ZEND_API int zend_delete_global_variable_ex(const char *name, int name_len, ulong hash_value TSRMLS_DC) /* {{{ */ +ZEND_API int zend_delete_global_variable_ex(const char *name, zend_str_size_int name_len, ulong hash_value TSRMLS_DC) /* {{{ */ { zend_execute_data *ex; @@ -1722,7 +1723,7 @@ ZEND_API int zend_delete_global_variable_ex(const char *name, int name_len, ulon } /* }}} */ -ZEND_API int zend_delete_global_variable(const char *name, int name_len TSRMLS_DC) /* {{{ */ +ZEND_API int zend_delete_global_variable(const char *name, zend_str_size_int name_len TSRMLS_DC) /* {{{ */ { return zend_delete_global_variable_ex(name, name_len, zend_inline_hash_func(name, name_len + 1) TSRMLS_CC); } diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index c4cd8421cc78c..1afa5d4ea8e6c 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -49,7 +49,7 @@ #define HT_DESTROYED 2 #define HT_CLEANING 3 -static void _zend_is_inconsistent(const HashTable *ht, const char *file, int line) +static void _zend_is_inconsistent(const HashTable *ht, const char *file, zend_str_size_int line) { if (ht->inconsistent==HT_OK) { return; @@ -98,7 +98,7 @@ static void _zend_is_inconsistent(const HashTable *ht, const char *file, int lin static void zend_hash_do_resize(HashTable *ht); -ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength) +ZEND_API ulong zend_hash_func(const char *arKey, zend_str_size_uint nKeyLength) { return zend_inline_hash_func(arKey, nKeyLength); } @@ -188,7 +188,7 @@ ZEND_API void zend_hash_set_apply_protection(HashTable *ht, zend_bool bApplyProt -ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) { ulong h; uint nIndex; @@ -265,7 +265,7 @@ ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKe return SUCCESS; } -ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) { uint nIndex; Bucket *p; @@ -340,7 +340,7 @@ ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, ui } -ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, uint nKeyLength) +ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength) { void *dummy = (void *) 1; @@ -459,7 +459,7 @@ ZEND_API int zend_hash_rehash(HashTable *ht) return SUCCESS; } -ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, int flag) +ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, ulong h, int flag) { uint nIndex; Bucket *p; @@ -876,7 +876,7 @@ ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor } -ZEND_API ulong zend_get_hash_value(const char *arKey, uint nKeyLength) +ZEND_API ulong zend_get_hash_value(const char *arKey, zend_str_size_uint nKeyLength) { return zend_inline_hash_func(arKey, nKeyLength); } @@ -886,7 +886,7 @@ ZEND_API ulong zend_get_hash_value(const char *arKey, uint nKeyLength) * data is returned in pData. The reason is that there's no reason * someone using the hash table might not want to have NULL data */ -ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, uint nKeyLength, void **pData) +ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, void **pData) { ulong h; uint nIndex; @@ -910,7 +910,7 @@ ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, uint nKeyLen } -ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void **pData) +ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, ulong h, void **pData) { uint nIndex; Bucket *p; @@ -936,7 +936,7 @@ ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, uint n } -ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, uint nKeyLength) +ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength) { ulong h; uint nIndex; @@ -959,7 +959,7 @@ ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, uint nKeyL } -ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h) +ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, ulong h) { uint nIndex; Bucket *p; @@ -1120,7 +1120,7 @@ ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos) /* This function should be made binary safe */ -ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos) +ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, zend_str_size_uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos) { Bucket *p; @@ -1204,7 +1204,7 @@ ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosi /* This function changes key of current element without changing elements' * order. If element with target key already exists, it will be deleted first. */ -ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, uint str_length, ulong num_index, int mode, HashPosition *pos) +ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, zend_str_size_uint str_length, ulong num_index, int mode, HashPosition *pos) { Bucket *p, *q; ulong h; diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index a0c147f39782a..22a03442e02ed 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -42,7 +42,7 @@ #define HASH_UPDATE_KEY_IF_AFTER 2 #define HASH_UPDATE_KEY_ANYWAY 3 -typedef ulong (*hash_func_t)(const char *arKey, uint nKeyLength); +typedef ulong (*hash_func_t)(const char *arKey, zend_str_size_uint nKeyLength); typedef int (*compare_func_t)(const void *, const void * TSRMLS_DC); typedef void (*sort_func_t)(void *, size_t, register size_t, compare_func_t TSRMLS_DC); typedef void (*dtor_func_t)(void *pDest); @@ -53,7 +53,7 @@ struct _hashtable; typedef struct bucket { ulong h; /* Used for numeric indexing */ - uint nKeyLength; + zend_str_size_uint nKeyLength; void *pData; void *pDataPtr; struct bucket *pListNext; @@ -84,7 +84,7 @@ typedef struct _hashtable { typedef struct _zend_hash_key { const char *arKey; - uint nKeyLength; + zend_str_size_uint nKeyLength; ulong h; } zend_hash_key; @@ -104,13 +104,13 @@ ZEND_API void zend_hash_clean(HashTable *ht); #define zend_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, bApplyProtection) _zend_hash_init_ex((ht), (nSize), (pHashFunction), (pDestructor), (persistent), (bApplyProtection) ZEND_FILE_LINE_CC) /* additions/updates/changes */ -ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); +ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); #define zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \ _zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC) #define zend_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) \ _zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD ZEND_FILE_LINE_CC) -ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); +ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); #define zend_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \ _zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC) #define zend_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \ @@ -122,7 +122,7 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void #define zend_hash_next_index_insert(ht, pData, nDataSize, pDest) \ _zend_hash_index_update_or_next_insert(ht, 0, pData, nDataSize, pDest, HASH_NEXT_INSERT ZEND_FILE_LINE_CC) -ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, uint nKeyLength); +ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength); #define ZEND_HASH_APPLY_KEEP 0 @@ -149,7 +149,7 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR /* Deletes */ -ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, int flag); +ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, ulong h, int flag); #define zend_hash_del(ht, arKey, nKeyLength) \ zend_hash_del_key_or_index(ht, arKey, nKeyLength, 0, HASH_DEL_KEY) #define zend_hash_quick_del(ht, arKey, nKeyLength, h) \ @@ -157,16 +157,16 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint n #define zend_hash_index_del(ht, h) \ zend_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX) -ZEND_API ulong zend_get_hash_value(const char *arKey, uint nKeyLength); +ZEND_API ulong zend_get_hash_value(const char *arKey, zend_str_size_uint nKeyLength); /* Data retreival */ -ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, uint nKeyLength, void **pData); -ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void **pData); +ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, void **pData); +ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, ulong h, void **pData); ZEND_API int zend_hash_index_find(const HashTable *ht, ulong h, void **pData); /* Misc */ -ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, uint nKeyLength); -ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h); +ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength); +ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, ulong h); ZEND_API int zend_hash_index_exists(const HashTable *ht, ulong h); ZEND_API ulong zend_hash_next_free_element(const HashTable *ht); @@ -175,13 +175,13 @@ ZEND_API ulong zend_hash_next_free_element(const HashTable *ht); (zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTANT ? FAILURE : SUCCESS) ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos); ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos); -ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos); +ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, zend_str_size_uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos); ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos); ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos); ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos); ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos); ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos); -ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, uint str_length, ulong num_index, int mode, HashPosition *pos); +ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, zend_str_size_uint str_length, ulong num_index, int mode, HashPosition *pos); typedef struct _HashPointer { HashPosition pos; @@ -260,7 +260,7 @@ ZEND_API int zend_hash_rehash(HashTable *ht); * -- Ralf S. Engelschall */ -static inline ulong zend_inline_hash_func(const char *arKey, uint nKeyLength) +static inline ulong zend_inline_hash_func(const char *arKey, zend_str_size_uint nKeyLength) { register ulong hash = 5381; @@ -290,7 +290,7 @@ EMPTY_SWITCH_DEFAULT_CASE() } -ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength); +ZEND_API ulong zend_hash_func(const char *arKey, zend_str_size_uint nKeyLength); #if ZEND_DEBUG /* debug */ @@ -347,34 +347,34 @@ END_EXTERN_C() ZEND_HANDLE_NUMERIC_EX(key, length, idx, return func); \ } while (0) -static inline int zend_symtable_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) \ +static inline int zend_symtable_update(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, void *pData, uint nDataSize, void **pDest) \ { ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest)); return zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest); } -static inline int zend_symtable_del(HashTable *ht, const char *arKey, uint nKeyLength) +static inline int zend_symtable_del(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength) { ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_del(ht, idx)); return zend_hash_del(ht, arKey, nKeyLength); } -static inline int zend_symtable_find(HashTable *ht, const char *arKey, uint nKeyLength, void **pData) +static inline int zend_symtable_find(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, void **pData) { ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_find(ht, idx, pData)); return zend_hash_find(ht, arKey, nKeyLength, pData); } -static inline int zend_symtable_exists(HashTable *ht, const char *arKey, uint nKeyLength) +static inline int zend_symtable_exists(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength) { ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx)); return zend_hash_exists(ht, arKey, nKeyLength); } -static inline int zend_symtable_update_current_key_ex(HashTable *ht, const char *arKey, uint nKeyLength, int mode, HashPosition *pos) +static inline int zend_symtable_update_current_key_ex(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, int mode, HashPosition *pos) { ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_update_current_key_ex(ht, HASH_KEY_IS_LONG, NULL, 0, idx, mode, pos)); return zend_hash_update_current_key_ex(ht, HASH_KEY_IS_STRING, arKey, nKeyLength, 0, mode, pos); diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 921e0d798a069..fc373e7c34bdc 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -358,12 +358,12 @@ ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce } /* }}} */ -ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info_name, int prop_info_name_len TSRMLS_DC) /* {{{ */ +ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info_name, zend_str_size_int prop_info_name_len TSRMLS_DC) /* {{{ */ { zend_property_info *property_info; const char *class_name, *prop_name; zval member; - int prop_name_len; + zend_str_size prop_name_len; zend_unmangle_property_name_ex(prop_info_name, prop_info_name_len, &class_name, &prop_name, &prop_name_len); ZVAL_STRINGL(&member, prop_name, prop_name_len, 0); @@ -916,7 +916,7 @@ ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ * Returns the function address that should be called, or NULL * if no such function exists. */ -static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen, ulong hash_value TSRMLS_DC) /* {{{ */ +static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, zend_str_size_int function_name_strlen, ulong hash_value TSRMLS_DC) /* {{{ */ { if (!ce) { return 0; @@ -951,7 +951,7 @@ static inline zend_function *zend_check_private_int(zend_function *fbc, zend_cla } /* }}} */ -ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) /* {{{ */ +ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, zend_str_size_int function_name_strlen TSRMLS_DC) /* {{{ */ { return zend_check_private_int(fbc, ce, function_name_strval, function_name_strlen, zend_hash_func(function_name_strval, function_name_strlen+1) TSRMLS_CC) != NULL; } @@ -986,7 +986,7 @@ ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) } /* }}} */ -static inline union _zend_function *zend_get_user_call_function(zend_class_entry *ce, const char *method_name, int method_len) /* {{{ */ +static inline union _zend_function *zend_get_user_call_function(zend_class_entry *ce, const char *method_name, zend_str_size_int method_len) /* {{{ */ { zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function)); call_user_call->type = ZEND_INTERNAL_FUNCTION; @@ -1002,7 +1002,7 @@ static inline union _zend_function *zend_get_user_call_function(zend_class_entry } /* }}} */ -static union _zend_function *zend_std_get_method(zval **object_ptr, char *method_name, int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */ +static union _zend_function *zend_std_get_method(zval **object_ptr, char *method_name, zend_str_size_int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */ { zend_function *fbc; zval *object = *object_ptr; @@ -1147,7 +1147,7 @@ static inline union _zend_function *zend_get_user_callstatic_function(zend_class /* This is not (yet?) in the API, but it belongs in the built-in objects callbacks */ -ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, int function_name_strlen, const zend_literal *key TSRMLS_DC) /* {{{ */ +ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, zend_str_size_int function_name_strlen, const zend_literal *key TSRMLS_DC) /* {{{ */ { zend_function *fbc = NULL; char *lc_class_name, *lc_function_name = NULL; @@ -1236,7 +1236,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const c } /* }}} */ -ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, zend_bool silent, const zend_literal *key TSRMLS_DC) /* {{{ */ +ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, zend_str_size_int property_name_len, zend_bool silent, const zend_literal *key TSRMLS_DC) /* {{{ */ { zend_property_info *property_info; ulong hash_value; @@ -1293,7 +1293,7 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *p } /* }}} */ -ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, const zend_literal *key TSRMLS_DC) /* {{{ */ +ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, const char *property_name, zend_str_size_int property_name_len, const zend_literal *key TSRMLS_DC) /* {{{ */ { zend_error_noreturn(E_ERROR, "Attempt to unset static property %s::$%s", ce->name, property_name); return 0; @@ -1504,7 +1504,7 @@ zend_class_entry *zend_std_object_get_class(const zval *object TSRMLS_DC) /* {{{ } /* }}} */ -int zend_std_object_get_class_name(const zval *object, const char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC) /* {{{ */ +int zend_std_object_get_class_name(const zval *object, const char **class_name, zend_str_size_uint *class_name_len, int parent TSRMLS_DC) /* {{{ */ { zend_object *zobj; zend_class_entry *ce; diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index 07428737ff193..be30af2c759c1 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -88,7 +88,7 @@ typedef HashTable *(*zend_object_get_debug_info_t)(zval *object, int *is_temp TS /* Andi - EX(fbc) (function being called) needs to be initialized already in the INIT fcall opcode so that the parameters can be parsed the right way. We need to add another callback for this. */ typedef int (*zend_object_call_method_t)(const char *method, INTERNAL_FUNCTION_PARAMETERS); -typedef union _zend_function *(*zend_object_get_method_t)(zval **object_ptr, char *method, int method_len, const struct _zend_literal *key TSRMLS_DC); +typedef union _zend_function *(*zend_object_get_method_t)(zval **object_ptr, char *method, zend_str_size_int method_len, const struct _zend_literal *key TSRMLS_DC); typedef union _zend_function *(*zend_object_get_constructor_t)(zval *object TSRMLS_DC); /* Object maintenance/destruction */ @@ -98,7 +98,7 @@ typedef void (*zend_object_delete_obj_t)(zval *object TSRMLS_DC); typedef zend_object_value (*zend_object_clone_obj_t)(zval *object TSRMLS_DC); typedef zend_class_entry *(*zend_object_get_class_entry_t)(const zval *object TSRMLS_DC); -typedef int (*zend_object_get_class_name_t)(const zval *object, const char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC); +typedef int (*zend_object_get_class_name_t)(const zval *object, const char **class_name, zend_str_size_uint *class_name_len, int parent TSRMLS_DC); typedef int (*zend_object_compare_t)(zval *object1, zval *object2 TSRMLS_DC); typedef int (*zend_object_compare_zvals_t)(zval *resul, zval *op1, zval *op2 TSRMLS_DC); @@ -155,9 +155,9 @@ extern ZEND_API zend_object_handlers std_object_handlers; ((fbc)->common.prototype ? (fbc)->common.prototype->common.scope : (fbc)->common.scope) BEGIN_EXTERN_C() -ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, int function_name_strlen, const struct _zend_literal *key TSRMLS_DC); -ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, zend_bool silent, const struct _zend_literal *key TSRMLS_DC); -ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, const struct _zend_literal *key TSRMLS_DC); +ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, zend_str_size_int function_name_strlen, const struct _zend_literal *key TSRMLS_DC); +ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, zend_str_size_int property_name_len, zend_bool silent, const struct _zend_literal *key TSRMLS_DC); +ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, const char *property_name, zend_str_size_int property_name_len, const struct _zend_literal *key TSRMLS_DC); ZEND_API union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC); ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC); ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC); @@ -170,11 +170,11 @@ ZEND_API void rebuild_object_properties(zend_object *zobj); #define IS_ZEND_STD_OBJECT(z) (Z_TYPE(z) == IS_OBJECT && (Z_OBJ_HT((z))->get_class_entry != NULL)) #define HAS_CLASS_ENTRY(z) (Z_OBJ_HT(z)->get_class_entry != NULL) -ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC); +ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, char *function_name_strval, zend_str_size_int function_name_strlen TSRMLS_DC); ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope); -ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info_name, int prop_info_name_len TSRMLS_DC); +ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info_name, zend_str_size_int prop_info_name_len TSRMLS_DC); ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS); END_EXTERN_C() diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 60730121882c5..9f570cccde623 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -79,7 +79,7 @@ static const unsigned char tolower_map[256] = { zend_binary_strncasecmp */ -ZEND_API int zend_atoi(const char *str, int str_len) /* {{{ */ +ZEND_API int zend_atoi(const char *str, zend_str_size_int str_len) /* {{{ */ { int retval; @@ -107,7 +107,7 @@ ZEND_API int zend_atoi(const char *str, int str_len) /* {{{ */ } /* }}} */ -ZEND_API long zend_atol(const char *str, int str_len) /* {{{ */ +ZEND_API long zend_atol(const char *str, zend_str_size_int str_len) /* {{{ */ { long retval; @@ -135,7 +135,7 @@ ZEND_API long zend_atol(const char *str, int str_len) /* {{{ */ } /* }}} */ -ZEND_API double zend_string_to_double(const char *number, zend_uint length) /* {{{ */ +ZEND_API double zend_string_to_double(const char *number, zend_str_size_uint length) /* {{{ */ { double divisor = 10.0; double result = 0.0; @@ -1108,7 +1108,7 @@ ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */ ZVAL_LONG(result, ~zend_dval_to_lval(Z_DVAL_P(op1))); return SUCCESS; case IS_STRING: { - int i; + zend_str_size i; zval op1_copy = *op1; Z_TYPE_P(result) = IS_STRING; @@ -1136,7 +1136,7 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) / if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { zval *longer, *shorter; char *result_str; - int i, result_len; + zend_str_size i, result_len; if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { longer = op1; @@ -1183,7 +1183,7 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { zval *longer, *shorter; char *result_str; - int i, result_len; + zend_str_size i, result_len; if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { longer = op1; @@ -1230,7 +1230,7 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { zval *longer, *shorter; char *result_str; - int i, result_len; + zend_str_size i, result_len; if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { longer = op1; @@ -1312,7 +1312,7 @@ ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* must support result==op1 */ ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */ { - int length = Z_STRLEN_P(op1) + 1; + zend_str_size length = Z_STRLEN_P(op1) + 1; char *buf; if (IS_INTERNED(Z_STRVAL_P(op1))) { @@ -1331,7 +1331,7 @@ ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) /* must support result==op1 */ ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */ { - int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); + zend_str_size length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); char *buf; if (IS_INTERNED(Z_STRVAL_P(op1))) { @@ -1376,9 +1376,9 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{ op2 = &op2_copy; } if (result==op1 && !IS_INTERNED(Z_STRVAL_P(op1))) { /* special case, perform operations on result */ - uint res_len = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); + zend_str_size res_len = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); - if (Z_STRLEN_P(result) < 0 || (int) (Z_STRLEN_P(op1) + Z_STRLEN_P(op2)) < 0) { + if (res_len < Z_STRLEN_P(op1) || res_len < Z_STRLEN_P(op2)) { efree(Z_STRVAL_P(result)); ZVAL_EMPTY_STRING(result); zend_error(E_ERROR, "String size overflow"); @@ -1390,7 +1390,7 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{ Z_STRVAL_P(result)[res_len]=0; Z_STRLEN_P(result) = res_len; } else { - int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); + zend_str_size length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); char *buf = (char *) emalloc(length + 1); memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); @@ -1835,7 +1835,7 @@ ZEND_API zend_bool instanceof_function(const zend_class_entry *instance_ce, cons static void increment_string(zval *str) /* {{{ */ { int carry=0; - int pos=Z_STRLEN_P(str)-1; + zend_str_size pos=Z_STRLEN_P(str)-1; char *s=Z_STRVAL_P(str); char *t; int last=0; /* Shut up the compiler warning */ @@ -2056,7 +2056,7 @@ ZEND_API void zend_update_current_locale(void) /* {{{ */ /* }}} */ #endif -ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned int length) /* {{{ */ +ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, zend_str_size_uint length) /* {{{ */ { register unsigned char *str = (unsigned char*)source; register unsigned char *result = (unsigned char*)dest; @@ -2071,13 +2071,13 @@ ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned in } /* }}} */ -ZEND_API char *zend_str_tolower_dup(const char *source, unsigned int length) /* {{{ */ +ZEND_API char *zend_str_tolower_dup(const char *source, zend_str_size_uint length) /* {{{ */ { return zend_str_tolower_copy((char *)emalloc(length+1), source, length); } /* }}} */ -ZEND_API void zend_str_tolower(char *str, unsigned int length) /* {{{ */ +ZEND_API void zend_str_tolower(char *str, zend_str_size_uint length) /* {{{ */ { register unsigned char *p = (unsigned char*)str; register unsigned char *end = p + length; @@ -2089,9 +2089,9 @@ ZEND_API void zend_str_tolower(char *str, unsigned int length) /* {{{ */ } /* }}} */ -ZEND_API int zend_binary_strcmp(const char *s1, uint len1, const char *s2, uint len2) /* {{{ */ +ZEND_API zend_str_size_int zend_binary_strcmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ { - int retval; + zend_str_size retval; if (s1 == s2) { return 0; @@ -2105,9 +2105,9 @@ ZEND_API int zend_binary_strcmp(const char *s1, uint len1, const char *s2, uint } /* }}} */ -ZEND_API int zend_binary_strncmp(const char *s1, uint len1, const char *s2, uint len2, uint length) /* {{{ */ +ZEND_API zend_str_size_int zend_binary_strncmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ { - int retval; + zend_str_size retval; if (s1 == s2) { return 0; @@ -2121,10 +2121,10 @@ ZEND_API int zend_binary_strncmp(const char *s1, uint len1, const char *s2, uint } /* }}} */ -ZEND_API int zend_binary_strcasecmp(const char *s1, uint len1, const char *s2, uint len2) /* {{{ */ +ZEND_API zend_str_size_int zend_binary_strcasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ { - int len; - int c1, c2; + zend_str_size len; + zend_str_size c1, c2; if (s1 == s2) { return 0; @@ -2143,10 +2143,10 @@ ZEND_API int zend_binary_strcasecmp(const char *s1, uint len1, const char *s2, u } /* }}} */ -ZEND_API int zend_binary_strncasecmp(const char *s1, uint len1, const char *s2, uint len2, uint length) /* {{{ */ +ZEND_API zend_str_size_int zend_binary_strncasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ { - int len; - int c1, c2; + zend_str_size len; + zend_str_size c1, c2; if (s1 == s2) { return 0; @@ -2164,10 +2164,10 @@ ZEND_API int zend_binary_strncasecmp(const char *s1, uint len1, const char *s2, } /* }}} */ -ZEND_API int zend_binary_strcasecmp_l(const char *s1, uint len1, const char *s2, uint len2) /* {{{ */ +ZEND_API zend_str_size_int zend_binary_strcasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ { - int len; - int c1, c2; + zend_str_size len; + zend_str_size c1, c2; if (s1 == s2) { return 0; @@ -2186,10 +2186,10 @@ ZEND_API int zend_binary_strcasecmp_l(const char *s1, uint len1, const char *s2, } /* }}} */ -ZEND_API int zend_binary_strncasecmp_l(const char *s1, uint len1, const char *s2, uint len2, uint length) /* {{{ */ +ZEND_API zend_str_size_int zend_binary_strncasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ { - int len; - int c1, c2; + zend_str_size len; + zend_str_size c1, c2; if (s1 == s2) { return 0; @@ -2207,25 +2207,25 @@ ZEND_API int zend_binary_strncasecmp_l(const char *s1, uint len1, const char *s2 } /* }}} */ -ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2) /* {{{ */ +ZEND_API zend_str_size_int zend_binary_zval_strcmp(zval *s1, zval *s2) /* {{{ */ { return zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); } /* }}} */ -ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) /* {{{ */ +ZEND_API zend_str_size_int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) /* {{{ */ { return zend_binary_strncmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); } /* }}} */ -ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2) /* {{{ */ +ZEND_API zend_str_size_int zend_binary_zval_strcasecmp(zval *s1, zval *s2) /* {{{ */ { return zend_binary_strcasecmp_l(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); } /* }}} */ -ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) /* {{{ */ +ZEND_API zend_str_size_int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) /* {{{ */ { return zend_binary_strncasecmp_l(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); } diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index e7ab9bb3fe9e4..7e361a7efb93c 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -128,7 +128,7 @@ static zend_always_inline long zend_dval_to_lval(double d) * could not be represented as such due to overflow. It writes 1 to oflow_info * if the integer is larger than LONG_MAX and -1 if it's smaller than LONG_MIN. */ -static inline zend_uchar is_numeric_string_ex(const char *str, int length, long *lval, double *dval, int allow_errors, int *oflow_info) +static inline zend_uchar is_numeric_string_ex(const char *str, zend_str_size_int length, long *lval, double *dval, int allow_errors, int *oflow_info) { const char *ptr; int base = 10, digits = 0, dp_or_e = 0; @@ -265,12 +265,12 @@ static inline zend_uchar is_numeric_string_ex(const char *str, int length, long } } -static inline zend_uchar is_numeric_string(const char *str, int length, long *lval, double *dval, int allow_errors) { +static inline zend_uchar is_numeric_string(const char *str, zend_str_size_int length, long *lval, double *dval, int allow_errors) { return is_numeric_string_ex(str, length, lval, dval, allow_errors, NULL); } static inline char * -zend_memnstr(char *haystack, char *needle, int needle_len, char *end) +zend_memnstr(char *haystack, char *needle, zend_str_size_int needle_len, char *end) { char *p = haystack; char ne = needle[needle_len-1]; @@ -302,7 +302,7 @@ zend_memnstr(char *haystack, char *needle, int needle_len, char *end) return NULL; } -static inline const void *zend_memrchr(const void *s, int c, size_t n) +static inline const void *zend_memrchr(const void *s, int c, zend_str_size_size_t n) { register const unsigned char *e; @@ -341,7 +341,7 @@ ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2 #define convert_to_cstring(op) if ((op)->type != IS_STRING) { _convert_to_cstring((op) ZEND_FILE_LINE_CC); } #define convert_to_string(op) if ((op)->type != IS_STRING) { _convert_to_string((op) ZEND_FILE_LINE_CC); } -ZEND_API double zend_string_to_double(const char *number, zend_uint length); +ZEND_API double zend_string_to_double(const char *number, zend_str_size_uint length); ZEND_API int zval_is_true(zval *op); ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); @@ -353,27 +353,27 @@ ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2 TSR ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); #endif -ZEND_API void zend_str_tolower(char *str, unsigned int length); -ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned int length); -ZEND_API char *zend_str_tolower_dup(const char *source, unsigned int length); +ZEND_API void zend_str_tolower(char *str, zend_str_size_uint length); +ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, zend_str_size_uint length); +ZEND_API char *zend_str_tolower_dup(const char *source, zend_str_size_uint length); -ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2); -ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3); -ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2); -ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3); -ZEND_API int zend_binary_strcmp(const char *s1, uint len1, const char *s2, uint len2); -ZEND_API int zend_binary_strncmp(const char *s1, uint len1, const char *s2, uint len2, uint length); -ZEND_API int zend_binary_strcasecmp(const char *s1, uint len1, const char *s2, uint len2); -ZEND_API int zend_binary_strncasecmp(const char *s1, uint len1, const char *s2, uint len2, uint length); -ZEND_API int zend_binary_strncasecmp_l(const char *s1, uint len1, const char *s2, uint len2, uint length); +ZEND_API zend_str_size_int zend_binary_zval_strcmp(zval *s1, zval *s2); +ZEND_API zend_str_size_int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3); +ZEND_API zend_str_size_int zend_binary_zval_strcasecmp(zval *s1, zval *s2); +ZEND_API zend_str_size_int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3); +ZEND_API zend_str_size_int zend_binary_strcmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2); +ZEND_API zend_str_size_int zend_binary_strncmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); +ZEND_API zend_str_size_int zend_binary_strcasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2); +ZEND_API zend_str_size_int zend_binary_strncasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); +ZEND_API zend_str_size_int zend_binary_strncasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2); ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC); ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC); ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC); -ZEND_API int zend_atoi(const char *str, int str_len); -ZEND_API long zend_atol(const char *str, int str_len); +ZEND_API int zend_atoi(const char *str, zend_str_size_int str_len); +ZEND_API long zend_atol(const char *str, zend_str_size_int str_len); ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC); END_EXTERN_C() @@ -441,7 +441,14 @@ END_EXTERN_C() #define Z_BVAL(zval) ((zend_bool)(zval).value.lval) #define Z_DVAL(zval) (zval).value.dval #define Z_STRVAL(zval) (zval).value.str.val + +#ifdef ZEND_USE_LEGACY_STRING_TYPES #define Z_STRLEN(zval) (zval).value.str.len +#define Z_STRLEN_P(zval_p) Z_STRLEN(*zval_p) +#define Z_STRLEN_PP(zval_pp) Z_STRLEN(**zval_pp) +#endif + +#define Z_STRSIZE(zval) (zval).value.str.len #define Z_ARRVAL(zval) (zval).value.ht #define Z_OBJVAL(zval) (zval).value.obj #define Z_OBJ_HANDLE(zval) Z_OBJVAL(zval).handle @@ -456,7 +463,7 @@ END_EXTERN_C() #define Z_BVAL_P(zval_p) Z_BVAL(*zval_p) #define Z_DVAL_P(zval_p) Z_DVAL(*zval_p) #define Z_STRVAL_P(zval_p) Z_STRVAL(*zval_p) -#define Z_STRLEN_P(zval_p) Z_STRLEN(*zval_p) +#define Z_STRSIZE_P(zval_p) Z_STRSIZE(*zval_p) #define Z_ARRVAL_P(zval_p) Z_ARRVAL(*zval_p) #define Z_OBJPROP_P(zval_p) Z_OBJPROP(*zval_p) #define Z_OBJCE_P(zval_p) Z_OBJCE(*zval_p) @@ -471,7 +478,7 @@ END_EXTERN_C() #define Z_BVAL_PP(zval_pp) Z_BVAL(**zval_pp) #define Z_DVAL_PP(zval_pp) Z_DVAL(**zval_pp) #define Z_STRVAL_PP(zval_pp) Z_STRVAL(**zval_pp) -#define Z_STRLEN_PP(zval_pp) Z_STRLEN(**zval_pp) +#define Z_STRSIZE_PP(zval_pp) Z_STRSIZE(**zval_pp) #define Z_ARRVAL_PP(zval_pp) Z_ARRVAL(**zval_pp) #define Z_OBJPROP_PP(zval_pp) Z_OBJPROP(**zval_pp) #define Z_OBJCE_PP(zval_pp) Z_OBJCE(**zval_pp) diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 9cdf31fb343da..d5fb76fc4fc8e 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -28,6 +28,19 @@ typedef unsigned int zend_uint; typedef unsigned long zend_ulong; typedef unsigned short zend_ushort; + +#ifdef ZEND_USE_LEGACY_STRING_TYPES +#define zend_str_size_int int +#define zend_str_size_uint unsigned int +#define zend_str_size_size_t size_t +typedef int zend_str_size; +#else +#define zend_str_size_int zend_str_size +#define zend_str_size_uint zend_str_size +#define zend_str_size_size_t zend_str_size +typedef size_t zend_str_size; +#endif + #define HAVE_ZEND_LONG64 #ifdef ZEND_WIN32 typedef __int64 zend_long64; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index a15e4c66d5a19..5ea7cd285618d 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2428,7 +2428,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV) USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; zend_free_op free_op1, free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -2546,7 +2546,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS /* do nothing */ } else if (OP2_TYPE != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size function_name_strlen = 0; zend_free_op free_op2; if (OP2_TYPE == IS_CONST) { @@ -2649,7 +2649,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) ZEND_VM_NEXT_OPCODE(); } else { char *function_name_strval, *lcname; - int function_name_strlen; + zend_str_size function_name_strlen; zend_free_op free_op2; SAVE_OPLINE(); @@ -4216,7 +4216,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY) zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { char *str_key; - uint str_key_len; + zend_str_size str_key_len; ulong int_key; zend_uchar key_type; @@ -4273,7 +4273,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) zend_object *zobj = zend_objects_get_address(array TSRMLS_CC); int key_type; char *str_key; - zend_uint str_key_len; + zend_str_size str_key_len; zend_ulong int_key; fe_ht = Z_OBJPROP_P(array); @@ -4294,7 +4294,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) ZVAL_LONG(key, int_key); } else { const char *class_name, *prop_name; - int prop_name_len; + zend_str_size prop_name_len; zend_unmangle_property_name_ex( str_key, str_key_len - 1, &class_name, &prop_name, &prop_name_len ); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index c947c3e17f59b..a2da483595b63 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1234,7 +1234,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE ZEND_VM_NEXT_OPCODE(); } else { char *function_name_strval, *lcname; - int function_name_strlen; + zend_str_size function_name_strlen; SAVE_OPLINE(); @@ -1427,7 +1427,6 @@ static int ZEND_FASTCALL ZEND_BRK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SAVE_OPLINE(); el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, EX(op_array), execute_data TSRMLS_CC); - ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); } @@ -1439,7 +1438,6 @@ static int ZEND_FASTCALL ZEND_CONT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SAVE_OPLINE(); el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, EX(op_array), execute_data TSRMLS_CC); - ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); } @@ -1561,7 +1559,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H ZEND_VM_NEXT_OPCODE(); } else { char *function_name_strval, *lcname; - int function_name_strlen; + zend_str_size function_name_strlen; zend_free_op free_op2; SAVE_OPLINE(); @@ -1748,7 +1746,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H ZEND_VM_NEXT_OPCODE(); } else { char *function_name_strval, *lcname; - int function_name_strlen; + zend_str_size function_name_strlen; zend_free_op free_op2; SAVE_OPLINE(); @@ -1973,7 +1971,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA ZEND_VM_NEXT_OPCODE(); } else { char *function_name_strval, *lcname; - int function_name_strlen; + zend_str_size function_name_strlen; SAVE_OPLINE(); @@ -2901,7 +2899,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { char *str_key; - uint str_key_len; + zend_str_size str_key_len; ulong int_key; zend_uchar key_type; @@ -3590,7 +3588,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( /* do nothing */ } else if (IS_CONST != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size function_name_strlen = 0; if (IS_CONST == IS_CONST) { @@ -4577,7 +4575,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE /* do nothing */ } else if (IS_TMP_VAR != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size function_name_strlen = 0; zend_free_op free_op2; if (IS_TMP_VAR == IS_CONST) { @@ -5433,7 +5431,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE /* do nothing */ } else if (IS_VAR != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size function_name_strlen = 0; zend_free_op free_op2; if (IS_VAR == IS_CONST) { @@ -6149,7 +6147,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER /* do nothing */ } else if (IS_UNUSED != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size function_name_strlen = 0; if (IS_UNUSED == IS_CONST) { @@ -7005,7 +7003,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN /* do nothing */ } else if (IS_CV != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size function_name_strlen = 0; if (IS_CV == IS_CONST) { @@ -8209,7 +8207,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { char *str_key; - uint str_key_len; + zend_str_size str_key_len; ulong int_key; zend_uchar key_type; @@ -8959,7 +8957,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; zend_free_op free_op1; call_slot *call = EX(call_slots) + opline->result.num; @@ -9814,7 +9812,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; zend_free_op free_op1, free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -10674,7 +10672,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; zend_free_op free_op1, free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -12110,7 +12108,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_ USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; zend_free_op free_op1; call_slot *call = EX(call_slots) + opline->result.num; @@ -13539,7 +13537,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { char *str_key; - uint str_key_len; + zend_str_size str_key_len; ulong int_key; zend_uchar key_type; @@ -13596,7 +13594,7 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_object *zobj = zend_objects_get_address(array TSRMLS_CC); int key_type; char *str_key; - zend_uint str_key_len; + zend_str_size str_key_len; zend_ulong int_key; fe_ht = Z_OBJPROP_P(array); @@ -13617,7 +13615,7 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG ZVAL_LONG(key, int_key); } else { const char *class_name, *prop_name; - int prop_name_len; + zend_str_size prop_name_len; zend_unmangle_property_name_ex( str_key, str_key_len - 1, &class_name, &prop_name, &prop_name_len ); @@ -15343,7 +15341,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; zend_free_op free_op1; call_slot *call = EX(call_slots) + opline->result.num; @@ -15460,7 +15458,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE /* do nothing */ } else if (IS_CONST != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size function_name_strlen = 0; if (IS_CONST == IS_CONST) { @@ -17689,7 +17687,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; zend_free_op free_op1, free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -17807,7 +17805,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND /* do nothing */ } else if (IS_TMP_VAR != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size function_name_strlen = 0; zend_free_op free_op2; if (IS_TMP_VAR == IS_CONST) { @@ -20000,7 +19998,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; zend_free_op free_op1, free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -20118,7 +20116,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND /* do nothing */ } else if (IS_VAR != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size function_name_strlen = 0; zend_free_op free_op2; if (IS_VAR == IS_CONST) { @@ -21554,7 +21552,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z /* do nothing */ } else if (IS_UNUSED != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size function_name_strlen = 0; if (IS_UNUSED == IS_CONST) { @@ -23451,7 +23449,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_ USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; zend_free_op free_op1; call_slot *call = EX(call_slots) + opline->result.num; @@ -23568,7 +23566,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ /* do nothing */ } else if (IS_CV != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size function_name_strlen = 0; if (IS_CV == IS_CONST) { @@ -25087,7 +25085,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; call_slot *call = EX(call_slots) + opline->result.num; @@ -26504,7 +26502,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; zend_free_op free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -27827,7 +27825,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; zend_free_op free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -29573,7 +29571,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; call_slot *call = EX(call_slots) + opline->result.num; @@ -31162,7 +31160,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { char *str_key; - uint str_key_len; + zend_str_size str_key_len; ulong int_key; zend_uchar key_type; @@ -32824,7 +32822,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; call_slot *call = EX(call_slots) + opline->result.num; @@ -34940,7 +34938,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_ USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; zend_free_op free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -37115,7 +37113,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_ USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; zend_free_op free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -40285,7 +40283,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size function_name_strlen; call_slot *call = EX(call_slots) + opline->result.num; diff --git a/configure.in b/configure.in index 260b982ce8a43..4c16ec2134a01 100644 --- a/configure.in +++ b/configure.in @@ -60,7 +60,7 @@ AH_BOTTOM([ #endif #if ZEND_BROKEN_SPRINTF -int zend_sprintf(char *buffer, const char *format, ...); +zend_str_size_int zend_sprintf(char *buffer, const char *format, ...); #else # define zend_sprintf sprintf #endif @@ -861,6 +861,13 @@ else ZEND_DEBUG=no fi +PHP_ARG_ENABLE(zstrlen, whether to include Z_STRLEN macros, +[ --enable-zstrlen Enable legacy Z_STRLEN macros and types], no, no) + +if test "$PHP_ZSTRLEN" = "yes"; then + AC_DEFINE(ZEND_USE_LEGACY_STRING_TYPES, "1", [ ]) +fi + PHP_ARG_WITH(layout, layout of installed files, [ --with-layout=TYPE Set how installed files will be laid out. Type can be either PHP or GNU @<:@PHP@:>@], PHP, no) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 28ac86b119170..e63450e948873 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -945,7 +945,7 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC) zval ztz; if (SUCCESS == zend_get_configuration_directive("date.timezone", sizeof("date.timezone"), &ztz) - && Z_TYPE(ztz) == IS_STRING && Z_STRLEN(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) { + && Z_TYPE(ztz) == IS_STRING && Z_STRSIZE(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) { return Z_STRVAL(ztz); } } else if (*DATEG(default_timezone)) { @@ -1038,10 +1038,10 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d) /* }}} */ /* {{{ date_format - (gm)date helper */ -static char *date_format(char *format, int format_len, timelib_time *t, int localtime) +static char *date_format(char *format, zend_str_size_int format_len, timelib_time *t, int localtime) { smart_str string = {0}; - int i, length; + zend_str_size i, length; char buffer[97]; timelib_time_offset *offset = NULL; timelib_sll isoweek, isoyear; @@ -1199,11 +1199,11 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime) { char *format; - int format_len; + zend_str_size format_len; long ts; char *string; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &format, &format_len, &ts) == FAILURE) { RETURN_FALSE; } if (ZEND_NUM_ARGS() == 1) { @@ -1216,7 +1216,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime) } /* }}} */ -PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localtime TSRMLS_DC) /* {{{ */ +PHPAPI char *php_format_date(char *format, zend_str_size_int format_len, time_t ts, int localtime TSRMLS_DC) /* {{{ */ { timelib_time *t; timelib_tzinfo *tzi; @@ -1358,11 +1358,11 @@ PHP_FUNCTION(gmdate) PHP_FUNCTION(idate) { char *format; - int format_len; + zend_str_size_int format_len; long ts = 0; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &format, &format_len, &ts) == FAILURE) { RETURN_FALSE; } @@ -1425,7 +1425,8 @@ PHPAPI signed long php_parse_date(char *string, signed long *now) PHP_FUNCTION(strtotime) { char *times, *initial_ts; - int time_len, error1, error2; + zend_str_size time_len; + int error1, error2; struct timelib_error_container *error; long preset_ts = 0, ts; @@ -1610,7 +1611,7 @@ PHP_FUNCTION(checkdate) PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) { char *format, *buf; - int format_len; + zend_str_size format_len; long timestamp = 0; struct tm ta; int max_reallocs = 5; @@ -1621,7 +1622,7 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) timestamp = (long) time(NULL); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, ×tamp) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &format, &format_len, ×tamp) == FAILURE) { RETURN_FALSE; } @@ -2526,7 +2527,7 @@ static void update_errors_warnings(timelib_error_container *last_errors TSRMLS_D DATEG(last_errors) = last_errors; } -PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC) +PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, zend_str_size_int time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC) { timelib_time *now; timelib_tzinfo *tzi = NULL; @@ -2615,9 +2616,9 @@ PHP_FUNCTION(date_create) { zval *timezone_object = NULL; char *time_str = NULL; - int time_str_len = 0; + zend_str_size time_str_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|SO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { RETURN_FALSE; } @@ -2635,9 +2636,9 @@ PHP_FUNCTION(date_create_immutable) { zval *timezone_object = NULL; char *time_str = NULL; - int time_str_len = 0; + zend_str_size time_str_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|SO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { RETURN_FALSE; } @@ -2655,9 +2656,9 @@ PHP_FUNCTION(date_create_from_format) { zval *timezone_object = NULL; char *time_str = NULL, *format_str = NULL; - int time_str_len = 0, format_str_len = 0; + zend_str_size time_str_len = 0, format_str_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { RETURN_FALSE; } @@ -2675,9 +2676,9 @@ PHP_FUNCTION(date_create_immutable_from_format) { zval *timezone_object = NULL; char *time_str = NULL, *format_str = NULL; - int time_str_len = 0, format_str_len = 0; + zend_str_size time_str_len = 0, format_str_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { RETURN_FALSE; } @@ -2695,11 +2696,11 @@ PHP_METHOD(DateTime, __construct) { zval *timezone_object = NULL; char *time_str = NULL; - int time_str_len = 0; + zend_str_size time_str_len = 0; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|SO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC); } zend_restore_error_handling(&error_handling TSRMLS_CC); @@ -2713,11 +2714,11 @@ PHP_METHOD(DateTimeImmutable, __construct) { zval *timezone_object = NULL; char *time_str = NULL; - int time_str_len = 0; + zend_str_size time_str_len = 0; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|SO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC); } zend_restore_error_handling(&error_handling TSRMLS_CC); @@ -2743,10 +2744,10 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat switch (Z_LVAL_PP(z_timezone_type)) { case TIMELIB_ZONETYPE_OFFSET: case TIMELIB_ZONETYPE_ABBR: { - char *tmp = emalloc(Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2); + char *tmp = emalloc(Z_STRSIZE_PP(z_date) + Z_STRSIZE_PP(z_timezone) + 2); int ret; - snprintf(tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2, "%s %s", Z_STRVAL_PP(z_date), Z_STRVAL_PP(z_timezone)); - ret = php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC); + snprintf(tmp, Z_STRSIZE_PP(z_date) + Z_STRSIZE_PP(z_timezone) + 2, "%s %s", Z_STRVAL_PP(z_date), Z_STRVAL_PP(z_timezone)); + ret = php_date_initialize(*dateobj, tmp, Z_STRSIZE_PP(z_date) + Z_STRSIZE_PP(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC); efree(tmp); return 1 == ret; } @@ -2763,7 +2764,7 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat tzobj->tzi.tz = tzi; tzobj->initialized = 1; - ret = php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC); + ret = php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRSIZE_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC); zval_ptr_dtor(&tmp_obj); return 1 == ret; } @@ -2954,11 +2955,11 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time * PHP_FUNCTION(date_parse) { char *date; - int date_len; + zend_str_size date_len; struct timelib_error_container *error; timelib_time *parsed_time; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &date, &date_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &date, &date_len) == FAILURE) { RETURN_FALSE; } @@ -2973,11 +2974,11 @@ PHP_FUNCTION(date_parse) PHP_FUNCTION(date_parse_from_format) { char *date, *format; - int date_len, format_len; + zend_str_size date_len, format_len; struct timelib_error_container *error; timelib_time *parsed_time; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &format, &format_len, &date, &date_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &format, &format_len, &date, &date_len) == FAILURE) { RETURN_FALSE; } @@ -2994,9 +2995,9 @@ PHP_FUNCTION(date_format) zval *object; php_date_obj *dateobj; char *format; - int format_len; + zend_str_size format_len; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_interface, &format, &format_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OS", &object, date_ce_interface, &format, &format_len) == FAILURE) { RETURN_FALSE; } dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC); @@ -3005,7 +3006,7 @@ PHP_FUNCTION(date_format) } /* }}} */ -static int php_date_modify(zval *object, char *modify, int modify_len TSRMLS_DC) +static int php_date_modify(zval *object, char *modify, zend_str_size_int modify_len TSRMLS_DC) { php_date_obj *dateobj; timelib_time *tmp_time; @@ -3074,9 +3075,9 @@ PHP_FUNCTION(date_modify) { zval *object; char *modify; - int modify_len; + zend_str_size modify_len; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_date, &modify, &modify_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OS", &object, date_ce_date, &modify, &modify_len) == FAILURE) { RETURN_FALSE; } @@ -3094,9 +3095,9 @@ PHP_METHOD(DateTimeImmutable, modify) { zval *object, *new_object; char *modify; - int modify_len; + zend_str_size modify_len; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_immutable, &modify, &modify_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OS", &object, date_ce_immutable, &modify, &modify_len) == FAILURE) { RETURN_FALSE; } @@ -3647,11 +3648,11 @@ static int timezone_initialize(timelib_tzinfo **tzi, /*const*/ char *tz TSRMLS_D PHP_FUNCTION(timezone_open) { char *tz; - int tz_len; + zend_str_size tz_len; timelib_tzinfo *tzi = NULL; php_timezone_obj *tzobj; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &tz, &tz_len) == FAILURE) { RETURN_FALSE; } if (SUCCESS != timezone_initialize(&tzi, tz TSRMLS_CC)) { @@ -3670,13 +3671,13 @@ PHP_FUNCTION(timezone_open) PHP_METHOD(DateTimeZone, __construct) { char *tz; - int tz_len; + zend_str_size tz_len; timelib_tzinfo *tzi = NULL; php_timezone_obj *tzobj; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len)) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &tz, &tz_len)) { if (SUCCESS == timezone_initialize(&tzi, tz TSRMLS_CC)) { tzobj = zend_object_store_get_object(getThis() TSRMLS_CC); tzobj->type = TIMELIB_ZONETYPE_ID; @@ -3703,8 +3704,8 @@ static int php_date_timezone_initialize_from_hash(zval **return_value, php_timez case TIMELIB_ZONETYPE_OFFSET: { char *offset, *offset_start; - offset = emalloc(sizeof(char) * (Z_STRLEN_PP(z_timezone) + 1)); - memmove(offset, Z_STRVAL_PP(z_timezone), Z_STRLEN_PP(z_timezone)+1); + offset = emalloc(sizeof(char) * (Z_STRSIZE_PP(z_timezone) + 1)); + memmove(offset, Z_STRVAL_PP(z_timezone), Z_STRSIZE_PP(z_timezone)+1); offset_start = offset; ++offset; @@ -3813,11 +3814,11 @@ PHP_FUNCTION(timezone_name_from_abbr) { char *abbr; char *tzid; - int abbr_len; + zend_str_size abbr_len; long gmtoffset = -1; long isdst = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &abbr, &abbr_len, &gmtoffset, &isdst) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ll", &abbr, &abbr_len, &gmtoffset, &isdst) == FAILURE) { RETURN_FALSE; } tzid = timelib_timezone_id_from_abbr(abbr, gmtoffset, isdst); @@ -3971,7 +3972,7 @@ PHP_FUNCTION(timezone_location_get) } /* }}} */ -static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *format, int format_length TSRMLS_DC) +static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *format, zend_str_size_int format_length TSRMLS_DC) { timelib_time *b = NULL, *e = NULL; timelib_rel_time *p = NULL; @@ -4131,13 +4132,13 @@ void date_interval_write_property(zval *object, zval *member, zval *value, const PHP_METHOD(DateInterval, __construct) { char *interval_string = NULL; - int interval_string_length; + zend_str_size interval_string_length; php_interval_obj *diobj; timelib_rel_time *reltime; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &interval_string, &interval_string_length) == SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &interval_string, &interval_string_length) == SUCCESS) { if (date_interval_initialize(&reltime, interval_string, interval_string_length TSRMLS_CC) == SUCCESS) { diobj = zend_object_store_get_object(getThis() TSRMLS_CC); diobj->diff = reltime; @@ -4238,12 +4239,12 @@ PHP_METHOD(DateInterval, __wakeup) PHP_FUNCTION(date_interval_create_from_date_string) { char *time_str = NULL; - int time_str_len = 0; + zend_str_size time_str_len = 0; timelib_time *time; timelib_error_container *err = NULL; php_interval_obj *diobj; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &time_str, &time_str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &time_str, &time_str_len) == FAILURE) { RETURN_FALSE; } @@ -4259,10 +4260,11 @@ PHP_FUNCTION(date_interval_create_from_date_string) /* }}} */ /* {{{ date_interval_format - */ -static char *date_interval_format(char *format, int format_len, timelib_rel_time *t) +static char *date_interval_format(char *format, zend_str_size_int format_len, timelib_rel_time *t) { smart_str string = {0}; - int i, length, have_format_spec = 0; + zend_str_size i, length; + int have_format_spec = 0; char buffer[33]; if (!format_len) { @@ -4328,9 +4330,9 @@ PHP_FUNCTION(date_interval_format) zval *object; php_interval_obj *diobj; char *format; - int format_len; + zend_str_size format_len; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_interval, &format, &format_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OS", &object, date_ce_interval, &format, &format_len) == FAILURE) { RETURN_FALSE; } diobj = (php_interval_obj *) zend_object_store_get_object(object TSRMLS_CC); @@ -4340,7 +4342,7 @@ PHP_FUNCTION(date_interval_format) } /* }}} */ -static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_rel_time **d, long *recurrences, /*const*/ char *format, int format_length TSRMLS_DC) +static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_rel_time **d, long *recurrences, /*const*/ char *format, zend_str_size_int format_length TSRMLS_DC) { timelib_time *b = NULL, *e = NULL; timelib_rel_time *p = NULL; @@ -4375,7 +4377,7 @@ PHP_METHOD(DatePeriod, __construct) zval *start, *end = NULL, *interval; long recurrences = 0, options = 0; char *isostr = NULL; - int isostr_len = 0; + zend_str_size isostr_len = 0; timelib_time *clone; zend_error_handling error_handling; @@ -4478,9 +4480,9 @@ PHP_FUNCTION(timezone_identifiers_list) int i, item_count; long what = PHP_DATE_TIMEZONE_GROUP_ALL; char *option = NULL; - int option_len = 0; + zend_str_size option_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ls", &what, &option, &option_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lS", &what, &option, &option_len) == FAILURE) { RETURN_FALSE; } @@ -4561,9 +4563,9 @@ PHP_FUNCTION(timezone_abbreviations_list) PHP_FUNCTION(date_default_timezone_set) { char *zone; - int zone_len; + zend_str_size zone_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zone, &zone_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &zone, &zone_len) == FAILURE) { RETURN_FALSE; } if (!timelib_timezone_id_is_valid(zone, DATE_TIMEZONEDB)) { diff --git a/ext/date/php_date.h b/ext/date/php_date.h index 725590136c706..9935ed6803b64 100644 --- a/ext/date/php_date.h +++ b/ext/date/php_date.h @@ -190,7 +190,7 @@ PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC); #define _php_strftime php_strftime PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm); #endif -PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localtime TSRMLS_DC); +PHPAPI char *php_format_date(char *format, zend_str_size_int format_len, time_t ts, int localtime TSRMLS_DC); /* Mechanism to set new TZ database */ PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb); @@ -202,7 +202,7 @@ PHPAPI zend_class_entry *php_date_get_timezone_ce(void); /* Functions for creating DateTime objects, and initializing them from a string */ PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC); -PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC); +PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, zend_str_size_int time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC); #endif /* PHP_DATE_H */ diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index ed13b8e576479..cc5451baf0aa4 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -318,9 +318,9 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object, switch(Z_TYPE_P(offset)) { case IS_NULL: Z_STRVAL_P(offset) = ""; - Z_STRLEN_P(offset) = 0; + Z_STRSIZE_P(offset) = 0; case IS_STRING: - if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &retval) == FAILURE) { + if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: zend_error(E_NOTICE, "Undefined index: %s", Z_STRVAL_P(offset)); @@ -333,7 +333,7 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object, case BP_VAR_W: { zval *value; ALLOC_INIT_ZVAL(value); - zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), (void **)&retval); + zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, (void**)&value, sizeof(void*), (void **)&retval); } } } @@ -463,7 +463,7 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval return; } Z_ADDREF_P(value); - zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), NULL); + zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, (void**)&value, sizeof(void*), NULL); return; case IS_DOUBLE: case IS_RESOURCE: @@ -523,11 +523,11 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval return; } if (ht == &EG(symbol_table)) { - if (zend_delete_global_variable(Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC)) { + if (zend_delete_global_variable(Z_STRVAL_P(offset), Z_STRSIZE_P(offset) TSRMLS_CC)) { zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); } } else { - if (zend_symtable_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1) == FAILURE) { + if (zend_symtable_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1) == FAILURE) { zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); } else { spl_array_object *obj = intern; @@ -613,7 +613,7 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o case IS_STRING: { HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); - if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &tmp) != FAILURE) { + if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, (void **) &tmp) != FAILURE) { switch (check_empty) { case 0: return Z_TYPE_PP(tmp) != IS_NULL; @@ -795,7 +795,7 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(obj TSRMLS_CC); zval *tmp, *storage; - int name_len; + zend_str_size name_len; char *zname; zend_class_entry *base; @@ -916,7 +916,7 @@ static int spl_array_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ static int spl_array_skip_protected(spl_array_object *intern, HashTable *aht TSRMLS_DC) /* {{{ */ { char *string_key; - uint string_length; + zend_str_size string_length; ulong num_key; if (Z_TYPE_P(intern->array) == IS_OBJECT) { @@ -1722,13 +1722,13 @@ SPL_METHOD(Array, unserialize) spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *buf; - int buf_len; + zend_str_size buf_len; const unsigned char *p, *s; php_unserialize_data_t var_hash; zval *pmembers, *pflags = NULL; long flags; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &buf, &buf_len) == FAILURE) { return; } diff --git a/ext/standard/array.c b/ext/standard/array.c index 9bfb0887ac231..35d77a985b998 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -187,7 +187,7 @@ static int php_array_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ } else { Z_TYPE(first) = IS_STRING; Z_STRVAL(first) = (char*)f->arKey; - Z_STRLEN(first) = f->nKeyLength - 1; + Z_STRSIZE(first) = f->nKeyLength - 1; } if (s->nKeyLength == 0) { @@ -196,7 +196,7 @@ static int php_array_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ } else { Z_TYPE(second) = IS_STRING; Z_STRVAL(second) = (char*)s->arKey; - Z_STRLEN(second) = s->nKeyLength - 1; + Z_STRSIZE(second) = s->nKeyLength - 1; } if (ARRAYG(compare_func)(&result, &first, &second TSRMLS_CC) == FAILURE) { @@ -427,7 +427,7 @@ static int php_array_natural_general_compare(const void *a, const void *b, int f convert_to_string(&second); } - result = strnatcmp_ex(Z_STRVAL(first), Z_STRLEN(first), Z_STRVAL(second), Z_STRLEN(second), fold_case); + result = strnatcmp_ex(Z_STRVAL(first), Z_STRSIZE(first), Z_STRVAL(second), Z_STRSIZE(second), fold_case); if (Z_TYPE_P(fval) != IS_STRING) { zval_dtor(&first); @@ -738,7 +738,7 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /* Z_TYPE_P(key1) = IS_LONG; } else { Z_STRVAL_P(key1) = estrndup(f->arKey, f->nKeyLength - 1); - Z_STRLEN_P(key1) = f->nKeyLength - 1; + Z_STRSIZE_P(key1) = f->nKeyLength - 1; Z_TYPE_P(key1) = IS_STRING; } if (s->nKeyLength == 0) { @@ -746,7 +746,7 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /* Z_TYPE_P(key2) = IS_LONG; } else { Z_STRVAL_P(key2) = estrndup(s->arKey, s->nKeyLength - 1); - Z_STRLEN_P(key2) = s->nKeyLength - 1; + Z_STRSIZE_P(key2) = s->nKeyLength - 1; Z_TYPE_P(key2) = IS_STRING; } @@ -1224,9 +1224,10 @@ PHP_FUNCTION(array_search) } /* }}} */ -static int php_valid_var_name(char *var_name, int var_name_len) /* {{{ */ +static int php_valid_var_name(char *var_name, zend_str_size_int var_name_len) /* {{{ */ { - int i, ch; + zend_str_size i; + int ch; if (!var_name || !var_name_len) { return 0; @@ -1260,18 +1261,18 @@ static int php_valid_var_name(char *var_name, int var_name_len) /* {{{ */ } /* }}} */ -PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC) /* {{{ */ +PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, zend_str_size_int var_name_len, zend_bool add_underscore TSRMLS_DC) /* {{{ */ { - Z_STRLEN_P(result) = Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len; + Z_STRSIZE_P(result) = Z_STRSIZE_P(prefix) + (add_underscore ? 1 : 0) + var_name_len; Z_TYPE_P(result) = IS_STRING; - Z_STRVAL_P(result) = emalloc(Z_STRLEN_P(result) + 1); - memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRLEN_P(prefix)); + Z_STRVAL_P(result) = emalloc(Z_STRSIZE_P(result) + 1); + memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRSIZE_P(prefix)); if (add_underscore) { - Z_STRVAL_P(result)[Z_STRLEN_P(prefix)] = '_'; + Z_STRVAL_P(result)[Z_STRSIZE_P(prefix)] = '_'; } - memcpy(Z_STRVAL_P(result) + Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); + memcpy(Z_STRVAL_P(result) + Z_STRSIZE_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); return SUCCESS; } @@ -1286,7 +1287,7 @@ PHP_FUNCTION(extract) zval **entry, *data; char *var_name; ulong num_key; - uint var_name_len; + zend_str_size_uint var_name_len; int var_exists, key_type, count = 0; int extract_refs = 0; HashPosition pos; @@ -1310,7 +1311,7 @@ PHP_FUNCTION(extract) if (prefix) { convert_to_string(prefix); - if (Z_STRLEN_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRLEN_P(prefix))) { + if (Z_STRSIZE_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRSIZE_P(prefix))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "prefix is not a valid identifier"); return; } @@ -1344,7 +1345,7 @@ PHP_FUNCTION(extract) ZVAL_LONG(&num, num_key); convert_to_string(&num); - php_prefix_varname(&final_name, prefix, Z_STRVAL(num), Z_STRLEN(num), 1 TSRMLS_CC); + php_prefix_varname(&final_name, prefix, Z_STRVAL(num), Z_STRSIZE(num), 1 TSRMLS_CC); zval_dtor(&num); } else { zend_hash_move_forward_ex(Z_ARRVAL_P(var_array), &pos); @@ -1402,25 +1403,25 @@ PHP_FUNCTION(extract) break; } - if (Z_TYPE(final_name) != IS_NULL && php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) { + if (Z_TYPE(final_name) != IS_NULL && php_valid_var_name(Z_STRVAL(final_name), Z_STRSIZE(final_name))) { if (extract_refs) { zval **orig_var; SEPARATE_ZVAL_TO_MAKE_IS_REF(entry); zval_add_ref(entry); - if (zend_hash_find(EG(active_symbol_table), Z_STRVAL(final_name), Z_STRLEN(final_name) + 1, (void **) &orig_var) == SUCCESS) { + if (zend_hash_find(EG(active_symbol_table), Z_STRVAL(final_name), Z_STRSIZE(final_name) + 1, (void **) &orig_var) == SUCCESS) { zval_ptr_dtor(orig_var); *orig_var = *entry; } else { - zend_hash_update(EG(active_symbol_table), Z_STRVAL(final_name), Z_STRLEN(final_name) + 1, (void **) entry, sizeof(zval *), NULL); + zend_hash_update(EG(active_symbol_table), Z_STRVAL(final_name), Z_STRSIZE(final_name) + 1, (void **) entry, sizeof(zval *), NULL); } } else { MAKE_STD_ZVAL(data); *data = **entry; zval_copy_ctor(data); - ZEND_SET_SYMBOL_WITH_LENGTH(EG(active_symbol_table), Z_STRVAL(final_name), Z_STRLEN(final_name) + 1, data, 1, 0); + ZEND_SET_SYMBOL_WITH_LENGTH(EG(active_symbol_table), Z_STRVAL(final_name), Z_STRSIZE(final_name) + 1, data, 1, 0); } count++; } @@ -1442,12 +1443,12 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu zval **value_ptr, *value, *data; if (Z_TYPE_P(entry) == IS_STRING) { - if (zend_hash_find(eg_active_symbol_table, Z_STRVAL_P(entry), Z_STRLEN_P(entry) + 1, (void **)&value_ptr) != FAILURE) { + if (zend_hash_find(eg_active_symbol_table, Z_STRVAL_P(entry), Z_STRSIZE_P(entry) + 1, (void **)&value_ptr) != FAILURE) { value = *value_ptr; ALLOC_ZVAL(data); MAKE_COPY_ZVAL(&value, data); - zend_hash_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(entry), Z_STRLEN_P(entry) + 1, &data, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(entry), Z_STRSIZE_P(entry) + 1, &data, sizeof(zval *), NULL); } } else if (Z_TYPE_P(entry) == IS_ARRAY) { @@ -1572,7 +1573,7 @@ PHP_FUNCTION(array_fill_keys) } zval_add_ref(&val); - zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(key_ptr), Z_STRLEN_P(key_ptr) + 1, &val, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(key_ptr), Z_STRSIZE_P(key_ptr) + 1, &val, sizeof(zval *), NULL); if (key_ptr != *entry) { zval_dtor(&key); @@ -1598,7 +1599,7 @@ PHP_FUNCTION(range) if (zstep) { if (Z_TYPE_P(zstep) == IS_DOUBLE || - (Z_TYPE_P(zstep) == IS_STRING && is_numeric_string(Z_STRVAL_P(zstep), Z_STRLEN_P(zstep), NULL, NULL, 0) == IS_DOUBLE) + (Z_TYPE_P(zstep) == IS_STRING && is_numeric_string(Z_STRVAL_P(zstep), Z_STRSIZE_P(zstep), NULL, NULL, 0) == IS_DOUBLE) ) { is_step_double = 1; } @@ -1616,13 +1617,13 @@ PHP_FUNCTION(range) array_init(return_value); /* If the range is given as strings, generate an array of characters. */ - if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING && Z_STRLEN_P(zlow) >= 1 && Z_STRLEN_P(zhigh) >= 1) { + if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING && Z_STRSIZE_P(zlow) >= 1 && Z_STRSIZE_P(zhigh) >= 1) { int type1, type2; unsigned char *low, *high; long lstep = (long) step; - type1 = is_numeric_string(Z_STRVAL_P(zlow), Z_STRLEN_P(zlow), NULL, NULL, 0); - type2 = is_numeric_string(Z_STRVAL_P(zhigh), Z_STRLEN_P(zhigh), NULL, NULL, 0); + type1 = is_numeric_string(Z_STRVAL_P(zlow), Z_STRSIZE_P(zlow), NULL, NULL, 0); + type2 = is_numeric_string(Z_STRVAL_P(zhigh), Z_STRSIZE_P(zhigh), NULL, NULL, 0); if (type1 == IS_DOUBLE || type2 == IS_DOUBLE || is_step_double) { goto double_str; @@ -1937,7 +1938,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end) zval *stack, /* Input stack */ **val; /* Value to be popped */ char *key = NULL; - uint key_len = 0; + zend_str_size key_len = 0; ulong index; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &stack) == FAILURE) { @@ -2135,7 +2136,7 @@ PHP_FUNCTION(array_slice) int num_in, /* Number of elements in the input array */ pos; /* Current position in the array */ char *string_key; - uint string_key_len; + zend_str_size string_key_len; ulong num_key; HashPosition hpos; @@ -2212,7 +2213,7 @@ PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS { zval **src_entry, **dest_entry; char *string_key; - uint string_key_len; + zend_str_size string_key_len; ulong num_key; HashPosition pos; @@ -2275,7 +2276,7 @@ PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src TSRMLS_DC { zval **src_entry, **dest_entry; char *string_key; - uint string_key_len; + zend_str_size string_key_len; ulong num_key; HashPosition pos; @@ -2507,11 +2508,11 @@ PHP_FUNCTION(array_count_values) Z_LVAL_PP(tmp)++; } } else if (Z_TYPE_PP(entry) == IS_STRING) { - if (zend_symtable_find(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, (void**)&tmp) == FAILURE) { + if (zend_symtable_find(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRSIZE_PP(entry) + 1, (void**)&tmp) == FAILURE) { zval *data; MAKE_STD_ZVAL(data); ZVAL_LONG(data, 1); - zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &data, sizeof(data), NULL); + zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRSIZE_PP(entry) + 1, &data, sizeof(data), NULL); } else { Z_LVAL_PP(tmp)++; } @@ -2586,7 +2587,7 @@ PHP_FUNCTION(array_column) /* Otherwise, skip if the value doesn't exist in our subarray */ } else if ((Z_TYPE_PP(zcolumn) == IS_STRING) && - (zend_hash_find(ht, Z_STRVAL_PP(zcolumn), Z_STRLEN_PP(zcolumn) + 1, (void**)&zcolval) == FAILURE)) { + (zend_hash_find(ht, Z_STRVAL_PP(zcolumn), Z_STRSIZE_PP(zcolumn) + 1, (void**)&zcolval) == FAILURE)) { continue; } else if ((Z_TYPE_PP(zcolumn) == IS_LONG) && (zend_hash_index_find(ht, Z_LVAL_PP(zcolumn), (void**)&zcolval) == FAILURE)) { @@ -2597,7 +2598,7 @@ PHP_FUNCTION(array_column) * which is to append the value as next_index */ if (zkey && (Z_TYPE_PP(zkey) == IS_STRING)) { - zend_hash_find(ht, Z_STRVAL_PP(zkey), Z_STRLEN_PP(zkey) + 1, (void**)&zkeyval); + zend_hash_find(ht, Z_STRVAL_PP(zkey), Z_STRSIZE_PP(zkey) + 1, (void**)&zkeyval); } else if (zkey && (Z_TYPE_PP(zkey) == IS_LONG)) { zend_hash_index_find(ht, Z_LVAL_PP(zkey), (void**)&zkeyval); } @@ -2625,7 +2626,7 @@ PHP_FUNCTION(array_reverse) zval *input, /* Input array */ **entry; /* An entry in the input array */ char *string_key; - uint string_key_len; + zend_str_size string_key_len; ulong num_key; zend_bool preserve_keys = 0; /* whether to preserve keys */ HashPosition pos; @@ -2752,7 +2753,7 @@ PHP_FUNCTION(array_flip) if (Z_TYPE_PP(entry) == IS_LONG) { zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_PP(entry), &data, sizeof(data), NULL); } else if (Z_TYPE_PP(entry) == IS_STRING) { - zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &data, sizeof(data), NULL); + zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRSIZE_PP(entry) + 1, &data, sizeof(data), NULL); } else { zval_ptr_dtor(&data); /* will free also zval structure */ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only flip STRING and INTEGER values!"); @@ -2770,7 +2771,7 @@ PHP_FUNCTION(array_change_key_case) zval *array, **entry; char *string_key; char *new_key; - uint str_key_len; + zend_str_size str_key_len; ulong num_key; long change_to_upper=0; HashPosition pos; @@ -3993,7 +3994,7 @@ PHP_FUNCTION(array_rand) long randval, num_req = 1; int num_avail, key_type; char *string_key; - uint string_key_len; + zend_str_size string_key_len; ulong num_key; HashPosition pos; @@ -4210,7 +4211,7 @@ PHP_FUNCTION(array_filter) char *string_key; zend_fcall_info fci = empty_fcall_info; zend_fcall_info_cache fci_cache = empty_fcall_info_cache; - uint string_key_len; + zend_str_size string_key_len; ulong num_key; HashPosition pos; @@ -4328,7 +4329,7 @@ PHP_FUNCTION(array_map) /* We iterate through all the arrays at once. */ for (k = 0; k < maxlen; k++) { - uint str_key_len; + zend_str_size str_key_len; ulong num_key; char *str_key; int key_type = 0; @@ -4412,7 +4413,7 @@ PHP_FUNCTION(array_key_exists) switch (Z_TYPE_P(key)) { case IS_STRING: - if (zend_symtable_exists(array, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1)) { + if (zend_symtable_exists(array, Z_STRVAL_P(key), Z_STRSIZE_P(key) + 1)) { RETURN_TRUE; } RETURN_FALSE; @@ -4441,7 +4442,7 @@ PHP_FUNCTION(array_chunk) int argc = ZEND_NUM_ARGS(), key_type, num_in; long size, current = 0; char *str_key; - uint str_key_len; + zend_str_size str_key_len; ulong num_key; zend_bool preserve_keys = 0; zval *input = NULL; @@ -4554,7 +4555,7 @@ PHP_FUNCTION(array_combine) } zval_add_ref(entry_values); - add_assoc_zval_ex(return_value, Z_STRVAL_P(key_ptr), Z_STRLEN_P(key_ptr) + 1, *entry_values); + add_assoc_zval_ex(return_value, Z_STRVAL_P(key_ptr), Z_STRSIZE_P(key_ptr) + 1, *entry_values); if (key_ptr != *entry_keys) { zval_dtor(&key); diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 13791177457e8..44ee5f26bf75e 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -3851,9 +3851,9 @@ PHP_MINFO_FUNCTION(basic) /* {{{ */ PHP_FUNCTION(constant) { char *const_name; - int const_name_len; + zend_str_size const_name_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &const_name, &const_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &const_name, &const_name_len) == FAILURE) { return; } @@ -3870,10 +3870,11 @@ PHP_FUNCTION(constant) PHP_NAMED_FUNCTION(php_inet_ntop) { char *address; - int address_len, af = AF_INET; + zend_str_size address_len; + int af = AF_INET; char buffer[40]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &address, &address_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &address, &address_len) == FAILURE) { RETURN_FALSE; } @@ -3904,10 +3905,10 @@ PHP_NAMED_FUNCTION(php_inet_pton) { int ret, af = AF_INET; char *address; - int address_len; + zend_str_size address_len; char buffer[17]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &address, &address_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &address, &address_len) == FAILURE) { RETURN_FALSE; } @@ -3940,14 +3941,14 @@ PHP_NAMED_FUNCTION(php_inet_pton) PHP_FUNCTION(ip2long) { char *addr; - int addr_len; + zend_str_size addr_len; #ifdef HAVE_INET_PTON struct in_addr ip; #else unsigned long int ip; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &addr, &addr_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &addr, &addr_len) == FAILURE) { return; } @@ -3979,14 +3980,14 @@ PHP_FUNCTION(long2ip) { /* "It's a long but it's not, PHP ints are signed */ char *ip; - int ip_len; + zend_str_size ip_len; unsigned long n; struct in_addr myaddr; #ifdef HAVE_INET_PTON char str[40]; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &ip, &ip_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &ip, &ip_len) == FAILURE) { return; } @@ -4014,9 +4015,9 @@ PHP_FUNCTION(long2ip) PHP_FUNCTION(getenv) { char *ptr, *str; - int str_len; + zend_str_size str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { RETURN_FALSE; } @@ -4028,7 +4029,7 @@ PHP_FUNCTION(getenv) #ifdef PHP_WIN32 { char dummybuf; - int size; + zend_str_size size; SetLastError(0); /*If the given bugger is not large enough to hold the data, the return value is @@ -4072,9 +4073,9 @@ PHP_FUNCTION(getenv) PHP_FUNCTION(putenv) { char *setting; - int setting_len; + zend_str_size setting_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &setting, &setting_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &setting, &setting_len) == FAILURE) { return; } @@ -4242,14 +4243,15 @@ PHP_FUNCTION(getopt) char *options = NULL, **argv = NULL; char opt[2] = { '\0' }; char *optname; - int argc = 0, options_len = 0, len, o; + int argc = 0, o; + zend_str_size options_len = 0, len; char *php_optarg = NULL; int php_optind = 1; zval *val, **args = NULL, *p_longopts = NULL; - int optname_len = 0; + zend_str_size optname_len = 0; opt_struct *opts, *orig_opts; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|a", &options, &options_len, &p_longopts) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|a", &options, &options_len, &p_longopts) == FAILURE) { RETURN_FALSE; } @@ -4577,9 +4579,9 @@ static int add_config_entry_cb(zval *entry TSRMLS_DC, int num_args, va_list args if (Z_TYPE_P(entry) == IS_STRING) { if (hash_key->nKeyLength > 0) { - add_assoc_stringl_ex(retval, hash_key->arKey, hash_key->nKeyLength, Z_STRVAL_P(entry), Z_STRLEN_P(entry), 1); + add_assoc_stringl_ex(retval, hash_key->arKey, hash_key->nKeyLength, Z_STRVAL_P(entry), Z_STRSIZE_P(entry), 1); } else { - add_index_stringl(retval, hash_key->h, Z_STRVAL_P(entry), Z_STRLEN_P(entry), 1); + add_index_stringl(retval, hash_key->h, Z_STRVAL_P(entry), Z_STRSIZE_P(entry), 1); } } else if (Z_TYPE_P(entry) == IS_ARRAY) { MAKE_STD_ZVAL(tmp); @@ -4596,10 +4598,10 @@ static int add_config_entry_cb(zval *entry TSRMLS_DC, int num_args, va_list args PHP_FUNCTION(get_cfg_var) { char *varname; - int varname_len; + zend_str_size varname_len; zval *retval; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &varname, &varname_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &varname, &varname_len) == FAILURE) { return; } @@ -4677,11 +4679,11 @@ error options: PHP_FUNCTION(error_log) { char *message, *opt = NULL, *headers = NULL; - int message_len, opt_len = 0, headers_len = 0; + zend_str_size message_len, opt_len = 0, headers_len = 0; int opt_err = 0, argc = ZEND_NUM_ARGS(); long erropt = 0; - if (zend_parse_parameters(argc TSRMLS_CC, "s|lps", &message, &message_len, &erropt, &opt, &opt_len, &headers, &headers_len) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "S|lPS", &message, &message_len, &erropt, &opt, &opt_len, &headers, &headers_len) == FAILURE) { return; } @@ -4704,7 +4706,7 @@ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers T } /* }}} */ -PHPAPI int _php_error_log_ex(int opt_err, char *message, int message_len, char *opt, char *headers TSRMLS_DC) /* {{{ */ +PHPAPI int _php_error_log_ex(int opt_err, char *message, zend_str_size_int message_len, char *opt, char *headers TSRMLS_DC) /* {{{ */ { php_stream *stream = NULL; @@ -5198,11 +5200,12 @@ ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highl PHP_FUNCTION(highlight_file) { char *filename; - int filename_len, ret; + zend_str_size filename_len; + int ret; zend_syntax_highlighter_ini syntax_highlighter_ini; zend_bool i = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &filename, &filename_len, &i) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|b", &filename, &filename_len, &i) == FAILURE) { RETURN_FALSE; } @@ -5239,11 +5242,11 @@ PHP_FUNCTION(highlight_file) PHP_FUNCTION(php_strip_whitespace) { char *filename; - int filename_len; + zend_str_size filename_len; zend_lex_state original_lex_state; zend_file_handle file_handle = {0}; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P", &filename, &filename_len) == FAILURE) { RETURN_FALSE; } @@ -5321,9 +5324,9 @@ PHP_FUNCTION(highlight_string) PHP_FUNCTION(ini_get) { char *varname, *str; - int varname_len; + zend_str_size varname_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &varname, &varname_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &varname, &varname_len) == FAILURE) { return; } @@ -5389,11 +5392,12 @@ static int php_ini_get_option(zend_ini_entry *ini_entry TSRMLS_DC, int num_args, PHP_FUNCTION(ini_get_all) { char *extname = NULL; - int extname_len = 0, extnumber = 0; + zend_str_size extname_len = 0; + int extnumber = 0; zend_module_entry *module; zend_bool details = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!b", &extname, &extname_len, &details) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S!b", &extname, &extname_len, &details) == FAILURE) { return; } @@ -5412,7 +5416,7 @@ PHP_FUNCTION(ini_get_all) } /* }}} */ -static int php_ini_check_path(char *option_name, int option_len, char *new_option_name, int new_option_len) /* {{{ */ +static int php_ini_check_path(char *option_name, zend_str_size_int option_len, char *new_option_name, zend_str_size_int new_option_len) /* {{{ */ { if (option_len != (new_option_len - 1)) { return 0; @@ -5427,10 +5431,10 @@ static int php_ini_check_path(char *option_name, int option_len, char *new_optio PHP_FUNCTION(ini_set) { char *varname, *new_value; - int varname_len, new_value_len; + zend_str_size varname_len, new_value_len; char *old_value; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &varname, &varname_len, &new_value, &new_value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &varname, &varname_len, &new_value, &new_value_len) == FAILURE) { return; } @@ -5471,9 +5475,9 @@ PHP_FUNCTION(ini_set) PHP_FUNCTION(ini_restore) { char *varname; - int varname_len; + zend_str_size varname_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &varname, &varname_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &varname, &varname_len) == FAILURE) { return; } @@ -5486,10 +5490,10 @@ PHP_FUNCTION(ini_restore) PHP_FUNCTION(set_include_path) { char *new_value; - int new_value_len; + zend_str_size_int new_value_len; char *old_value; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &new_value, &new_value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &new_value, &new_value_len) == FAILURE) { return; } @@ -5586,10 +5590,10 @@ PHP_FUNCTION(connection_status) PHP_FUNCTION(ignore_user_abort) { char *arg = NULL; - int arg_len = 0; + zend_str_size arg_len = 0; int old_setting; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &arg, &arg_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &arg, &arg_len) == FAILURE) { return; } @@ -5609,10 +5613,10 @@ PHP_FUNCTION(ignore_user_abort) PHP_FUNCTION(getservbyname) { char *name, *proto; - int name_len, proto_len; + zend_str_size name_len, proto_len; struct servent *serv; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &proto, &proto_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &name, &name_len, &proto, &proto_len) == FAILURE) { return; } @@ -5642,11 +5646,11 @@ PHP_FUNCTION(getservbyname) PHP_FUNCTION(getservbyport) { char *proto; - int proto_len; + zend_str_size proto_len; long port; struct servent *serv; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &port, &proto, &proto_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lS", &port, &proto, &proto_len) == FAILURE) { return; } @@ -5667,10 +5671,10 @@ PHP_FUNCTION(getservbyport) PHP_FUNCTION(getprotobyname) { char *name; - int name_len; + zend_str_size name_len; struct protoent *ent; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { return; } @@ -5793,13 +5797,13 @@ PHP_FUNCTION(unregister_tick_function) PHP_FUNCTION(is_uploaded_file) { char *path; - int path_len; + zend_str_size path_len; if (!SG(rfc1867_uploaded_files)) { RETURN_FALSE; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &path_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &path, &path_len) == FAILURE) { return; } @@ -5816,7 +5820,7 @@ PHP_FUNCTION(is_uploaded_file) PHP_FUNCTION(move_uploaded_file) { char *path, *new_path; - int path_len, new_path_len; + zend_str_size path_len, new_path_len; zend_bool successful = 0; #ifndef PHP_WIN32 @@ -5827,7 +5831,7 @@ PHP_FUNCTION(move_uploaded_file) RETURN_FALSE; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &path, &path_len, &new_path, &new_path_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &path, &path_len, &new_path, &new_path_len) == FAILURE) { return; } @@ -5881,7 +5885,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal } ALLOC_ZVAL(element); MAKE_COPY_ZVAL(&arg2, element); - zend_symtable_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, &element, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, &element, sizeof(zval *), NULL); break; case ZEND_INI_PARSER_POP_ENTRY: @@ -5893,8 +5897,8 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal break; } - if (!(Z_STRLEN_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) == IS_LONG) { - ulong key = (ulong) zend_atol(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)); + if (!(Z_STRSIZE_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1), NULL, NULL, 0) == IS_LONG) { + ulong key = (ulong) zend_atol(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)); if (zend_hash_index_find(Z_ARRVAL_P(arr), key, (void **) &find_hash) == FAILURE) { ALLOC_ZVAL(hash); INIT_PZVAL(hash); @@ -5905,12 +5909,12 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal hash = *find_hash; } } else { - if (zend_hash_find(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, (void **) &find_hash) == FAILURE) { + if (zend_hash_find(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, (void **) &find_hash) == FAILURE) { ALLOC_ZVAL(hash); INIT_PZVAL(hash); array_init(hash); - zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, &hash, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, &hash, sizeof(zval *), NULL); } else { hash = *find_hash; } @@ -5925,8 +5929,8 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal ALLOC_ZVAL(element); MAKE_COPY_ZVAL(&arg2, element); - if (arg3 && Z_STRLEN_P(arg3) > 0) { - add_assoc_zval_ex(hash, Z_STRVAL_P(arg3), Z_STRLEN_P(arg3) + 1, element); + if (arg3 && Z_STRSIZE_P(arg3) > 0) { + add_assoc_zval_ex(hash, Z_STRVAL_P(arg3), Z_STRSIZE_P(arg3) + 1, element); } else { add_next_index_zval(hash, element); } @@ -5946,7 +5950,7 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, zval *arg3, if (callback_type == ZEND_INI_PARSER_SECTION) { MAKE_STD_ZVAL(BG(active_ini_file_section)); array_init(BG(active_ini_file_section)); - zend_symtable_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, &BG(active_ini_file_section), sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, &BG(active_ini_file_section), sizeof(zval *), NULL); } else if (arg2) { zval *active_arr; @@ -5966,13 +5970,13 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, zval *arg3, PHP_FUNCTION(parse_ini_file) { char *filename = NULL; - int filename_len = 0; + zend_str_size filename_len = 0; zend_bool process_sections = 0; long scanner_mode = ZEND_INI_SCANNER_NORMAL; zend_file_handle fh; zend_ini_parser_cb_t ini_parser_cb; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|bl", &filename, &filename_len, &process_sections, &scanner_mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|bl", &filename, &filename_len, &process_sections, &scanner_mode) == FAILURE) { RETURN_FALSE; } @@ -6008,12 +6012,12 @@ PHP_FUNCTION(parse_ini_file) PHP_FUNCTION(parse_ini_string) { char *string = NULL, *str = NULL; - int str_len = 0; + zend_str_size str_len = 0; zend_bool process_sections = 0; long scanner_mode = ZEND_INI_SCANNER_NORMAL; zend_ini_parser_cb_t ini_parser_cb; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &str, &str_len, &process_sections, &scanner_mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|bl", &str, &str_len, &process_sections, &scanner_mode) == FAILURE) { RETURN_FALSE; } diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h index 7327f7d2d2ecd..29c83808b47d9 100644 --- a/ext/standard/basic_functions.h +++ b/ext/standard/basic_functions.h @@ -144,8 +144,8 @@ PHP_RSHUTDOWN_FUNCTION(browscap); /* Left for BC (not binary safe!) */ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers TSRMLS_DC); -PHPAPI int _php_error_log_ex(int opt_err, char *message, int message_len, char *opt, char *headers TSRMLS_DC); -PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC); +PHPAPI int _php_error_log_ex(int opt_err, char *message, zend_str_size_int message_len, char *opt, char *headers TSRMLS_DC); +PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, zend_str_size_int var_name_len, zend_bool add_underscore TSRMLS_DC); #if SIZEOF_INT == 4 /* Most 32-bit and 64-bit systems have 32-bit ints */ diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index ed773b851c33e..c5d5bc4f53a6e 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -87,14 +87,14 @@ static void convert_browscap_pattern(zval *pattern, int persistent) /* {{{ */ int i, j=0; char *t; - php_strtolower(Z_STRVAL_P(pattern), Z_STRLEN_P(pattern)); + php_strtolower(Z_STRVAL_P(pattern), Z_STRSIZE_P(pattern)); - t = (char *) safe_pemalloc(Z_STRLEN_P(pattern), 2, 5, persistent); + t = (char *) safe_pemalloc(Z_STRSIZE_P(pattern), 2, 5, persistent); t[j++] = '\xA7'; /* section sign */ t[j++] = '^'; - for (i=0; icurrent_section), new_key, Z_STRLEN_P(arg1) + 1, &new_property, sizeof(zval *), NULL); + new_key = pestrndup(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1), persistent); + zend_str_tolower(new_key, Z_STRSIZE_P(arg1)); + zend_hash_update(Z_ARRVAL_P(bdata->current_section), new_key, Z_STRSIZE_P(arg1) + 1, &new_property, sizeof(zval *), NULL); pefree(new_key, persistent); } break; @@ -218,17 +218,17 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb pefree(bdata->current_section_name, persistent); } bdata->current_section_name = pestrndup(Z_STRVAL_P(arg1), - Z_STRLEN_P(arg1), persistent); + Z_STRSIZE_P(arg1), persistent); - zend_hash_update(bdata->htab, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, (void *) &bdata->current_section, sizeof(zval *), NULL); + zend_hash_update(bdata->htab, Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, (void *) &bdata->current_section, sizeof(zval *), NULL); Z_STRVAL_P(processed) = Z_STRVAL_P(arg1); - Z_STRLEN_P(processed) = Z_STRLEN_P(arg1); + Z_STRSIZE_P(processed) = Z_STRSIZE_P(arg1); Z_TYPE_P(processed) = IS_STRING; Z_STRVAL_P(unprocessed) = Z_STRVAL_P(arg1); - Z_STRLEN_P(unprocessed) = Z_STRLEN_P(arg1); + Z_STRSIZE_P(unprocessed) = Z_STRSIZE_P(arg1); Z_TYPE_P(unprocessed) = IS_STRING; - Z_STRVAL_P(unprocessed) = pestrndup(Z_STRVAL_P(unprocessed), Z_STRLEN_P(unprocessed), persistent); + Z_STRVAL_P(unprocessed) = pestrndup(Z_STRVAL_P(unprocessed), Z_STRSIZE_P(unprocessed), persistent); convert_browscap_pattern(processed, persistent); zend_hash_update(section_properties, "browser_name_regex", sizeof("browser_name_regex"), (void *) &processed, sizeof(zval *), NULL); @@ -412,7 +412,7 @@ static int browser_reg_compare(zval **browser TSRMLS_DC, int num_args, va_list a ua_len = lookup_browser_length; - for (i = 0; i < Z_STRLEN_PP(previous_match); i++) { + for (i = 0; i < Z_STRSIZE_PP(previous_match); i++) { switch (Z_STRVAL_PP(previous_match)[i]) { case '?': case '*': @@ -424,7 +424,7 @@ static int browser_reg_compare(zval **browser TSRMLS_DC, int num_args, va_list a } } - for (i = 0; i < Z_STRLEN_PP(current_match); i++) { + for (i = 0; i < Z_STRSIZE_PP(current_match); i++) { switch (Z_STRVAL_PP(current_match)[i]) { case '?': case '*': @@ -469,7 +469,7 @@ static void browscap_zval_copy_ctor(zval **p) /* {{{ */ PHP_FUNCTION(get_browser) { char *agent_name = NULL; - int agent_name_len = 0; + zend_str_size agent_name_len = 0; zend_bool return_array = 0; zval **agent, **z_agent_name, **http_user_agent; zval *found_browser_entry, *tmp_copy; @@ -504,7 +504,7 @@ PHP_FUNCTION(get_browser) RETURN_FALSE; } agent_name = Z_STRVAL_PP(http_user_agent); - agent_name_len = Z_STRLEN_PP(http_user_agent); + agent_name_len = Z_STRSIZE_PP(http_user_agent); } lookup_browser_name = estrndup(agent_name, agent_name_len); @@ -532,7 +532,7 @@ PHP_FUNCTION(get_browser) } while (zend_hash_find(Z_ARRVAL_PP(agent), "parent", sizeof("parent"), (void **) &z_agent_name) == SUCCESS) { - if (zend_hash_find(bdata->htab, Z_STRVAL_PP(z_agent_name), Z_STRLEN_PP(z_agent_name) + 1, (void **)&agent) == FAILURE) { + if (zend_hash_find(bdata->htab, Z_STRVAL_PP(z_agent_name), Z_STRSIZE_PP(z_agent_name) + 1, (void **)&agent) == FAILURE) { break; } From 89aea2f103b835d0582028bf29552e5b144d6c5f Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Mon, 1 Jul 2013 17:15:25 -0400 Subject: [PATCH 02/31] Refactor file.c to use new string types --- ext/standard/file.c | 164 ++++++++++++++++++++++---------------------- 1 file changed, 83 insertions(+), 81 deletions(-) diff --git a/ext/standard/file.c b/ext/standard/file.c index 106f5c1004ec9..cbf7dfcf950d5 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -372,7 +372,7 @@ PHP_FUNCTION(flock) PHP_FUNCTION(get_meta_tags) { char *filename; - int filename_len; + zend_str_size filename_len; zend_bool use_include_path = 0; int in_tag = 0, done = 0; int looking_for_val = 0, have_name = 0, have_content = 0; @@ -385,7 +385,7 @@ PHP_FUNCTION(get_meta_tags) memset(&md, 0, sizeof(md)); /* Parse arguments */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &filename, &filename_len, &use_include_path) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|b", &filename, &filename_len, &use_include_path) == FAILURE) { return; } @@ -515,18 +515,18 @@ PHP_FUNCTION(get_meta_tags) PHP_FUNCTION(file_get_contents) { char *filename; - int filename_len; + zend_str_size filename_len; char *contents; zend_bool use_include_path = 0; php_stream *stream; - int len; + zend_str_size len; long offset = -1; long maxlen = PHP_STREAM_COPY_ALL; zval *zcontext = NULL; php_stream_context *context = NULL; /* Parse arguments */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) { return; } @@ -568,16 +568,16 @@ PHP_FUNCTION(file_put_contents) { php_stream *stream; char *filename; - int filename_len; + zend_str_size filename_len; zval *data; - int numbytes = 0; + zend_str_size numbytes = 0; long flags = 0; zval *zcontext = NULL; php_stream_context *context = NULL; php_stream *srcstream = NULL; char mode[3] = "wb"; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pz/|lr!", &filename, &filename_len, &data, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Pz/|lr!", &filename, &filename_len, &data, &flags, &zcontext) == FAILURE) { return; } @@ -634,10 +634,10 @@ PHP_FUNCTION(file_put_contents) convert_to_string_ex(&data); case IS_STRING: - if (Z_STRLEN_P(data)) { - numbytes = php_stream_write(stream, Z_STRVAL_P(data), Z_STRLEN_P(data)); - if (numbytes != Z_STRLEN_P(data)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", numbytes, Z_STRLEN_P(data)); + if (Z_STRSIZE_P(data)) { + numbytes = php_stream_write(stream, Z_STRVAL_P(data), Z_STRSIZE_P(data)); + if (numbytes != Z_STRSIZE_P(data)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", numbytes, Z_STRSIZE_P(data)); numbytes = -1; } } @@ -645,7 +645,7 @@ PHP_FUNCTION(file_put_contents) case IS_ARRAY: if (zend_hash_num_elements(Z_ARRVAL_P(data))) { - int bytes_written; + zend_str_size bytes_written; zval **tmp; HashPosition pos; @@ -655,14 +655,14 @@ PHP_FUNCTION(file_put_contents) SEPARATE_ZVAL(tmp); convert_to_string(*tmp); } - if (Z_STRLEN_PP(tmp)) { - numbytes += Z_STRLEN_PP(tmp); - bytes_written = php_stream_write(stream, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); - if (bytes_written < 0 || bytes_written != Z_STRLEN_PP(tmp)) { + if (Z_STRSIZE_PP(tmp)) { + numbytes += Z_STRSIZE_PP(tmp); + bytes_written = php_stream_write(stream, Z_STRVAL_PP(tmp), Z_STRSIZE_PP(tmp)); + if (bytes_written < 0 || bytes_written != Z_STRSIZE_PP(tmp)) { if (bytes_written < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write %d bytes to %s", Z_STRLEN_PP(tmp), filename); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write %d bytes to %s", Z_STRSIZE_PP(tmp), filename); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", bytes_written, Z_STRLEN_PP(tmp)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", bytes_written, Z_STRSIZE_PP(tmp)); } numbytes = -1; break; @@ -678,9 +678,9 @@ PHP_FUNCTION(file_put_contents) zval out; if (zend_std_cast_object_tostring(data, &out, IS_STRING TSRMLS_CC) == SUCCESS) { - numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRLEN(out)); - if (numbytes != Z_STRLEN(out)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", numbytes, Z_STRLEN(out)); + numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRSIZE(out)); + if (numbytes != Z_STRSIZE(out)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", numbytes, Z_STRSIZE(out)); numbytes = -1; } zval_dtor(&out); @@ -697,7 +697,7 @@ PHP_FUNCTION(file_put_contents) RETURN_FALSE; } - RETURN_LONG(numbytes); + RETURN_LONG((long) numbytes); } /* }}} */ @@ -708,10 +708,10 @@ PHP_FUNCTION(file_put_contents) PHP_FUNCTION(file) { char *filename; - int filename_len; + zend_str_size filename_len; char *target_buf=NULL, *p, *s, *e; register int i = 0; - int target_len; + zend_str_size target_len; char eol_marker = '\n'; long flags = 0; zend_bool use_include_path; @@ -722,7 +722,7 @@ PHP_FUNCTION(file) php_stream_context *context = NULL; /* Parse arguments */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lr!", &filename, &filename_len, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|lr!", &filename, &filename_len, &flags, &zcontext) == FAILURE) { return; } if (flags < 0 || flags > (PHP_FILE_USE_INCLUDE_PATH | PHP_FILE_IGNORE_NEW_LINES | PHP_FILE_SKIP_EMPTY_LINES | PHP_FILE_NO_DEFAULT_CONTEXT)) { @@ -800,13 +800,13 @@ PHP_FUNCTION(file) PHP_FUNCTION(tempnam) { char *dir, *prefix; - int dir_len, prefix_len; + zend_str_size dir_len, prefix_len; size_t p_len; char *opened_path; char *p; int fd; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps", &dir, &dir_len, &prefix, &prefix_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "PS", &dir, &dir_len, &prefix, &prefix_len) == FAILURE) { return; } @@ -854,13 +854,13 @@ PHP_NAMED_FUNCTION(php_if_tmpfile) PHP_NAMED_FUNCTION(php_if_fopen) { char *filename, *mode; - int filename_len, mode_len; + zend_str_size filename_len, mode_len; zend_bool use_include_path = 0; zval *zcontext = NULL; php_stream *stream; php_stream_context *context = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps|br", &filename, &filename_len, &mode, &mode_len, &use_include_path, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "PS|br", &filename, &filename_len, &mode, &mode_len, &use_include_path, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -909,12 +909,12 @@ PHPAPI PHP_FUNCTION(fclose) PHP_FUNCTION(popen) { char *command, *mode; - int command_len, mode_len; + zend_str_size command_len, mode_len; FILE *fp; php_stream *stream; char *posix_mode; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps", &command, &command_len, &mode, &mode_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "PS", &command, &command_len, &mode, &mode_len) == FAILURE) { return; } @@ -1027,7 +1027,7 @@ PHPAPI PHP_FUNCTION(fgets) ZVAL_STRINGL(return_value, buf, line_len, 0); /* resize buffer if it's much larger than the result. * Only needed if the user requested a buffer size. */ - if (argc > 1 && Z_STRLEN_P(return_value) < len / 2) { + if (argc > 1 && Z_STRSIZE_P(return_value) < len / 2) { Z_STRVAL_P(return_value) = erealloc(buf, line_len + 1); } return; @@ -1074,14 +1074,14 @@ PHPAPI PHP_FUNCTION(fgetss) { zval *fd; long bytes = 0; - size_t len = 0; - size_t actual_len, retval_len; + zend_str_size len = 0; + zend_str_size actual_len, retval_len; char *buf = NULL, *retval; php_stream *stream; char *allowed_tags=NULL; - int allowed_tags_len=0; + zend_str_size allowed_tags_len=0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ls", &fd, &bytes, &allowed_tags, &allowed_tags_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|lS", &fd, &bytes, &allowed_tags, &allowed_tags_len) == FAILURE) { RETURN_FALSE; } @@ -1093,7 +1093,7 @@ PHPAPI PHP_FUNCTION(fgetss) RETURN_FALSE; } - len = (size_t) bytes; + len = (zend_str_size) bytes; buf = safe_emalloc(sizeof(char), (len + 1), 0); /*needed because recv doesnt set null char at end*/ memset(buf, 0, len + 1); @@ -1116,14 +1116,16 @@ PHPAPI PHP_FUNCTION(fgetss) Implements a mostly ANSI compatible fscanf() */ PHP_FUNCTION(fscanf) { - int result, format_len, type, argc = 0; + int result; + zend_str_size format_len; + int type, argc = 0; zval ***args = NULL; zval *file_handle; char *buf, *format; - size_t len; + zend_str_size len; void *what; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs*", &file_handle, &format, &format_len, &args, &argc) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS*", &file_handle, &format, &format_len, &args, &argc) == FAILURE) { return; } @@ -1166,21 +1168,21 @@ PHPAPI PHP_FUNCTION(fwrite) { zval *arg1; char *arg2; - int arg2len; + zend_str_size arg2len; int ret; - int num_bytes; + zend_str_size num_bytes; long arg3 = 0; char *buffer = NULL; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &arg2, &arg2len, &arg3) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS|l", &arg1, &arg2, &arg2len, &arg3) == FAILURE) { RETURN_FALSE; } if (ZEND_NUM_ARGS() == 2) { num_bytes = arg2len; } else { - num_bytes = MAX(0, MIN((int)arg3, arg2len)); + num_bytes = MAX(0, MIN((zend_str_size)arg3, arg2len)); } if (!num_bytes) { @@ -1310,13 +1312,13 @@ PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC) PHP_FUNCTION(mkdir) { char *dir; - int dir_len; + zend_str_size dir_len; zval *zcontext = NULL; long mode = 0777; zend_bool recursive = 0; php_stream_context *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lbr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|lbr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -1331,11 +1333,11 @@ PHP_FUNCTION(mkdir) PHP_FUNCTION(rmdir) { char *dir; - int dir_len; + zend_str_size dir_len; zval *zcontext = NULL; php_stream_context *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|r", &dir, &dir_len, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|r", &dir, &dir_len, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -1350,14 +1352,14 @@ PHP_FUNCTION(rmdir) PHP_FUNCTION(readfile) { char *filename; - int filename_len; - int size = 0; + zend_str_size filename_len; + zend_str_size size = 0; zend_bool use_include_path = 0; zval *zcontext = NULL; php_stream *stream; php_stream_context *context = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|br!", &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|br!", &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -1367,7 +1369,7 @@ PHP_FUNCTION(readfile) if (stream) { size = php_stream_passthru(stream); php_stream_close(stream); - RETURN_LONG(size); + RETURN_LONG((long) size); } RETURN_FALSE; @@ -1406,7 +1408,7 @@ PHP_FUNCTION(umask) PHPAPI PHP_FUNCTION(fpassthru) { zval *arg1; - int size; + zend_str_size size; php_stream *stream; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) { @@ -1416,7 +1418,7 @@ PHPAPI PHP_FUNCTION(fpassthru) PHP_STREAM_TO_ZVAL(stream, &arg1); size = php_stream_passthru(stream); - RETURN_LONG(size); + RETURN_LONG((long) size); } /* }}} */ @@ -1425,12 +1427,12 @@ PHPAPI PHP_FUNCTION(fpassthru) PHP_FUNCTION(rename) { char *old_name, *new_name; - int old_name_len, new_name_len; + zend_str_size old_name_len, new_name_len; zval *zcontext = NULL; php_stream_wrapper *wrapper; php_stream_context *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|r", &old_name, &old_name_len, &new_name, &new_name_len, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "PP|r", &old_name, &old_name_len, &new_name, &new_name_len, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -1462,12 +1464,12 @@ PHP_FUNCTION(rename) PHP_FUNCTION(unlink) { char *filename; - int filename_len; + zend_str_size filename_len; php_stream_wrapper *wrapper; zval *zcontext = NULL; php_stream_context *context = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|r", &filename, &filename_len, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|r", &filename, &filename_len, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -1599,11 +1601,11 @@ PHP_NAMED_FUNCTION(php_if_fstat) PHP_FUNCTION(copy) { char *source, *target; - int source_len, target_len; + zend_str_size source_len, target_len; zval *zcontext = NULL; php_stream_context *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|r", &source, &source_len, &target, &target_len, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "PP|r", &source, &source_len, &target, &target_len, &zcontext) == FAILURE) { return; } @@ -1751,17 +1753,17 @@ PHPAPI PHP_FUNCTION(fread) } Z_STRVAL_P(return_value) = emalloc(len + 1); - Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len); + Z_STRSIZE_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len); /* needed because recv/read/gzread doesnt put a null at the end*/ - Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0; + Z_STRVAL_P(return_value)[Z_STRSIZE_P(return_value)] = 0; Z_TYPE_P(return_value) = IS_STRING; } /* }}} */ -static const char *php_fgetcsv_lookup_trailing_spaces(const char *ptr, size_t len, const char delimiter TSRMLS_DC) /* {{{ */ +static const char *php_fgetcsv_lookup_trailing_spaces(const char *ptr, zend_str_size_size_t len, const char delimiter TSRMLS_DC) /* {{{ */ { - int inc_len; + zend_str_size inc_len; unsigned char last_chars[2] = { 0, 0 }; while (len > 0) { @@ -1797,7 +1799,7 @@ static const char *php_fgetcsv_lookup_trailing_spaces(const char *ptr, size_t le } /* }}} */ -#define FPUTCSV_FLD_CHK(c) memchr(Z_STRVAL(field), c, Z_STRLEN(field)) +#define FPUTCSV_FLD_CHK(c) memchr(Z_STRVAL(field), c, Z_STRSIZE(field)) /* {{{ proto int fputcsv(resource fp, array fields [, string delimiter [, string enclosure]]) Format line as CSV and write to file pointer */ @@ -1810,9 +1812,9 @@ PHP_FUNCTION(fputcsv) zval *fp = NULL, *fields = NULL; int ret; char *delimiter_str = NULL, *enclosure_str = NULL; - int delimiter_str_len = 0, enclosure_str_len = 0; + zend_str_size delimiter_str_len = 0, enclosure_str_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra|ss", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra|SS", &fp, &fields, &delimiter_str, &delimiter_str_len, &enclosure_str, &enclosure_str_len) == FAILURE) { return; @@ -1877,7 +1879,7 @@ PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char en FPUTCSV_FLD_CHK(' ') ) { char *ch = Z_STRVAL(field); - char *end = ch + Z_STRLEN(field); + char *end = ch + Z_STRSIZE(field); int escaped = 0; smart_str_appendc(&csvline, enclosure); @@ -1894,7 +1896,7 @@ PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char en } smart_str_appendc(&csvline, enclosure); } else { - smart_str_appendl(&csvline, Z_STRVAL(field), Z_STRLEN(field)); + smart_str_appendl(&csvline, Z_STRVAL(field), Z_STRSIZE(field)); } if (++i != count) { @@ -1936,13 +1938,13 @@ PHP_FUNCTION(fgetcsv) { zval *fd, **len_zv = NULL; char *delimiter_str = NULL; - int delimiter_str_len = 0; + zend_str_size delimiter_str_len = 0; char *enclosure_str = NULL; - int enclosure_str_len = 0; + zend_str_size enclosure_str_len = 0; char *escape_str = NULL; - int escape_str_len = 0; + zend_str_size escape_str_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|Zsss", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ZSSS", &fd, &len_zv, &delimiter_str, &delimiter_str_len, &enclosure_str, &enclosure_str_len, &escape_str, &escape_str_len) == FAILURE @@ -2018,11 +2020,11 @@ PHP_FUNCTION(fgetcsv) } /* }}} */ -PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, size_t buf_len, char *buf, zval *return_value TSRMLS_DC) /* {{{ */ +PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, zend_str_size_size_t buf_len, char *buf, zval *return_value TSRMLS_DC) /* {{{ */ { char *temp, *tptr, *bptr, *line_end, *limit; - size_t temp_len, line_end_len; - int inc_len; + zend_str_size temp_len, line_end_len; + zend_str_size inc_len; zend_bool first_field = 1; /* initialize internal state */ @@ -2282,10 +2284,10 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char PHP_FUNCTION(realpath) { char *filename; - int filename_len; + zend_str_size filename_len; char resolved_path_buff[MAXPATHLEN]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P", &filename, &filename_len) == FAILURE) { return; } @@ -2420,10 +2422,10 @@ php_meta_tags_token php_next_meta_token(php_meta_tags_data *md TSRMLS_DC) PHP_FUNCTION(fnmatch) { char *pattern, *filename; - int pattern_len, filename_len; + zend_str_size pattern_len, filename_len; long flags = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|l", &pattern, &pattern_len, &filename, &filename_len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "PP|l", &pattern, &pattern_len, &filename, &filename_len, &flags) == FAILURE) { return; } From 66845fb6a56cf2ffc92cc1a39bdcbab198ebe4f6 Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Mon, 1 Jul 2013 17:59:11 -0400 Subject: [PATCH 03/31] More work, get strings working, sort-of... --- ext/standard/math.c | 14 +- ext/standard/php_string.h | 44 +-- ext/standard/string.c | 623 +++++++++++++++++++------------------- 3 files changed, 340 insertions(+), 341 deletions(-) diff --git a/ext/standard/math.c b/ext/standard/math.c index be2d655263f13..346c67669b731 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -803,7 +803,7 @@ PHPAPI long _php_math_basetolong(zval *arg, int base) s = Z_STRVAL_P(arg); - for (i = Z_STRLEN_P(arg); i > 0; i--) { + for (i = Z_STRSIZE_P(arg); i > 0; i--) { c = *s++; digit = (c >= '0' && c <= '9') ? c - '0' @@ -855,7 +855,7 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) cutoff = LONG_MAX / base; cutlim = LONG_MAX % base; - for (i = Z_STRLEN_P(arg); i > 0; i--) { + for (i = Z_STRSIZE_P(arg); i > 0; i--) { c = *s++; /* might not work for EBCDIC */ @@ -1098,7 +1098,7 @@ PHPAPI char *_php_math_number_format(double d, int dec, char dec_point, char tho } static char *_php_math_number_format_ex_len(double d, int dec, char *dec_point, - size_t dec_point_len, char *thousand_sep, size_t thousand_sep_len, + zend_str_size_size_t dec_point_len, char *thousand_sep, zend_str_size_size_t thousand_sep_len, int *result_len) { char *tmpbuf = NULL, *resbuf; @@ -1219,7 +1219,7 @@ static char *_php_math_number_format_ex_len(double d, int dec, char *dec_point, } PHPAPI char *_php_math_number_format_ex(double d, int dec, char *dec_point, - size_t dec_point_len, char *thousand_sep, size_t thousand_sep_len) + zend_str_size_size_t dec_point_len, char *thousand_sep, zend_str_size_size_t thousand_sep_len) { return _php_math_number_format_ex_len(d, dec, dec_point, dec_point_len, thousand_sep, thousand_sep_len, NULL); @@ -1234,9 +1234,9 @@ PHP_FUNCTION(number_format) long dec = 0; char *thousand_sep = NULL, *dec_point = NULL; char thousand_sep_chr = ',', dec_point_chr = '.'; - int thousand_sep_len = 0, dec_point_len = 0; + zend_str_size thousand_sep_len = 0, dec_point_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|ls!s!", &num, &dec, &dec_point, &dec_point_len, &thousand_sep, &thousand_sep_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|lS!S!", &num, &dec, &dec_point, &dec_point_len, &thousand_sep, &thousand_sep_len) == FAILURE) { return; } @@ -1261,7 +1261,7 @@ PHP_FUNCTION(number_format) Z_TYPE_P(return_value) = IS_STRING; Z_STRVAL_P(return_value) = _php_math_number_format_ex_len(num, dec, dec_point, dec_point_len, thousand_sep, thousand_sep_len, - &Z_STRLEN_P(return_value)); + &Z_STRSIZE_P(return_value)); break; default: WRONG_PARAM_COUNT; diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h index 65219f257adee..3708661dc339c 100644 --- a/ext/standard/php_string.h +++ b/ext/standard/php_string.h @@ -112,36 +112,36 @@ PHP_MINIT_FUNCTION(nl_langinfo); strnatcmp_ex(a, strlen(a), b, strlen(b), 0) #define strnatcasecmp(a, b) \ strnatcmp_ex(a, strlen(a), b, strlen(b), 1) -PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len, int fold_case); +PHPAPI int strnatcmp_ex(char const *a, zend_str_size_size_t a_len, char const *b, zend_str_size_size_t b_len, int fold_case); #ifdef HAVE_LOCALECONV PHPAPI struct lconv *localeconv_r(struct lconv *out); #endif -PHPAPI char *php_strtoupper(char *s, size_t len); -PHPAPI char *php_strtolower(char *s, size_t len); -PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen); -PHPAPI char *php_addslashes(char *str, int length, int *new_length, int freeit TSRMLS_DC); -PHPAPI char *php_addcslashes(const char *str, int length, int *new_length, int freeit, char *what, int wlength TSRMLS_DC); -PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC); -PHPAPI void php_stripcslashes(char *str, int *len); -PHPAPI void php_basename(const char *s, size_t len, char *suffix, size_t sufflen, char **p_ret, size_t *p_len TSRMLS_DC); -PHPAPI size_t php_dirname(char *str, size_t len); -PHPAPI char *php_stristr(char *s, char *t, size_t s_len, size_t t_len); -PHPAPI char *php_str_to_str_ex(char *haystack, int length, char *needle, - int needle_len, char *str, int str_len, int *_new_length, int case_sensitivity, int *replace_count); -PHPAPI char *php_str_to_str(char *haystack, int length, char *needle, - int needle_len, char *str, int str_len, int *_new_length); -PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval *return_value, int mode TSRMLS_DC); -PHPAPI size_t php_strip_tags(char *rbuf, int len, int *state, char *allow, int allow_len); -PHPAPI size_t php_strip_tags_ex(char *rbuf, int len, int *stateptr, char *allow, int allow_len, zend_bool allow_tag_spaces); -PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int to_len, zval *result, int case_sensitivity, int *replace_count); -PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len, zval *result); +PHPAPI char *php_strtoupper(char *s, zend_str_size_size_t len); +PHPAPI char *php_strtolower(char *s, zend_str_size_size_t len); +PHPAPI char *php_strtr(char *str, zend_str_size_int len, char *str_from, char *str_to, zend_str_size_int trlen); +PHPAPI char *php_addslashes(char *str, zend_str_size_int length, zend_str_size_int *new_length, int freeit TSRMLS_DC); +PHPAPI char *php_addcslashes(const char *str, zend_str_size_int length, zend_str_size_int *new_length, int freeit, char *what, zend_str_size_int wlength TSRMLS_DC); +PHPAPI void php_stripslashes(char *str, zend_str_size_int *len TSRMLS_DC); +PHPAPI void php_stripcslashes(char *str, zend_str_size_int *len); +PHPAPI void php_basename(const char *s, zend_str_size_size_t len, char *suffix, zend_str_size_size_t sufflen, char **p_ret, zend_str_size_size_t *p_len TSRMLS_DC); +PHPAPI zend_str_size_size_t php_dirname(char *str, zend_str_size_size_t len); +PHPAPI char *php_stristr(char *s, char *t, zend_str_size_size_t s_len, zend_str_size_size_t t_len); +PHPAPI char *php_str_to_str_ex(char *haystack, zend_str_size_int length, char *needle, + zend_str_size_int needle_len, char *str, zend_str_size_int str_len, zend_str_size_int *_new_length, int case_sensitivity, zend_str_size_int *replace_count); +PHPAPI char *php_str_to_str(char *haystack, zend_str_size_int length, char *needle, + zend_str_size_int needle_len, char *str, zend_str_size_int str_len, zend_str_size_int *_new_length); +PHPAPI char *php_trim(char *c, zend_str_size_int len, char *what, zend_str_size_int what_len, zval *return_value, int mode TSRMLS_DC); +PHPAPI zend_str_size_size_t php_strip_tags(char *rbuf, zend_str_size_int len, int *state, char *allow, zend_str_size_int allow_len); +PHPAPI zend_str_size_size_t php_strip_tags_ex(char *rbuf, zend_str_size_int len, int *stateptr, char *allow, zend_str_size_int allow_len, zend_bool allow_tag_spaces); +PHPAPI zend_str_size_int php_char_to_str_ex(char *str, zend_str_size_uint len, char from, char *to, zend_str_size_int to_len, zval *result, int case_sensitivity, zend_str_size_int *replace_count); +PHPAPI zend_str_size_int php_char_to_str(char *str, zend_str_size_uint len, char from, char *to, zend_str_size_int to_len, zval *result); PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC); PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, long limit); -PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end); -PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end); +PHPAPI zend_str_size_size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end); +PHPAPI zend_str_size_size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end); PHPAPI int string_natural_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensitive TSRMLS_DC); PHPAPI int string_natural_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); diff --git a/ext/standard/string.c b/ext/standard/string.c index f3f78100b4c6f..a8c65fb01bac0 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -120,7 +120,7 @@ void register_string_constants(INIT_FUNC_ARGS) } /* }}} */ -int php_tag_find(char *tag, int len, char *set); +int php_tag_find(char *tag, zend_str_size_int len, char *set); /* this is read-only, so it's ok */ static char hexconvtab[] = "0123456789abcdef"; @@ -132,10 +132,10 @@ static MUTEX_T locale_mutex = NULL; /* {{{ php_bin2hex */ -static char *php_bin2hex(const unsigned char *old, const size_t oldlen, size_t *newlen) +static char *php_bin2hex(const unsigned char *old, const zend_str_size_size_t oldlen, zend_str_size_size_t *newlen) { register unsigned char *result = NULL; - size_t i, j; + zend_str_size i, j; result = (unsigned char *) safe_emalloc(oldlen, 2 * sizeof(char), 1); @@ -154,11 +154,11 @@ static char *php_bin2hex(const unsigned char *old, const size_t oldlen, size_t * /* {{{ php_hex2bin */ -static char *php_hex2bin(const unsigned char *old, const size_t oldlen, size_t *newlen) +static char *php_hex2bin(const unsigned char *old, const zend_str_size_size_t oldlen, zend_str_size_size_t *newlen) { - size_t target_length = oldlen >> 1; + zend_str_size_size_t target_length = oldlen >> 1; register unsigned char *str = (unsigned char *)safe_emalloc(target_length, sizeof(char), 1); - size_t i, j; + zend_str_size_size_t i, j; for (i = j = 0; i < target_length; i++) { char c = old[j++]; if (c >= '0' && c <= '9') { @@ -243,10 +243,10 @@ PHP_MSHUTDOWN_FUNCTION(localeconv) PHP_FUNCTION(bin2hex) { char *result, *data; - size_t newlen; - int datalen; + zend_str_size newlen; + zend_str_size datalen; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &datalen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &data, &datalen) == FAILURE) { return; } @@ -265,10 +265,9 @@ PHP_FUNCTION(bin2hex) PHP_FUNCTION(hex2bin) { char *result, *data; - size_t newlen; - int datalen; + zend_str_size newlen, datalen; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &datalen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &data, &datalen) == FAILURE) { return; } @@ -290,10 +289,10 @@ PHP_FUNCTION(hex2bin) static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ */ { char *s11, *s22; - int len1, len2; + zend_str_size len1, len2; long start = 0, len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ll", &s11, &len1, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ll", &s11, &len1, &s22, &len2, &start, &len) == FAILURE) { return; } @@ -722,9 +721,9 @@ PHP_FUNCTION(nl_langinfo) PHP_FUNCTION(strcoll) { char *s1, *s2; - int s1len, s2len; + zend_str_size s1len, s2len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &s1, &s1len, &s2, &s2len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &s1, &s1len, &s2, &s2len) == FAILURE) { return; } @@ -739,7 +738,7 @@ PHP_FUNCTION(strcoll) * it needs to be incrementing. * Returns: FAILURE/SUCCESS whether the input was correct (i.e. no range errors) */ -static inline int php_charmask(unsigned char *input, int len, char *mask TSRMLS_DC) +static inline int php_charmask(unsigned char *input, zend_str_size_int len, char *mask TSRMLS_DC) { unsigned char *end; unsigned char c; @@ -788,7 +787,7 @@ static inline int php_charmask(unsigned char *input, int len, char *mask TSRMLS_ * mode 3 : trim left and right * what indicates which chars are to be trimmed. NULL->default (' \t\n\r\v\0') */ -PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval *return_value, int mode TSRMLS_DC) +PHPAPI char *php_trim(char *c, zend_str_size_int len, char *what, zend_str_size_int what_len, zval *return_value, int mode TSRMLS_DC) { register int i; int trimmed = 0; @@ -837,9 +836,9 @@ static void php_do_trim(INTERNAL_FUNCTION_PARAMETERS, int mode) { char *str; char *what = NULL; - int str_len, what_len = 0; + zend_str_size str_len, what_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &what, &what_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &str, &str_len, &what, &what_len) == FAILURE) { return; } @@ -877,13 +876,13 @@ PHP_FUNCTION(wordwrap) { const char *text, *breakchar = "\n"; char *newtext; - int textlen, breakcharlen = 1, newtextlen, chk; - size_t alloced; + zend_str_size textlen, breakcharlen = 1, newtextlen, chk; + zend_str_size alloced; long current = 0, laststart = 0, lastspace = 0; long linelength = 75; zend_bool docut = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lsb", &text, &textlen, &linelength, &breakchar, &breakcharlen, &docut) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lSb", &text, &textlen, &linelength, &breakchar, &breakcharlen, &docut) == FAILURE) { return; } @@ -926,7 +925,7 @@ PHP_FUNCTION(wordwrap) } else { /* Multiple character line break or forced cut */ if (linelength > 0) { - chk = (int)(textlen/linelength + 1); + chk = (zend_str_size)(textlen/linelength + 1); newtext = safe_emalloc(chk, breakcharlen, textlen + 1); alloced = textlen + chk * breakcharlen + 1; } else { @@ -941,9 +940,9 @@ PHP_FUNCTION(wordwrap) laststart = lastspace = 0; for (current = 0; current < textlen; current++) { if (chk <= 0) { - alloced += (int) (((textlen - current + 1)/linelength + 1) * breakcharlen) + 1; + alloced += (zend_str_size) (((textlen - current + 1)/linelength + 1) * breakcharlen) + 1; newtext = erealloc(newtext, alloced); - chk = (int) ((textlen - current)/linelength) + 1; + chk = (zend_str_size) ((textlen - current)/linelength) + 1; } /* when we hit an existing break, copy to new buffer, and * fix up laststart and lastspace */ @@ -1016,18 +1015,18 @@ PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, long limit) { char *p1, *p2, *endp; - endp = Z_STRVAL_P(str) + Z_STRLEN_P(str); + endp = Z_STRVAL_P(str) + Z_STRSIZE_P(str); p1 = Z_STRVAL_P(str); - p2 = php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp); + p2 = php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp); if (p2 == NULL) { - add_next_index_stringl(return_value, p1, Z_STRLEN_P(str), 1); + add_next_index_stringl(return_value, p1, Z_STRSIZE_P(str), 1); } else { do { add_next_index_stringl(return_value, p1, p2 - p1, 1); - p1 = p2 + Z_STRLEN_P(delim); - } while ((p2 = php_memnstr(p1, Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp)) != NULL && + p1 = p2 + Z_STRSIZE_P(delim); + } while ((p2 = php_memnstr(p1, Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp)) != NULL && --limit > 1); if (p1 <= endp) @@ -1043,10 +1042,10 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu #define EXPLODE_ALLOC_STEP 64 char *p1, *p2, *endp; - endp = Z_STRVAL_P(str) + Z_STRLEN_P(str); + endp = Z_STRVAL_P(str) + Z_STRSIZE_P(str); p1 = Z_STRVAL_P(str); - p2 = php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp); + p2 = php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp); if (p2 == NULL) { /* @@ -1054,7 +1053,7 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu by doing nothing we return empty array */ } else { - int allocated = EXPLODE_ALLOC_STEP, found = 0; + zend_str_size allocated = EXPLODE_ALLOC_STEP, found = 0; long i, to_return; char **positions = emalloc(allocated * sizeof(char *)); @@ -1064,14 +1063,14 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu allocated = found + EXPLODE_ALLOC_STEP;/* make sure we have enough memory */ positions = erealloc(positions, allocated*sizeof(char *)); } - positions[found++] = p1 = p2 + Z_STRLEN_P(delim); - } while ((p2 = php_memnstr(p1, Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp)) != NULL); + positions[found++] = p1 = p2 + Z_STRSIZE_P(delim); + } while ((p2 = php_memnstr(p1, Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp)) != NULL); to_return = limit + found; /* limit is at least -1 therefore no need of bounds checking : i will be always less than found */ for (i = 0;i < to_return;i++) { /* this checks also for to_return > 0 */ add_next_index_stringl(return_value, positions[i], - (positions[i+1] - Z_STRLEN_P(delim)) - positions[i], + (positions[i+1] - Z_STRSIZE_P(delim)) - positions[i], 1 ); } @@ -1086,11 +1085,11 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu PHP_FUNCTION(explode) { char *str, *delim; - int str_len = 0, delim_len = 0; + zend_str_size str_len = 0, delim_len = 0; long limit = LONG_MAX; /* No limit */ zval zdelim, zstr; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &delim, &delim_len, &str, &str_len, &limit) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|l", &delim, &delim_len, &str, &str_len, &limit) == FAILURE) { return; } @@ -1133,7 +1132,7 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC) smart_str implstr = {0}; int numelems, i = 0; zval tmp_val; - int str_len; + zend_str_size str_len; numelems = zend_hash_num_elements(Z_ARRVAL_P(arr)); @@ -1146,7 +1145,7 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC) while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **) &tmp, &pos) == SUCCESS) { switch ((*tmp)->type) { case IS_STRING: - smart_str_appendl(&implstr, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); + smart_str_appendl(&implstr, Z_STRVAL_PP(tmp), Z_STRSIZE_PP(tmp)); break; case IS_LONG: { @@ -1177,7 +1176,7 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC) int copy; zval expr; zend_make_printable_zval(*tmp, &expr, ©); - smart_str_appendl(&implstr, Z_STRVAL(expr), Z_STRLEN(expr)); + smart_str_appendl(&implstr, Z_STRVAL(expr), Z_STRSIZE(expr)); if (copy) { zval_dtor(&expr); } @@ -1188,14 +1187,14 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC) tmp_val = **tmp; zval_copy_ctor(&tmp_val); convert_to_string(&tmp_val); - smart_str_appendl(&implstr, Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); + smart_str_appendl(&implstr, Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val)); zval_dtor(&tmp_val); break; } if (++i != numelems) { - smart_str_appendl(&implstr, Z_STRVAL_P(delim), Z_STRLEN_P(delim)); + smart_str_appendl(&implstr, Z_STRVAL_P(delim), Z_STRSIZE_P(delim)); } zend_hash_move_forward_ex(Z_ARRVAL_P(arr), &pos); } @@ -1262,7 +1261,7 @@ PHP_FUNCTION(implode) PHP_FUNCTION(strtok) { char *str, *tok = NULL; - int str_len, tok_len = 0; + zend_str_size str_len, tok_len = 0; zval *zv; char *token; @@ -1271,7 +1270,7 @@ PHP_FUNCTION(strtok) char *pe; int skipped = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &tok, &tok_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &str, &str_len, &tok, &tok_len) == FAILURE) { return; } @@ -1363,9 +1362,9 @@ PHPAPI char *php_strtoupper(char *s, size_t len) PHP_FUNCTION(strtoupper) { char *arg; - int arglen; + zend_str_size arglen; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arglen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arg, &arglen) == FAILURE) { return; } @@ -1397,9 +1396,9 @@ PHPAPI char *php_strtolower(char *s, size_t len) PHP_FUNCTION(strtolower) { char *str; - int arglen; + zend_str_size arglen; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &arglen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &arglen) == FAILURE) { return; } @@ -1411,10 +1410,10 @@ PHP_FUNCTION(strtolower) /* {{{ php_basename */ -PHPAPI void php_basename(const char *s, size_t len, char *suffix, size_t sufflen, char **p_ret, size_t *p_len TSRMLS_DC) +PHPAPI void php_basename(const char *s, zend_str_size_size_t len, char *suffix, zend_str_size_size_t sufflen, char **p_ret, zend_str_size_size_t *p_len TSRMLS_DC) { char *ret = NULL, *c, *comp, *cend; - size_t inc_len, cnt; + zend_str_size inc_len, cnt; int state; c = comp = cend = (char*)s; @@ -1487,21 +1486,21 @@ PHPAPI void php_basename(const char *s, size_t len, char *suffix, size_t sufflen PHP_FUNCTION(basename) { char *string, *suffix = NULL, *ret; - int string_len, suffix_len = 0; - size_t ret_len; + zend_str_size string_len, suffix_len = 0; + zend_str_size ret_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &string, &string_len, &suffix, &suffix_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &string, &string_len, &suffix, &suffix_len) == FAILURE) { return; } php_basename(string, string_len, suffix, suffix_len, &ret, &ret_len TSRMLS_CC); - RETURN_STRINGL(ret, (int)ret_len, 0); + RETURN_STRINGL(ret, ret_len, 0); } /* }}} */ /* {{{ php_dirname Returns directory name component of path */ -PHPAPI size_t php_dirname(char *path, size_t len) +PHPAPI zend_str_size_size_t php_dirname(char *path, zend_str_size_size_t len) { return zend_dirname(path, len); } @@ -1513,10 +1512,9 @@ PHP_FUNCTION(dirname) { char *str; char *ret; - int str_len; - size_t ret_len; + zend_str_size str_len, ret_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { return; } @@ -1533,11 +1531,11 @@ PHP_FUNCTION(pathinfo) { zval *tmp; char *path, *ret = NULL; - int path_len, have_basename; - size_t ret_len; + zend_str_size path_len, ret_len; + int have_basename; long opt = PHP_PATHINFO_ALL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &path_len, &opt) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &path, &path_len, &opt) == FAILURE) { return; } @@ -1613,7 +1611,7 @@ PHP_FUNCTION(pathinfo) /* {{{ php_stristr case insensitve strstr */ -PHPAPI char *php_stristr(char *s, char *t, size_t s_len, size_t t_len) +PHPAPI char *php_stristr(char *s, char *t, zend_str_size_size_t s_len, zend_str_size_size_t t_len) { php_strtolower(s, s_len); php_strtolower(t, t_len); @@ -1623,7 +1621,7 @@ PHPAPI char *php_stristr(char *s, char *t, size_t s_len, size_t t_len) /* {{{ php_strspn */ -PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end) +PHPAPI zend_str_size_size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end) { register const char *p = s1, *spanp; register char c = *p; @@ -1641,7 +1639,7 @@ PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end) /* {{{ php_strcspn */ -PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end) +PHPAPI zend_str_size_size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end) { register const char *p, *spanp; register char c = *s1; @@ -1699,14 +1697,14 @@ PHP_FUNCTION(stristr) { zval *needle; char *haystack; - int haystack_len; + zend_str_size haystack_len; char *found = NULL; - int found_offset; + zend_str_size found_offset; char *haystack_dup; char needle_char[2]; zend_bool part = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|b", &haystack, &haystack_len, &needle, &part) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|b", &haystack, &haystack_len, &needle, &part) == FAILURE) { return; } @@ -1714,13 +1712,13 @@ PHP_FUNCTION(stristr) if (Z_TYPE_P(needle) == IS_STRING) { char *orig_needle; - if (!Z_STRLEN_P(needle)) { + if (!Z_STRSIZE_P(needle)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle"); efree(haystack_dup); RETURN_FALSE; } - orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle)); - found = php_stristr(haystack_dup, orig_needle, haystack_len, Z_STRLEN_P(needle)); + orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRSIZE_P(needle)); + found = php_stristr(haystack_dup, orig_needle, haystack_len, Z_STRSIZE_P(needle)); efree(orig_needle); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { @@ -1753,23 +1751,23 @@ PHP_FUNCTION(strstr) { zval *needle; char *haystack; - int haystack_len; + zend_str_size haystack_len; char *found = NULL; char needle_char[2]; - long found_offset; + zend_str_size found_offset; zend_bool part = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|b", &haystack, &haystack_len, &needle, &part) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|b", &haystack, &haystack_len, &needle, &part) == FAILURE) { return; } if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRLEN_P(needle)) { + if (!Z_STRSIZE_P(needle)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle"); RETURN_FALSE; } - found = php_memnstr(haystack, Z_STRVAL_P(needle), Z_STRLEN_P(needle), haystack + haystack_len); + found = php_memnstr(haystack, Z_STRVAL_P(needle), Z_STRSIZE_P(needle), haystack + haystack_len); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { RETURN_FALSE; @@ -1804,9 +1802,9 @@ PHP_FUNCTION(strpos) char *found = NULL; char needle_char[2]; long offset = 0; - int haystack_len; + zend_str_size haystack_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &needle, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &haystack, &haystack_len, &needle, &offset) == FAILURE) { return; } @@ -1816,14 +1814,14 @@ PHP_FUNCTION(strpos) } if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRLEN_P(needle)) { + if (!Z_STRSIZE_P(needle)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle"); RETURN_FALSE; } found = php_memnstr(haystack + offset, Z_STRVAL_P(needle), - Z_STRLEN_P(needle), + Z_STRSIZE_P(needle), haystack + haystack_len); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { @@ -1851,13 +1849,13 @@ PHP_FUNCTION(stripos) { char *found = NULL; char *haystack; - int haystack_len; + zend_str_size haystack_len; long offset = 0; char *needle_dup = NULL, *haystack_dup; char needle_char[2]; zval *needle; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &needle, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &haystack, &haystack_len, &needle, &offset) == FAILURE) { return; } @@ -1874,14 +1872,14 @@ PHP_FUNCTION(stripos) php_strtolower(haystack_dup, haystack_len); if (Z_TYPE_P(needle) == IS_STRING) { - if (Z_STRLEN_P(needle) == 0 || Z_STRLEN_P(needle) > haystack_len) { + if (Z_STRSIZE_P(needle) == 0 || Z_STRSIZE_P(needle) > haystack_len) { efree(haystack_dup); RETURN_FALSE; } - needle_dup = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle)); - php_strtolower(needle_dup, Z_STRLEN_P(needle)); - found = php_memnstr(haystack_dup + offset, needle_dup, Z_STRLEN_P(needle), haystack_dup + haystack_len); + needle_dup = estrndup(Z_STRVAL_P(needle), Z_STRSIZE_P(needle)); + php_strtolower(needle_dup, Z_STRSIZE_P(needle)); + found = php_memnstr(haystack_dup + offset, needle_dup, Z_STRSIZE_P(needle), haystack_dup + haystack_len); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { efree(haystack_dup); @@ -1914,17 +1912,17 @@ PHP_FUNCTION(strrpos) { zval *zneedle; char *needle, *haystack; - int needle_len, haystack_len; + zend_str_size needle_len, haystack_len; long offset = 0; char *p, *e, ord_needle[2]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &zneedle, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &haystack, &haystack_len, &zneedle, &offset) == FAILURE) { RETURN_FALSE; } if (Z_TYPE_P(zneedle) == IS_STRING) { needle = Z_STRVAL_P(zneedle); - needle_len = Z_STRLEN_P(zneedle); + needle_len = Z_STRSIZE_P(zneedle); } else { if (php_needle_char(zneedle, ord_needle TSRMLS_CC) != SUCCESS) { RETURN_FALSE; @@ -1987,18 +1985,18 @@ PHP_FUNCTION(strripos) { zval *zneedle; char *needle, *haystack; - int needle_len, haystack_len; + zend_str_size needle_len, haystack_len; long offset = 0; char *p, *e, ord_needle[2]; char *needle_dup, *haystack_dup; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &zneedle, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &haystack, &haystack_len, &zneedle, &offset) == FAILURE) { RETURN_FALSE; } if (Z_TYPE_P(zneedle) == IS_STRING) { needle = Z_STRVAL_P(zneedle); - needle_len = Z_STRLEN_P(zneedle); + needle_len = Z_STRSIZE_P(zneedle); } else { if (php_needle_char(zneedle, ord_needle TSRMLS_CC) != SUCCESS) { RETURN_FALSE; @@ -2093,9 +2091,9 @@ PHP_FUNCTION(strrchr) char *haystack; const char *found = NULL; long found_offset; - int haystack_len; + zend_str_size haystack_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &haystack, &haystack_len, &needle) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &haystack, &haystack_len, &needle) == FAILURE) { return; } @@ -2121,13 +2119,13 @@ PHP_FUNCTION(strrchr) /* {{{ php_chunk_split */ -static char *php_chunk_split(char *src, int srclen, char *end, int endlen, int chunklen, int *destlen) +static char *php_chunk_split(char *src, zend_str_size_int srclen, char *end, zend_str_size_int endlen, zend_str_size_int chunklen, zend_str_size_int *destlen) { char *dest; char *p, *q; - int chunks; /* complete chunks! */ - int restlen; - int out_len; + zend_str_size chunks; /* complete chunks! */ + zend_str_size restlen; + zend_str_size out_len; chunks = srclen / chunklen; restlen = srclen - chunks * chunklen; /* srclen % chunklen */ @@ -2145,7 +2143,7 @@ static char *php_chunk_split(char *src, int srclen, char *end, int endlen, int c } out_len += srclen + 1; - dest = safe_emalloc((int)out_len, sizeof(char), 0); + dest = safe_emalloc(out_len, sizeof(char), 0); for (p = src, q = dest; p < (src + srclen - chunklen + 1); ) { memcpy(q, p, chunklen); @@ -2178,12 +2176,12 @@ PHP_FUNCTION(chunk_split) char *str; char *result; char *end = "\r\n"; - int endlen = 2; + zend_str_size endlen = 2; long chunklen = 76; - int result_len; - int str_len; + zend_str_size result_len; + zend_str_size str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len, &chunklen, &end, &endlen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lS", &str, &str_len, &chunklen, &end, &endlen) == FAILURE) { return; } @@ -2222,10 +2220,10 @@ PHP_FUNCTION(substr) { char *str; long l = 0, f; - int str_len; + zend_str_size str_len; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", &str, &str_len, &f, &l) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sl|l", &str, &str_len, &f, &l) == FAILURE) { return; } @@ -2290,7 +2288,7 @@ PHP_FUNCTION(substr_replace) zval **len = NULL; zval **repl; char *result; - int result_len; + zend_str_size result_len; int l = 0; int f; int argc = ZEND_NUM_ARGS(); @@ -2329,7 +2327,7 @@ PHP_FUNCTION(substr_replace) } } else { if (Z_TYPE_PP(str) != IS_ARRAY) { - l = Z_STRLEN_PP(str); + l = Z_STRSIZE_PP(str); } } @@ -2339,19 +2337,19 @@ PHP_FUNCTION(substr_replace) (argc == 4 && Z_TYPE_PP(from) != Z_TYPE_PP(len)) ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "'from' and 'len' should be of same type - numerical or array "); - RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1); + RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRSIZE_PP(str), 1); } if (argc == 4 && Z_TYPE_PP(from) == IS_ARRAY) { if (zend_hash_num_elements(Z_ARRVAL_PP(from)) != zend_hash_num_elements(Z_ARRVAL_PP(len))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "'from' and 'len' should have the same number of elements"); - RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1); + RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRSIZE_PP(str), 1); } } } if (Z_TYPE_PP(str) != IS_ARRAY) { if (Z_TYPE_PP(from) != IS_ARRAY) { - int repl_len = 0; + zend_str_size repl_len = 0; f = Z_LVAL_PP(from); @@ -2359,58 +2357,58 @@ PHP_FUNCTION(substr_replace) * of the string */ if (f < 0) { - f = Z_STRLEN_PP(str) + f; + f = Z_STRSIZE_PP(str) + f; if (f < 0) { f = 0; } - } else if (f > Z_STRLEN_PP(str)) { - f = Z_STRLEN_PP(str); + } else if (f > Z_STRSIZE_PP(str)) { + f = Z_STRSIZE_PP(str); } /* if "length" position is negative, set it to the length * needed to stop that many chars from the end of the string */ if (l < 0) { - l = (Z_STRLEN_PP(str) - f) + l; + l = (Z_STRSIZE_PP(str) - f) + l; if (l < 0) { l = 0; } } - if (f > Z_STRLEN_PP(str) || (f < 0 && -f > Z_STRLEN_PP(str))) { + if (f > Z_STRSIZE_PP(str) || (f < 0 && -f > Z_STRSIZE_PP(str))) { RETURN_FALSE; - } else if (l > Z_STRLEN_PP(str) || (l < 0 && -l > Z_STRLEN_PP(str))) { - l = Z_STRLEN_PP(str); + } else if (l > Z_STRSIZE_PP(str) || (l < 0 && -l > Z_STRSIZE_PP(str))) { + l = Z_STRSIZE_PP(str); } - if ((f + l) > Z_STRLEN_PP(str)) { - l = Z_STRLEN_PP(str) - f; + if ((f + l) > Z_STRSIZE_PP(str)) { + l = Z_STRSIZE_PP(str) - f; } if (Z_TYPE_PP(repl) == IS_ARRAY) { zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(repl), &pos_repl); if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(repl), (void **) &tmp_repl, &pos_repl)) { convert_to_string_ex(tmp_repl); - repl_len = Z_STRLEN_PP(tmp_repl); + repl_len = Z_STRSIZE_PP(tmp_repl); } } else { - repl_len = Z_STRLEN_PP(repl); + repl_len = Z_STRSIZE_PP(repl); } - result_len = Z_STRLEN_PP(str) - l + repl_len; + result_len = Z_STRSIZE_PP(str) - l + repl_len; result = emalloc(result_len + 1); memcpy(result, Z_STRVAL_PP(str), f); if (repl_len) { memcpy((result + f), (Z_TYPE_PP(repl) == IS_ARRAY ? Z_STRVAL_PP(tmp_repl) : Z_STRVAL_PP(repl)), repl_len); } - memcpy((result + f + repl_len), Z_STRVAL_PP(str) + f + l, Z_STRLEN_PP(str) - f - l); + memcpy((result + f + repl_len), Z_STRVAL_PP(str) + f + l, Z_STRSIZE_PP(str) - f - l); result[result_len] = '\0'; RETURN_STRINGL(result, result_len, 0); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Functionality of 'from' and 'len' as arrays is not implemented"); - RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1); + RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRSIZE_PP(str), 1); } } else { /* str is array of strings */ char *str_index = NULL; - uint str_index_len; + zend_str_size str_index_len; ulong num_index; array_init(return_value); @@ -2458,12 +2456,12 @@ PHP_FUNCTION(substr_replace) } if (f < 0) { - f = Z_STRLEN_P(orig_str) + f; + f = Z_STRSIZE_P(orig_str) + f; if (f < 0) { f = 0; } - } else if (f > Z_STRLEN_P(orig_str)) { - f = Z_STRLEN_P(orig_str); + } else if (f > Z_STRSIZE_P(orig_str)) { + f = Z_STRSIZE_P(orig_str); } zend_hash_move_forward_ex(Z_ARRVAL_PP(from), &pos_from); } else { @@ -2472,12 +2470,12 @@ PHP_FUNCTION(substr_replace) } else { f = Z_LVAL_PP(from); if (f < 0) { - f = Z_STRLEN_P(orig_str) + f; + f = Z_STRSIZE_P(orig_str) + f; if (f < 0) { f = 0; } - } else if (f > Z_STRLEN_P(orig_str)) { - f = Z_STRLEN_P(orig_str); + } else if (f > Z_STRSIZE_P(orig_str)) { + f = Z_STRSIZE_P(orig_str); } } @@ -2493,26 +2491,26 @@ PHP_FUNCTION(substr_replace) } zend_hash_move_forward_ex(Z_ARRVAL_PP(len), &pos_len); } else { - l = Z_STRLEN_P(orig_str); + l = Z_STRSIZE_P(orig_str); } } else if (argc > 3) { l = Z_LVAL_PP(len); } else { - l = Z_STRLEN_P(orig_str); + l = Z_STRSIZE_P(orig_str); } if (l < 0) { - l = (Z_STRLEN_P(orig_str) - f) + l; + l = (Z_STRSIZE_P(orig_str) - f) + l; if (l < 0) { l = 0; } } - if ((f + l) > Z_STRLEN_P(orig_str)) { - l = Z_STRLEN_P(orig_str) - f; + if ((f + l) > Z_STRSIZE_P(orig_str)) { + l = Z_STRSIZE_P(orig_str) - f; } - result_len = Z_STRLEN_P(orig_str) - l; + result_len = Z_STRSIZE_P(orig_str) - l; if (Z_TYPE_PP(repl) == IS_ARRAY) { if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(repl), (void **) &tmp_repl, &pos_repl)) { @@ -2535,13 +2533,13 @@ PHP_FUNCTION(substr_replace) break; } - result_len += Z_STRLEN_P(repl_str); + result_len += Z_STRSIZE_P(repl_str); zend_hash_move_forward_ex(Z_ARRVAL_PP(repl), &pos_repl); result = emalloc(result_len + 1); memcpy(result, Z_STRVAL_P(orig_str), f); - memcpy((result + f), Z_STRVAL_P(repl_str), Z_STRLEN_P(repl_str)); - memcpy((result + f + Z_STRLEN_P(repl_str)), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); + memcpy((result + f), Z_STRVAL_P(repl_str), Z_STRSIZE_P(repl_str)); + memcpy((result + f + Z_STRSIZE_P(repl_str)), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l); if(Z_TYPE_PP(tmp_repl) != IS_STRING) { zval_dtor(repl_str); } @@ -2549,16 +2547,16 @@ PHP_FUNCTION(substr_replace) result = emalloc(result_len + 1); memcpy(result, Z_STRVAL_P(orig_str), f); - memcpy((result + f), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); + memcpy((result + f), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l); } } else { - result_len += Z_STRLEN_PP(repl); + result_len += Z_STRSIZE_PP(repl); result = emalloc(result_len + 1); memcpy(result, Z_STRVAL_P(orig_str), f); - memcpy((result + f), Z_STRVAL_PP(repl), Z_STRLEN_PP(repl)); - memcpy((result + f + Z_STRLEN_PP(repl)), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); + memcpy((result + f), Z_STRVAL_PP(repl), Z_STRSIZE_PP(repl)); + memcpy((result + f + Z_STRSIZE_PP(repl)), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l); } result[result_len] = '\0'; @@ -2588,9 +2586,9 @@ PHP_FUNCTION(quotemeta) char *old_end; char *p, *q; char c; - int old_len; + zend_str_size old_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &old, &old_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &old, &old_len) == FAILURE) { return; } @@ -2633,9 +2631,9 @@ PHP_FUNCTION(quotemeta) PHP_FUNCTION(ord) { char *str; - int str_len; + zend_str_size str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { return; } @@ -2680,9 +2678,9 @@ static void php_ucfirst(char *str) PHP_FUNCTION(ucfirst) { char *str; - int str_len; + zend_str_size str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { return; } @@ -2710,9 +2708,9 @@ static void php_lcfirst(char *str) PHP_FUNCTION(lcfirst) { char *str; - int str_len; + zend_str_size str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { return; } @@ -2731,9 +2729,9 @@ PHP_FUNCTION(ucwords) { char *str; register char *r, *r_end; - int str_len; + zend_str_size str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { return; } @@ -2745,7 +2743,7 @@ PHP_FUNCTION(ucwords) r = Z_STRVAL_P(return_value); *r = toupper((unsigned char) *r); - for (r_end = r + Z_STRLEN_P(return_value) - 1; r < r_end; ) { + for (r_end = r + Z_STRSIZE_P(return_value) - 1; r < r_end; ) { if (isspace((int) *(unsigned char *)r++)) { *r = toupper((unsigned char) *r); } @@ -2755,9 +2753,9 @@ PHP_FUNCTION(ucwords) /* {{{ php_strtr */ -PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen) +PHPAPI char *php_strtr(char *str, zend_str_size_int len, char *str_from, char *str_to, zend_str_size_int trlen) { - int i; + zend_str_size i; unsigned char xlat[256]; if ((trlen < 1) || (len < 1)) { @@ -2779,19 +2777,18 @@ PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trl /* }}} */ /* {{{ Definitions for php_strtr_array */ -typedef size_t STRLEN; /* STRLEN should be unsigned */ typedef uint16_t HASH; typedef struct { HASH table_mask; - STRLEN entries[1]; + zend_str_size entries[1]; } SHIFT_TAB; typedef struct { HASH table_mask; - int entries[1]; + int entries[1]; } HASH_TAB; typedef struct { const char *s; - STRLEN l; + zend_str_size l; } STR; typedef struct _pat_and_repl { STR pat; @@ -2807,9 +2804,9 @@ typedef struct _pat_and_repl { #define HASH_TAB_SIZE (1U << HASH_TAB_BITS) typedef struct { - int B; /* size of suffixes */ - int Bp; /* size of prefixes */ - STRLEN m; /* minimum pattern length */ + zend_str_size B; /* size of suffixes */ + zend_str_size Bp; /* size of prefixes */ + zend_str_size m; /* minimum pattern length */ int patnum; /* number of patterns */ SHIFT_TAB *shift; /* table mapping hash to allowed shift */ HASH_TAB *hash; /* table mapping hash to int (pair of pointers) */ @@ -2819,10 +2816,10 @@ typedef struct { /* }}} */ /* {{{ php_strtr_hash */ -static inline HASH php_strtr_hash(const char *str, int len) +static inline HASH php_strtr_hash(const char *str, zend_str_size_int len) { HASH res = 0; - int i; + zend_str_size i; for (i = 0; i < len; i++) { res = res * 33 + (unsigned char)str[i]; } @@ -2831,10 +2828,10 @@ static inline HASH php_strtr_hash(const char *str, int len) } /* }}} */ /* {{{ php_strtr_populate_shift */ -static inline void php_strtr_populate_shift(PATNREPL *patterns, int patnum, int B, STRLEN m, SHIFT_TAB *shift) +static inline void php_strtr_populate_shift(PATNREPL *patterns, int patnum, zend_str_size_int B, zend_str_size m, SHIFT_TAB *shift) { - int i; - STRLEN j, + zend_str_size i; + zend_str_size j, max_shift; max_shift = m - B + 1; @@ -2884,7 +2881,7 @@ static void php_strtr_free_strp(void *strp) } /* }}} */ /* {{{ php_strtr_array_prepare_repls */ -static PATNREPL *php_strtr_array_prepare_repls(int slen, HashTable *pats, zend_llist **allocs, int *outsize) +static PATNREPL *php_strtr_array_prepare_repls(zend_str_size_int slen, HashTable *pats, zend_llist **allocs, zend_str_size_int *outsize) { PATNREPL *patterns; HashPosition hpos; @@ -2900,7 +2897,7 @@ static PATNREPL *php_strtr_array_prepare_repls(int slen, HashTable *pats, zend_l zend_hash_get_current_data_ex(pats, (void **)&entry, &hpos) == SUCCESS; zend_hash_move_forward_ex(pats, &hpos)) { char *string_key; - uint string_key_len; + zend_str_size string_key_len; ulong num_key; zval *tzv = NULL; @@ -2935,7 +2932,7 @@ static PATNREPL *php_strtr_array_prepare_repls(int slen, HashTable *pats, zend_l S(&patterns[i].pat) = string_key; L(&patterns[i].pat) = string_key_len; S(&patterns[i].repl) = Z_STRVAL_PP(entry); - L(&patterns[i].repl) = Z_STRLEN_PP(entry); + L(&patterns[i].repl) = Z_STRSIZE_PP(entry); i++; if (tzv) { @@ -2950,12 +2947,12 @@ static PATNREPL *php_strtr_array_prepare_repls(int slen, HashTable *pats, zend_l /* }}} */ /* {{{ PPRES *php_strtr_array_prepare(STR *text, PATNREPL *patterns, int patnum, int B, int Bp) */ -static PPRES *php_strtr_array_prepare(STR *text, PATNREPL *patterns, int patnum, int B, int Bp) +static PPRES *php_strtr_array_prepare(STR *text, PATNREPL *patterns, int patnum, zend_str_size_int B, zend_str_size_int Bp) { - int i; + zend_str_size i; PPRES *res = emalloc(sizeof *res); - res->m = (STRLEN)-1; + res->m = (zend_str_size)-1; for (i = 0; i < patnum; i++) { if (L(&patterns[i].pat) < res->m) { res->m = L(&patterns[i].pat); @@ -3031,14 +3028,14 @@ static void php_strtr_array_destroy_ppres(PPRES *d) /* {{{ php_strtr_array_do_repl(STR *text, PPRES *d, zval *return_value) */ static void php_strtr_array_do_repl(STR *text, PPRES *d, zval *return_value) { - STRLEN pos = 0, + zend_str_size pos = 0, nextwpos = 0, lastpos = L(text) - d->m; smart_str result = {0}; while (pos <= lastpos) { HASH h = php_strtr_hash(&S(text)[pos + d->m - d->B], d->B) & d->shift->table_mask; - STRLEN shift = d->shift->entries[h]; + zend_str_size shift = d->shift->entries[h]; if (shift > 0) { pos += shift; @@ -3046,7 +3043,7 @@ static void php_strtr_array_do_repl(STR *text, PPRES *d, zval *return_value) HASH h2 = h & d->hash->table_mask, prefix_h = php_strtr_hash(&S(text)[pos], d->Bp); - int offset_start = d->hash->entries[h2], + zend_str_size offset_start = d->hash->entries[h2], offset_end = d->hash->entries[h2 + 1], /* exclusive */ i = 0; @@ -3084,12 +3081,12 @@ end_outer_loop: ; /* }}} */ /* {{{ php_strtr_array */ -static void php_strtr_array(zval *return_value, char *str, int slen, HashTable *pats) +static void php_strtr_array(zval *return_value, char *str, zend_str_size_int slen, HashTable *pats) { PPRES *data; STR text; PATNREPL *patterns; - int patterns_len; + zend_str_size_int patterns_len; zend_llist *allocs; S(&text) = str; @@ -3114,10 +3111,10 @@ PHP_FUNCTION(strtr) { zval **from; char *str, *to = NULL; - int str_len, to_len = 0; + zend_str_size str_len, to_len = 0; int ac = ZEND_NUM_ARGS(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sZ|s", &str, &str_len, &from, &to, &to_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SZ|S", &str, &str_len, &from, &to, &to_len) == FAILURE) { return; } @@ -3139,10 +3136,10 @@ PHP_FUNCTION(strtr) ZVAL_STRINGL(return_value, str, str_len, 1); php_strtr(Z_STRVAL_P(return_value), - Z_STRLEN_P(return_value), + Z_STRSIZE_P(return_value), Z_STRVAL_PP(from), to, - MIN(Z_STRLEN_PP(from), + MIN(Z_STRSIZE_PP(from), to_len)); } } @@ -3154,9 +3151,9 @@ PHP_FUNCTION(strrev) { char *str; char *e, *n, *p; - int str_len; + zend_str_size str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { return; } @@ -3177,12 +3174,12 @@ PHP_FUNCTION(strrev) /* {{{ php_similar_str */ -static void php_similar_str(const char *txt1, int len1, const char *txt2, int len2, int *pos1, int *pos2, int *max) +static void php_similar_str(const char *txt1, zend_str_size_int len1, const char *txt2, zend_str_size_int len2, zend_str_size_int *pos1, zend_str_size_int *pos2, zend_str_size_int *max) { char *p, *q; char *end1 = (char *) txt1 + len1; char *end2 = (char *) txt2 + len2; - int l; + zend_str_size l; *max = 0; for (p = (char *) txt1; p < end1; p++) { @@ -3200,10 +3197,10 @@ static void php_similar_str(const char *txt1, int len1, const char *txt2, int le /* {{{ php_similar_char */ -static int php_similar_char(const char *txt1, int len1, const char *txt2, int len2) +static zend_str_size_int php_similar_char(const char *txt1, zend_str_size_int len1, const char *txt2, zend_str_size_int len2) { - int sum; - int pos1, pos2, max; + zend_str_size sum; + zend_str_size pos1, pos2, max; php_similar_str(txt1, len1, txt2, len2, &pos1, &pos2, &max); if ((sum = max)) { @@ -3229,9 +3226,9 @@ PHP_FUNCTION(similar_text) zval **percent = NULL; int ac = ZEND_NUM_ARGS(); int sim; - int t1_len, t2_len; + zend_str_size t1_len, t2_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|Z", &t1, &t1_len, &t2, &t2_len, &percent) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|Z", &t1, &t1_len, &t2, &t2_len, &percent) == FAILURE) { return; } @@ -3260,10 +3257,10 @@ PHP_FUNCTION(similar_text) /* {{{ php_stripslashes * * be careful, this edits the string in-place */ -PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC) +PHPAPI void php_stripslashes(char *str, zend_str_size_int *len TSRMLS_DC) { char *s, *t; - int l; + zend_str_size l; if (len != NULL) { l = *len; @@ -3305,9 +3302,9 @@ PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC) PHP_FUNCTION(addcslashes) { char *str, *what; - int str_len, what_len; + zend_str_size str_len, what_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &str, &str_len, &what, &what_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &str, &str_len, &what, &what_len) == FAILURE) { return; } @@ -3319,8 +3316,8 @@ PHP_FUNCTION(addcslashes) RETURN_STRINGL(str, str_len, 1); } - Z_STRVAL_P(return_value) = php_addcslashes(str, str_len, &Z_STRLEN_P(return_value), 0, what, what_len TSRMLS_CC); - RETURN_STRINGL(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), 0); + Z_STRVAL_P(return_value) = php_addcslashes(str, str_len, &Z_STRSIZE_P(return_value), 0, what, what_len TSRMLS_CC); + RETURN_STRINGL(Z_STRVAL_P(return_value), Z_STRSIZE_P(return_value), 0); } /* }}} */ @@ -3329,9 +3326,9 @@ PHP_FUNCTION(addcslashes) PHP_FUNCTION(addslashes) { char *str; - int str_len; + zend_str_size str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { return; } @@ -3341,7 +3338,7 @@ PHP_FUNCTION(addslashes) RETURN_STRING(php_addslashes(str, str_len, - &Z_STRLEN_P(return_value), 0 + &Z_STRSIZE_P(return_value), 0 TSRMLS_CC), 0); } /* }}} */ @@ -3351,14 +3348,14 @@ PHP_FUNCTION(addslashes) PHP_FUNCTION(stripcslashes) { char *str; - int str_len; + zend_str_size str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { return; } ZVAL_STRINGL(return_value, str, str_len, 1); - php_stripcslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value)); + php_stripcslashes(Z_STRVAL_P(return_value), &Z_STRSIZE_P(return_value)); } /* }}} */ @@ -3367,14 +3364,14 @@ PHP_FUNCTION(stripcslashes) PHP_FUNCTION(stripslashes) { char *str; - int str_len; + zend_str_size str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { return; } ZVAL_STRINGL(return_value, str, str_len, 1); - php_stripslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value) TSRMLS_CC); + php_stripslashes(Z_STRVAL_P(return_value), &Z_STRSIZE_P(return_value) TSRMLS_CC); } /* }}} */ @@ -3399,10 +3396,10 @@ char *php_strerror(int errnum) /* {{{ php_stripcslashes */ -PHPAPI void php_stripcslashes(char *str, int *len) +PHPAPI void php_stripcslashes(char *str, zend_str_size_int *len) { char *source, *target, *end; - int nlen = *len, i; + zend_str_size nlen = *len, i; char numtmp[4]; for (source=str, end=str+nlen, target=str; source < end; source++) { @@ -3462,14 +3459,14 @@ PHPAPI void php_stripcslashes(char *str, int *len) /* {{{ php_addcslashes */ -PHPAPI char *php_addcslashes(const char *str, int length, int *new_length, int should_free, char *what, int wlength TSRMLS_DC) +PHPAPI char *php_addcslashes(const char *str, zend_str_size_int length, zend_str_size_int *new_length, int should_free, char *what, zend_str_size_int wlength TSRMLS_DC) { char flags[256]; char *new_str = safe_emalloc(4, (length?length:(length=strlen(str))), 1); char *source, *target; char *end; char c; - int newlen; + zend_str_size_int newlen; if (!wlength) { wlength = strlen(what); @@ -3515,13 +3512,13 @@ PHPAPI char *php_addcslashes(const char *str, int length, int *new_length, int s /* {{{ php_addslashes */ -PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_free TSRMLS_DC) +PHPAPI char *php_addslashes(char *str, zend_str_size_int length, zend_str_size_int *new_length, int should_free TSRMLS_DC) { /* maximum string length, worst case situation */ char *new_str; char *source, *target; char *end; - int local_new_length; + zend_str_size_int local_new_length; if (!new_length) { new_length = &local_new_length; @@ -3572,10 +3569,10 @@ PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_f /* {{{ php_char_to_str_ex */ -PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int to_len, zval *result, int case_sensitivity, int *replace_count) +PHPAPI zend_str_size_int php_char_to_str_ex(char *str, zend_str_size_uint len, char from, char *to, zend_str_size_int to_len, zval *result, int case_sensitivity, zend_str_size_int *replace_count) { - int char_count = 0; - int replaced = 0; + zend_str_size char_count = 0; + zend_str_size replaced = 0; char *source, *target, *tmp, *source_end=str+len, *tmp_end = NULL; if (case_sensitivity) { @@ -3597,7 +3594,7 @@ PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int to_l return 0; } - Z_STRLEN_P(result) = len + (char_count * (to_len - 1)); + Z_STRSIZE_P(result) = len + (char_count * (to_len - 1)); Z_STRVAL_P(result) = target = safe_emalloc(char_count, to_len, len + 1); Z_TYPE_P(result) = IS_STRING; @@ -3642,7 +3639,7 @@ PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int to_l /* {{{ php_char_to_str */ -PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len, zval *result) +PHPAPI zend_str_size_int php_char_to_str(char *str, zend_str_size_uint len, char from, char *to, zend_str_size_int to_len, zval *result) { return php_char_to_str_ex(str, len, from, to, to_len, result, 1, NULL); } @@ -3650,8 +3647,8 @@ PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len, /* {{{ php_str_to_str_ex */ -PHPAPI char *php_str_to_str_ex(char *haystack, int length, - char *needle, int needle_len, char *str, int str_len, int *_new_length, int case_sensitivity, int *replace_count) +PHPAPI char *php_str_to_str_ex(char *haystack, zend_str_size_int length, + char *needle, zend_str_size_int needle_len, char *str, zend_str_size_int str_len, zend_str_size_int *_new_length, int case_sensitivity, zend_str_size_int *replace_count) { char *new_str; @@ -3698,7 +3695,7 @@ PHPAPI char *php_str_to_str_ex(char *haystack, int length, if (str_len < needle_len) { new_str = emalloc(length + 1); } else { - int count = 0; + zend_str_size count = 0; char *o, *n, *endp; if (case_sensitivity) { @@ -3822,8 +3819,8 @@ PHPAPI char *php_str_to_str_ex(char *haystack, int length, /* {{{ php_str_to_str */ -PHPAPI char *php_str_to_str(char *haystack, int length, - char *needle, int needle_len, char *str, int str_len, int *_new_length) +PHPAPI char *php_str_to_str(char *haystack, zend_str_size_int length, + char *needle, zend_str_size_int needle_len, char *str, zend_str_size_int str_len, zend_str_size_int *_new_length) { return php_str_to_str_ex(haystack, length, needle, needle_len, str, str_len, _new_length, 1, NULL); } @@ -3831,18 +3828,18 @@ PHPAPI char *php_str_to_str(char *haystack, int length, /* {{{ php_str_replace_in_subject */ -static void php_str_replace_in_subject(zval *search, zval *replace, zval **subject, zval *result, int case_sensitivity, int *replace_count) +static void php_str_replace_in_subject(zval *search, zval *replace, zval **subject, zval *result, int case_sensitivity, zend_str_size_int *replace_count) { zval **search_entry, **replace_entry = NULL, temp_result; char *replace_value = NULL; - int replace_len = 0; + zend_str_size replace_len = 0; /* Make sure we're dealing with strings. */ convert_to_string_ex(subject); Z_TYPE_P(result) = IS_STRING; - if (Z_STRLEN_PP(subject) == 0) { + if (Z_STRSIZE_PP(subject) == 0) { ZVAL_STRINGL(result, "", 0, 1); return; } @@ -3859,7 +3856,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje } else { /* Set replacement value to the passed one */ replace_value = Z_STRVAL_P(replace); - replace_len = Z_STRLEN_P(replace); + replace_len = Z_STRSIZE_P(replace); } /* For each entry in the search array, get the entry */ @@ -3867,7 +3864,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje /* Make sure we're dealing with strings. */ SEPARATE_ZVAL(search_entry); convert_to_string(*search_entry); - if (Z_STRLEN_PP(search_entry) == 0) { + if (Z_STRSIZE_PP(search_entry) == 0) { zend_hash_move_forward(Z_ARRVAL_P(search)); if (Z_TYPE_P(replace) == IS_ARRAY) { zend_hash_move_forward(Z_ARRVAL_P(replace)); @@ -3884,7 +3881,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje /* Set replacement value to the one we got from array */ replace_value = Z_STRVAL_PP(replace_entry); - replace_len = Z_STRLEN_PP(replace_entry); + replace_len = Z_STRSIZE_PP(replace_entry); zend_hash_move_forward(Z_ARRVAL_P(replace)); } else { @@ -3894,45 +3891,45 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje } } - if (Z_STRLEN_PP(search_entry) == 1) { + if (Z_STRSIZE_PP(search_entry) == 1) { php_char_to_str_ex(Z_STRVAL_P(result), - Z_STRLEN_P(result), + Z_STRSIZE_P(result), Z_STRVAL_PP(search_entry)[0], replace_value, replace_len, &temp_result, case_sensitivity, replace_count); - } else if (Z_STRLEN_PP(search_entry) > 1) { - Z_STRVAL(temp_result) = php_str_to_str_ex(Z_STRVAL_P(result), Z_STRLEN_P(result), - Z_STRVAL_PP(search_entry), Z_STRLEN_PP(search_entry), - replace_value, replace_len, &Z_STRLEN(temp_result), case_sensitivity, replace_count); + } else if (Z_STRSIZE_PP(search_entry) > 1) { + Z_STRVAL(temp_result) = php_str_to_str_ex(Z_STRVAL_P(result), Z_STRSIZE_P(result), + Z_STRVAL_PP(search_entry), Z_STRSIZE_PP(search_entry), + replace_value, replace_len, &Z_STRSIZE(temp_result), case_sensitivity, replace_count); } str_efree(Z_STRVAL_P(result)); Z_STRVAL_P(result) = Z_STRVAL(temp_result); - Z_STRLEN_P(result) = Z_STRLEN(temp_result); + Z_STRSIZE_P(result) = Z_STRSIZE(temp_result); - if (Z_STRLEN_P(result) == 0) { + if (Z_STRSIZE_P(result) == 0) { return; } zend_hash_move_forward(Z_ARRVAL_P(search)); } } else { - if (Z_STRLEN_P(search) == 1) { + if (Z_STRSIZE_P(search) == 1) { php_char_to_str_ex(Z_STRVAL_PP(subject), - Z_STRLEN_PP(subject), + Z_STRSIZE_PP(subject), Z_STRVAL_P(search)[0], Z_STRVAL_P(replace), - Z_STRLEN_P(replace), + Z_STRSIZE_P(replace), result, case_sensitivity, replace_count); - } else if (Z_STRLEN_P(search) > 1) { - Z_STRVAL_P(result) = php_str_to_str_ex(Z_STRVAL_PP(subject), Z_STRLEN_PP(subject), - Z_STRVAL_P(search), Z_STRLEN_P(search), - Z_STRVAL_P(replace), Z_STRLEN_P(replace), &Z_STRLEN_P(result), case_sensitivity, replace_count); + } else if (Z_STRSIZE_P(search) > 1) { + Z_STRVAL_P(result) = php_str_to_str_ex(Z_STRVAL_PP(subject), Z_STRSIZE_PP(subject), + Z_STRVAL_P(search), Z_STRSIZE_P(search), + Z_STRVAL_P(replace), Z_STRSIZE_P(replace), &Z_STRSIZE_P(result), case_sensitivity, replace_count); } else { MAKE_COPY_ZVAL(subject, result); } @@ -3947,9 +3944,9 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit zval **subject, **search, **replace, **subject_entry, **zcount = NULL; zval *result; char *string_key; - uint string_key_len; + zend_str_size string_key_len; ulong num_key; - int count = 0; + zend_str_size count = 0; int argc = ZEND_NUM_ARGS(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ|Z", &search, &replace, &subject, &zcount) == FAILURE) { @@ -4004,7 +4001,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit } if (argc > 3) { zval_dtor(*zcount); - ZVAL_LONG(*zcount, count); + ZVAL_LONG(*zcount, (long) count); } } /* }}} */ @@ -4034,12 +4031,12 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) { char *str; char *heb_str, *tmp, *target, *broken_str; - int block_start, block_end, block_type, block_length, i; + zend_str_size block_start, block_end, block_type, block_length, i; long max_chars=0; - int begin, end, char_count, orig_begin; - int str_len; + zend_str_size begin, end, char_count, orig_begin; + zend_str_size str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &max_chars) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &str_len, &max_chars) == FAILURE) { return; } @@ -4192,7 +4189,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) efree(broken_str); } else { Z_STRVAL_P(return_value) = broken_str; - Z_STRLEN_P(return_value) = str_len; + Z_STRSIZE_P(return_value) = str_len; Z_TYPE_P(return_value) = IS_STRING; } } @@ -4220,13 +4217,13 @@ PHP_FUNCTION(nl2br) { /* in brief this inserts
or
before matched regexp \n\r?|\r\n? */ char *tmp, *str; - int new_length; + zend_str_size new_length; char *end, *target; - int repl_cnt = 0; - int str_len; + zend_str_size repl_cnt = 0; + zend_str_size str_len; zend_bool is_xhtml = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &str, &str_len, &is_xhtml) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &str, &str_len, &is_xhtml) == FAILURE) { return; } @@ -4256,7 +4253,7 @@ PHP_FUNCTION(nl2br) } { - size_t repl_len = is_xhtml ? (sizeof("
") - 1) : (sizeof("
") - 1); + zend_str_size repl_len = is_xhtml ? (sizeof("
") - 1) : (sizeof("
") - 1); new_length = str_len + repl_cnt * repl_len; tmp = target = safe_emalloc(repl_cnt, repl_len, str_len + 1); @@ -4302,11 +4299,11 @@ PHP_FUNCTION(strip_tags) char *str; zval **allow=NULL; char *allowed_tags=NULL; - int allowed_tags_len=0; - int str_len; + zend_str_size allowed_tags_len=0; + zend_str_size str_len; size_t retval_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|Z", &str, &str_len, &allow) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|Z", &str, &str_len, &allow) == FAILURE) { return; } @@ -4314,7 +4311,7 @@ PHP_FUNCTION(strip_tags) if (allow != NULL) { convert_to_string_ex(allow); allowed_tags = Z_STRVAL_PP(allow); - allowed_tags_len = Z_STRLEN_PP(allow); + allowed_tags_len = Z_STRSIZE_PP(allow); } buf = estrndup(str, str_len); @@ -4395,7 +4392,7 @@ PHP_FUNCTION(setlocale) loc = NULL; } else { loc = Z_STRVAL_PP(plocale); - if (Z_STRLEN_PP(plocale) >= 255) { + if (Z_STRSIZE_PP(plocale) >= 255) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Specified locale name is too long"); break; } @@ -4438,9 +4435,9 @@ PHP_FUNCTION(parse_str) char *arg; zval *arrayArg = NULL; char *res = NULL; - int arglen; + zend_str_size arglen; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &arg, &arglen, &arrayArg) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|z", &arg, &arglen, &arrayArg) == FAILURE) { return; } @@ -4477,7 +4474,7 @@ PHP_FUNCTION(parse_str) * 0 start tag * 1 first non-whitespace char seen */ -int php_tag_find(char *tag, int len, char *set) { +int php_tag_find(char *tag, zend_str_size_int len, char *set) { char c, *n, *t; int state=0, done=0; char *norm; @@ -4532,7 +4529,7 @@ int php_tag_find(char *tag, int len, char *set) { } /* }}} */ -PHPAPI size_t php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int allow_len) /* {{{ */ +PHPAPI zend_str_size_size_t php_strip_tags(char *rbuf, zend_str_size_int len, int *stateptr, char *allow, zend_str_size_int allow_len) /* {{{ */ { return php_strip_tags_ex(rbuf, len, stateptr, allow, allow_len, 0); } @@ -4558,11 +4555,12 @@ PHPAPI size_t php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, in swm: Added ability to strip 1) { - php_string_shuffle(Z_STRVAL_P(return_value), (long) Z_STRLEN_P(return_value) TSRMLS_CC); + if (Z_STRSIZE_P(return_value) > 1) { + php_string_shuffle(Z_STRVAL_P(return_value), (long) Z_STRSIZE_P(return_value) TSRMLS_CC); } } /* }}} */ @@ -5385,10 +5384,10 @@ PHP_FUNCTION(str_shuffle) PHP_FUNCTION(str_word_count) { char *buf, *str, *char_list = NULL, *p, *e, *s, ch[256]; - int str_len, char_list_len = 0, word_count = 0; + zend_str_size str_len, char_list_len = 0, word_count = 0; long type = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len, &type, &char_list, &char_list_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lS", &str, &str_len, &type, &char_list, &char_list_len) == FAILURE) { return; } @@ -5463,12 +5462,12 @@ PHP_FUNCTION(str_word_count) Convert monetary value(s) to string */ PHP_FUNCTION(money_format) { - int format_len = 0, str_len; + zend_str_size format_len = 0, str_len; char *format, *str, *p, *e; double value; zend_bool check = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sd", &format, &format_len, &value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sd", &format, &format_len, &value) == FAILURE) { return; } @@ -5504,12 +5503,12 @@ PHP_FUNCTION(money_format) PHP_FUNCTION(str_split) { char *str; - int str_len; + zend_str_size str_len; long split_length = 1; char *p; - int n_reg_segments; + zend_str_size n_reg_segments; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &split_length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &str_len, &split_length) == FAILURE) { return; } @@ -5544,10 +5543,10 @@ PHP_FUNCTION(str_split) PHP_FUNCTION(strpbrk) { char *haystack, *char_list; - int haystack_len, char_list_len; + zend_str_size haystack_len, char_list_len; char *haystack_ptr, *cl_ptr; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &haystack, &haystack_len, &char_list, &char_list_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &haystack, &haystack_len, &char_list, &char_list_len) == FAILURE) { RETURN_FALSE; } @@ -5573,12 +5572,12 @@ PHP_FUNCTION(strpbrk) PHP_FUNCTION(substr_compare) { char *s1, *s2; - int s1_len, s2_len; + zend_str_size s1_len, s2_len; long offset, len=0; zend_bool cs=0; - uint cmp_len; + zend_str_size cmp_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl|lb", &s1, &s1_len, &s2, &s2_len, &offset, &len, &cs) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSl|lb", &s1, &s1_len, &s2, &s2_len, &offset, &len, &cs) == FAILURE) { RETURN_FALSE; } @@ -5597,7 +5596,7 @@ PHP_FUNCTION(substr_compare) RETURN_FALSE; } - cmp_len = (uint) (len ? len : MAX(s2_len, (s1_len - offset))); + cmp_len = (zend_str_size) (len ? len : MAX(s2_len, (s1_len - offset))); if (!cs) { RETURN_LONG(zend_binary_strncmp(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); From 6e008d40c2e5333a3a456889c53463ecf3daed78 Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Tue, 2 Jul 2013 09:46:30 -0400 Subject: [PATCH 04/31] It compiles. Sort-of. In a way. Yeah. But nothing works. Sigh --- Zend/zend.c | 22 +- Zend/zend_API.c | 52 +- Zend/zend_builtin_functions.c | 18 +- Zend/zend_closures.c | 4 +- Zend/zend_compile.c | 252 ++++----- Zend/zend_constants.c | 42 +- Zend/zend_constants.h | 14 +- Zend/zend_exceptions.c | 18 +- Zend/zend_execute.c | 32 +- Zend/zend_execute_API.c | 30 +- Zend/zend_hash.c | 2 +- Zend/zend_ini.c | 4 +- Zend/zend_ini_parser.y | 36 +- Zend/zend_ini_scanner.c | 10 +- Zend/zend_ini_scanner.l | 10 +- Zend/zend_ini_scanner_defs.h | 26 +- Zend/zend_interfaces.c | 4 +- Zend/zend_language_parser.y | 10 +- Zend/zend_object_handlers.c | 20 +- Zend/zend_operators.c | 136 ++--- Zend/zend_vm_def.h | 112 ++-- Zend/zend_vm_execute.h | 804 ++++++++++++++-------------- ext/ereg/ereg.c | 8 +- ext/pcre/php_pcre.c | 22 +- ext/reflection/php_reflection.c | 48 +- ext/spl/php_spl.c | 10 +- ext/spl/spl_directory.c | 8 +- ext/spl/spl_engine.c | 2 +- ext/spl/spl_iterators.c | 34 +- ext/spl/spl_observer.c | 4 +- ext/standard/assert.c | 10 +- ext/standard/dir.c | 22 +- ext/standard/exec.c | 37 +- ext/standard/filestat.c | 34 +- ext/standard/filters.c | 16 +- ext/standard/formatted_print.c | 4 +- ext/standard/http.c | 8 +- ext/standard/http_fopen_wrapper.c | 40 +- ext/standard/incomplete_class.c | 12 +- ext/standard/info.c | 4 +- ext/standard/pack.c | 10 +- ext/standard/password.c | 8 +- ext/standard/php_filestat.h | 8 +- ext/standard/php_incomplete_class.h | 6 +- ext/standard/proc_open.c | 6 +- ext/standard/type.c | 2 +- ext/standard/url.c | 6 +- ext/standard/user_filters.c | 6 +- ext/standard/var.c | 58 +- ext/standard/var_unserializer.c | 6 +- ext/standard/var_unserializer.re | 6 +- main/output.c | 10 +- main/php_ini.c | 55 +- main/php_ini.h | 6 +- main/php_variables.c | 52 +- main/php_variables.h | 2 +- main/snprintf.c | 2 +- main/spprintf.c | 2 +- main/streams/userspace.c | 6 +- main/streams/xp_socket.c | 2 +- sapi/cli/cli.h | 6 +- sapi/cli/php_cli.c | 24 +- 62 files changed, 1134 insertions(+), 1136 deletions(-) diff --git a/Zend/zend.c b/Zend/zend.c index 625c3dceeca87..b451e6cb230d2 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -234,26 +234,26 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop } switch (Z_TYPE_P(expr)) { case IS_NULL: - Z_STRLEN_P(expr_copy) = 0; + Z_STRSIZE_P(expr_copy) = 0; Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC(); break; case IS_BOOL: if (Z_LVAL_P(expr)) { - Z_STRLEN_P(expr_copy) = 1; + Z_STRSIZE_P(expr_copy) = 1; Z_STRVAL_P(expr_copy) = estrndup("1", 1); } else { - Z_STRLEN_P(expr_copy) = 0; + Z_STRSIZE_P(expr_copy) = 0; Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC(); } break; case IS_RESOURCE: Z_STRVAL_P(expr_copy) = (char *) emalloc(sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG); - Z_STRLEN_P(expr_copy) = snprintf(Z_STRVAL_P(expr_copy), sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG, "Resource id #%ld", Z_LVAL_P(expr)); + Z_STRSIZE_P(expr_copy) = snprintf(Z_STRVAL_P(expr_copy), sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG, "Resource id #%ld", Z_LVAL_P(expr)); break; case IS_ARRAY: zend_error(E_NOTICE, "Array to string conversion"); - Z_STRLEN_P(expr_copy) = sizeof("Array") - 1; - Z_STRVAL_P(expr_copy) = estrndup("Array", Z_STRLEN_P(expr_copy)); + Z_STRSIZE_P(expr_copy) = sizeof("Array") - 1; + Z_STRVAL_P(expr_copy) = estrndup("Array", Z_STRSIZE_P(expr_copy)); break; case IS_OBJECT: { @@ -291,7 +291,7 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop zval_ptr_dtor(&z); } zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %s could not be converted to string", Z_OBJCE_P(expr)->name); - Z_STRLEN_P(expr_copy) = 0; + Z_STRSIZE_P(expr_copy) = 0; Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC(); } break; @@ -326,17 +326,17 @@ ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int in if (use_copy) { expr = &expr_copy; } - if (Z_STRLEN_P(expr) == 0) { /* optimize away empty strings */ + if (Z_STRSIZE_P(expr) == 0) { /* optimize away empty strings */ if (use_copy) { zval_dtor(expr); } return 0; } - write_func(Z_STRVAL_P(expr), Z_STRLEN_P(expr)); + write_func(Z_STRVAL_P(expr), Z_STRSIZE_P(expr)); if (use_copy) { zval_dtor(expr); } - return Z_STRLEN_P(expr); + return Z_STRSIZE_P(expr); } /* }}} */ @@ -1138,7 +1138,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ # endif #endif va_copy(usr_copy, args); - Z_STRLEN_P(z_error_message) = zend_vspprintf(&Z_STRVAL_P(z_error_message), 0, format, usr_copy); + Z_STRSIZE_P(z_error_message) = zend_vspprintf(&Z_STRVAL_P(z_error_message), 0, format, usr_copy); #ifdef va_copy va_end(usr_copy); #endif diff --git a/Zend/zend_API.c b/Zend/zend_API.c index d993df0baaa37..5e82177c45384 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -266,7 +266,7 @@ static int parse_arg_object_to_string(zval **arg, char **p, zend_str_size_int *p if (Z_OBJ_HANDLER_P(*arg, cast_object)(*arg, obj, type TSRMLS_CC) == SUCCESS) { zval_ptr_dtor(arg); *arg = obj; - *pl = Z_STRLEN_PP(arg); + *pl = Z_STRSIZE_PP(arg); *p = Z_STRVAL_PP(arg); return SUCCESS; } @@ -276,7 +276,7 @@ static int parse_arg_object_to_string(zval **arg, char **p, zend_str_size_int *p if (Z_OBJ_HT_PP(arg) == &std_object_handlers || !Z_OBJ_HANDLER_PP(arg, cast_object)) { SEPARATE_ZVAL_IF_NOT_REF(arg); if (zend_std_cast_object_tostring(*arg, *arg, type TSRMLS_CC) == SUCCESS) { - *pl = Z_STRLEN_PP(arg); + *pl = Z_STRSIZE_PP(arg); *p = Z_STRVAL_PP(arg); return SUCCESS; } @@ -292,7 +292,7 @@ static int parse_arg_object_to_string(zval **arg, char **p, zend_str_size_int *p if (!use_copy) { ZVAL_ZVAL(*arg, z, 1, 1); } - *pl = Z_STRLEN_PP(arg); + *pl = Z_STRSIZE_PP(arg); *p = Z_STRVAL_PP(arg); return SUCCESS; } @@ -337,7 +337,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con double d; int type; - if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), p, &d, -1)) == 0) { + if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRSIZE_PP(arg), p, &d, -1)) == 0) { return "long"; } else if (type == IS_DOUBLE) { if (c == 'L') { @@ -396,7 +396,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con long l; int type; - if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &l, p, -1)) == 0) { + if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRSIZE_PP(arg), &l, p, -1)) == 0) { return "double"; } else if (type == IS_LONG) { *p = (double) l; @@ -458,7 +458,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con SEPARATE_ZVAL(arg); } *p = Z_STRVAL_PP(arg); - pl = Z_STRLEN_PP(arg); + pl = Z_STRSIZE_PP(arg); if ((c == 'p' || c == 'P') && CHECK_ZVAL_NULL_PATH(*arg)) { return "a valid path"; } @@ -610,7 +610,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con break; } convert_to_string_ex(arg); - if (zend_lookup_class(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &lookup TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_PP(arg), Z_STRSIZE_PP(arg), &lookup TSRMLS_CC) == FAILURE) { *pce = NULL; } else { *pce = *lookup; @@ -1560,7 +1560,7 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */ switch (Z_TYPE_P(key)) { case IS_STRING: - result = zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL); + result = zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRSIZE_P(key) + 1, &value, sizeof(zval *), NULL); break; case IS_NULL: result = zend_symtable_update(ht, "", 1, &value, sizeof(zval *), NULL); @@ -2773,10 +2773,10 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca if (!ce_org) { /* Skip leading \ */ if (Z_STRVAL_P(callable)[0] == '\\') { - mlen = Z_STRLEN_P(callable) - 1; + mlen = Z_STRSIZE_P(callable) - 1; lmname = zend_str_tolower_dup(Z_STRVAL_P(callable) + 1, mlen); } else { - mlen = Z_STRLEN_P(callable); + mlen = Z_STRSIZE_P(callable); lmname = zend_str_tolower_dup(Z_STRVAL_P(callable), mlen); } /* Check if function with given name exists. @@ -2789,13 +2789,13 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca } /* Split name into class/namespace and method/function names */ - if ((colon = zend_memrchr(Z_STRVAL_P(callable), ':', Z_STRLEN_P(callable))) != NULL && + if ((colon = zend_memrchr(Z_STRVAL_P(callable), ':', Z_STRSIZE_P(callable))) != NULL && colon > Z_STRVAL_P(callable) && *(colon-1) == ':' ) { colon--; clen = colon - Z_STRVAL_P(callable); - mlen = Z_STRLEN_P(callable) - clen - 2; + mlen = Z_STRSIZE_P(callable) - clen - 2; if (colon == Z_STRVAL_P(callable)) { if (error) zend_spprintf(error, 0, "invalid function name"); @@ -2823,7 +2823,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca mname = Z_STRVAL_P(callable) + clen + 2; } else if (ce_org) { /* Try to fetch find static method of given class. */ - mlen = Z_STRLEN_P(callable); + mlen = Z_STRSIZE_P(callable); mname = Z_STRVAL_P(callable); ftable = &ce_org->function_table; fcc->calling_scope = ce_org; @@ -3056,17 +3056,17 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch if (callable_name) { char *ptr; - *callable_name_len = fcc->calling_scope->name_length + Z_STRLEN_P(callable) + sizeof("::") - 1; + *callable_name_len = fcc->calling_scope->name_length + Z_STRSIZE_P(callable) + sizeof("::") - 1; ptr = *callable_name = emalloc(*callable_name_len + 1); memcpy(ptr, fcc->calling_scope->name, fcc->calling_scope->name_length); ptr += fcc->calling_scope->name_length; memcpy(ptr, "::", sizeof("::") - 1); ptr += sizeof("::") - 1; - memcpy(ptr, Z_STRVAL_P(callable), Z_STRLEN_P(callable) + 1); + memcpy(ptr, Z_STRVAL_P(callable), Z_STRSIZE_P(callable) + 1); } } else if (callable_name) { - *callable_name = estrndup(Z_STRVAL_P(callable), Z_STRLEN_P(callable)); - *callable_name_len = Z_STRLEN_P(callable); + *callable_name = estrndup(Z_STRVAL_P(callable), Z_STRSIZE_P(callable)); + *callable_name_len = Z_STRSIZE_P(callable); } if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) { fcc->called_scope = fcc->calling_scope; @@ -3106,20 +3106,20 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch if (callable_name) { char *ptr; - *callable_name_len = Z_STRLEN_PP(obj) + Z_STRLEN_PP(method) + sizeof("::") - 1; + *callable_name_len = Z_STRSIZE_PP(obj) + Z_STRSIZE_PP(method) + sizeof("::") - 1; ptr = *callable_name = emalloc(*callable_name_len + 1); - memcpy(ptr, Z_STRVAL_PP(obj), Z_STRLEN_PP(obj)); - ptr += Z_STRLEN_PP(obj); + memcpy(ptr, Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj)); + ptr += Z_STRSIZE_PP(obj); memcpy(ptr, "::", sizeof("::") - 1); ptr += sizeof("::") - 1; - memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1); + memcpy(ptr, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) + 1); } if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) { return 1; } - if (!zend_is_callable_check_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), fcc, &strict_class, error TSRMLS_CC)) { + if (!zend_is_callable_check_class(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), fcc, &strict_class, error TSRMLS_CC)) { return 0; } @@ -3136,13 +3136,13 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch if (callable_name) { char *ptr; - *callable_name_len = fcc->calling_scope->name_length + Z_STRLEN_PP(method) + sizeof("::") - 1; + *callable_name_len = fcc->calling_scope->name_length + Z_STRSIZE_PP(method) + sizeof("::") - 1; ptr = *callable_name = emalloc(*callable_name_len + 1); memcpy(ptr, fcc->calling_scope->name, fcc->calling_scope->name_length); ptr += fcc->calling_scope->name_length; memcpy(ptr, "::", sizeof("::") - 1); ptr += sizeof("::") - 1; - memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1); + memcpy(ptr, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) + 1); } if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) { @@ -3204,8 +3204,8 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch int use_copy; zend_make_printable_zval(callable, &expr_copy, &use_copy); - *callable_name = estrndup(Z_STRVAL(expr_copy), Z_STRLEN(expr_copy)); - *callable_name_len = Z_STRLEN(expr_copy); + *callable_name = estrndup(Z_STRVAL(expr_copy), Z_STRSIZE(expr_copy)); + *callable_name_len = Z_STRSIZE(expr_copy); zval_dtor(&expr_copy); } if (error) zend_spprintf(error, 0, "no array or string given"); diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 1e4dc7598a1f8..761b0a4c44f03 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -626,10 +626,10 @@ ZEND_FUNCTION(each) ZEND_FUNCTION(error_reporting) { char *err; - int err_len; + zend_str_size err_len; int old_error_reporting; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &err, &err_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &err, &err_len) == FAILURE) { return; } @@ -822,7 +822,7 @@ ZEND_FUNCTION(get_parent_class) } else if (Z_TYPE_P(arg) == IS_STRING) { zend_class_entry **pce; - if (zend_lookup_class(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &pce TSRMLS_CC) == SUCCESS) { + if (zend_lookup_class(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), &pce TSRMLS_CC) == SUCCESS) { ce = *pce; } } @@ -858,7 +858,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) if (allow_string && Z_TYPE_P(obj) == IS_STRING) { zend_class_entry **the_ce; - if (zend_lookup_class(Z_STRVAL_P(obj), Z_STRLEN_P(obj), &the_ce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(obj), Z_STRSIZE_P(obj), &the_ce TSRMLS_CC) == FAILURE) { RETURN_FALSE; } instance_ce = *the_ce; @@ -1054,7 +1054,7 @@ ZEND_FUNCTION(get_class_methods) } ce = Z_OBJCE_P(klass); } else if (Z_TYPE_P(klass) == IS_STRING) { - if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRLEN_P(klass), &pce TSRMLS_CC) == SUCCESS) { + if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRSIZE_P(klass), &pce TSRMLS_CC) == SUCCESS) { ce = *pce; } } @@ -1123,7 +1123,7 @@ ZEND_FUNCTION(method_exists) if (Z_TYPE_P(klass) == IS_OBJECT) { ce = Z_OBJCE_P(klass); } else if (Z_TYPE_P(klass) == IS_STRING) { - if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRLEN_P(klass), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRSIZE_P(klass), &pce TSRMLS_CC) == FAILURE) { RETURN_FALSE; } ce = *pce; @@ -1185,7 +1185,7 @@ ZEND_FUNCTION(property_exists) } if (Z_TYPE_P(object) == IS_STRING) { - if (zend_lookup_class(Z_STRVAL_P(object), Z_STRLEN_P(object), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(object), Z_STRSIZE_P(object), &pce TSRMLS_CC) == FAILURE) { RETURN_FALSE; } ce = *pce; @@ -1349,12 +1349,12 @@ ZEND_FUNCTION(trait_exists) ZEND_FUNCTION(function_exists) { char *name; - int name_len; + zend_str_size name_len; zend_function *func; char *lcname; zend_bool retval; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { return; } diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 6f72cac8929cc..6cca9e9befb8f 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -107,13 +107,13 @@ ZEND_METHOD(Closure, bind) if (Z_TYPE_P(scope_arg) == IS_STRING) { class_name = Z_STRVAL_P(scope_arg); - class_name_len = Z_STRLEN_P(scope_arg); + class_name_len = Z_STRSIZE_P(scope_arg); } else { tmp_zval = *scope_arg; zval_copy_ctor(&tmp_zval); convert_to_string(&tmp_zval); class_name = Z_STRVAL(tmp_zval); - class_name_len = Z_STRLEN(tmp_zval); + class_name_len = Z_STRSIZE(tmp_zval); } if ((class_name_len == sizeof("static") - 1) && diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 0645bfa012b6f..97c04753da40b 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -64,7 +64,7 @@ if (IS_INTERNED(Z_STRVAL(CONSTANT(num)))) { \ Z_HASH_P(&CONSTANT(num)) = INTERNED_HASH(Z_STRVAL(CONSTANT(num))); \ } else { \ - Z_HASH_P(&CONSTANT(num)) = zend_hash_func(Z_STRVAL(CONSTANT(num)), Z_STRLEN(CONSTANT(num))+1); \ + Z_HASH_P(&CONSTANT(num)) = zend_hash_func(Z_STRVAL(CONSTANT(num)), Z_STRSIZE(CONSTANT(num))+1); \ } \ } while (0) @@ -336,7 +336,7 @@ static inline void zend_insert_literal(zend_op_array *op_array, const zval *zv, { if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_CONSTANT) { zval *z = (zval*)zv; - Z_STRVAL_P(z) = (char*)zend_new_interned_string(Z_STRVAL_P(zv), Z_STRLEN_P(zv) + 1, 1 TSRMLS_CC); + Z_STRVAL_P(z) = (char*)zend_new_interned_string(Z_STRVAL_P(zv), Z_STRSIZE_P(zv) + 1, 1 TSRMLS_CC); } CONSTANT_EX(op_array, literal_position) = *zv; Z_SET_REFCOUNT(CONSTANT_EX(op_array, literal_position), 2); @@ -392,8 +392,8 @@ int zend_add_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC ret = zend_add_literal(op_array, zv TSRMLS_CC); } - lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv), Z_STRLEN_P(zv)); - ZVAL_STRINGL(&c, lc_name, Z_STRLEN_P(zv), 0); + lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv), Z_STRSIZE_P(zv)); + ZVAL_STRINGL(&c, lc_name, Z_STRSIZE_P(zv), 0); lc_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC); CALCULATE_LITERAL_HASH(lc_literal); @@ -419,13 +419,13 @@ int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS ret = zend_add_literal(op_array, zv TSRMLS_CC); } - lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv), Z_STRLEN_P(zv)); - ZVAL_STRINGL(&c, lc_name, Z_STRLEN_P(zv), 0); + lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv), Z_STRSIZE_P(zv)); + ZVAL_STRINGL(&c, lc_name, Z_STRSIZE_P(zv), 0); lc_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC); CALCULATE_LITERAL_HASH(lc_literal); - ns_separator = (const char*)zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRLEN_P(zv)) + 1; - lc_len = Z_STRLEN_P(zv) - (ns_separator - Z_STRVAL_P(zv)); + ns_separator = (const char*)zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRSIZE_P(zv)) + 1; + lc_len = Z_STRSIZE_P(zv) - (ns_separator - Z_STRVAL_P(zv)); lc_name = zend_str_tolower_dup(ns_separator, lc_len); ZVAL_STRINGL(&c, lc_name, lc_len, 0); lc_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC); @@ -453,10 +453,10 @@ int zend_add_class_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_D } if (Z_STRVAL_P(zv)[0] == '\\') { - lc_len = Z_STRLEN_P(zv) - 1; + lc_len = Z_STRSIZE_P(zv) - 1; lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv) + 1, lc_len); } else { - lc_len = Z_STRLEN_P(zv); + lc_len = Z_STRSIZE_P(zv); lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv), lc_len); } ZVAL_STRINGL(&c, lc_name, lc_len, 0); @@ -488,10 +488,10 @@ int zend_add_const_name_literal(zend_op_array *op_array, const zval *zv, int unq /* skip leading '\\' */ if (Z_STRVAL_P(zv)[0] == '\\') { - name_len = Z_STRLEN_P(zv) - 1; + name_len = Z_STRSIZE_P(zv) - 1; name = Z_STRVAL_P(zv) + 1; } else { - name_len = Z_STRLEN_P(zv); + name_len = Z_STRSIZE_P(zv); name = Z_STRVAL_P(zv); } ns_separator = zend_memrchr(name, '\\', name_len); @@ -722,7 +722,7 @@ void zend_do_fetch_static_member(znode *result, znode *class_name TSRMLS_DC) /* zend_op opline; if (class_name->op_type == IS_CONST && - ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { + ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant))) { zend_resolve_class_name(class_name, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); class_node = *class_name; } else { @@ -827,7 +827,7 @@ void fetch_array_dim(znode *result, const znode *parent, const znode *dim TSRMLS ulong index; int numeric = 0; - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline.op2.constant)), Z_STRLEN(CONSTANT(opline.op2.constant))+1, index, numeric = 1); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline.op2.constant)), Z_STRSIZE(CONSTANT(opline.op2.constant))+1, index, numeric = 1); if (numeric) { zval_dtor(&CONSTANT(opline.op2.constant)); ZVAL_LONG(&CONSTANT(opline.op2.constant), index); @@ -909,7 +909,7 @@ static zend_bool opline_is_fetch_this(const zend_op *opline TSRMLS_DC) /* {{{ */ if ((opline->opcode == ZEND_FETCH_W) && (opline->op1_type == IS_CONST) && (Z_TYPE(CONSTANT(opline->op1.constant)) == IS_STRING) && (Z_HASH_P(&CONSTANT(opline->op1.constant)) == THIS_HASHVAL) - && (Z_STRLEN(CONSTANT(opline->op1.constant)) == (sizeof("this")-1)) + && (Z_STRSIZE(CONSTANT(opline->op1.constant)) == (sizeof("this")-1)) && !memcmp(Z_STRVAL(CONSTANT(opline->op1.constant)), "this", sizeof("this"))) { return 1; } else { @@ -1317,7 +1317,7 @@ void zend_do_end_variable_parse(znode *variable, int type, int arg_offset TSRMLS this_var = opline_ptr->result.var; if (CG(active_op_array)->this_var == -1) { - CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), Z_STRVAL(CONSTANT(opline_ptr->op1.constant)), Z_STRLEN(CONSTANT(opline_ptr->op1.constant)), Z_HASH_P(&CONSTANT(opline_ptr->op1.constant)) TSRMLS_CC); + CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), Z_STRVAL(CONSTANT(opline_ptr->op1.constant)), Z_STRSIZE(CONSTANT(opline_ptr->op1.constant)), Z_HASH_P(&CONSTANT(opline_ptr->op1.constant)) TSRMLS_CC); Z_TYPE(CONSTANT(opline_ptr->op1.constant)) = IS_NULL; } else { zend_del_literal(CG(active_op_array), opline_ptr->op1.constant); @@ -1394,10 +1394,10 @@ void zend_do_add_string(znode *result, const znode *op1, znode *op2 TSRMLS_DC) / { zend_op *opline; - if (Z_STRLEN(op2->u.constant) > 1) { + if (Z_STRSIZE(op2->u.constant) > 1) { opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_ADD_STRING; - } else if (Z_STRLEN(op2->u.constant) == 1) { + } else if (Z_STRSIZE(op2->u.constant) == 1) { int ch = *Z_STRVAL(op2->u.constant); /* Free memory and use ZEND_ADD_CHAR in case of 1 character strings */ @@ -1704,7 +1704,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n zval_copy_ctor(&tmp.u.constant); zend_do_build_namespace_name(&tmp, &tmp, function_name TSRMLS_CC); op_array.function_name = Z_STRVAL(tmp.u.constant); - name_len = Z_STRLEN(tmp.u.constant); + name_len = Z_STRSIZE(tmp.u.constant); lcname = zend_str_tolower_dup(Z_STRVAL(tmp.u.constant), name_len); } else { lcname = zend_str_tolower_dup(name, name_len); @@ -1714,12 +1714,12 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n opline->op1_type = IS_CONST; build_runtime_defined_function_key(&key, lcname, name_len TSRMLS_CC); opline->op1.constant = zend_add_literal(CG(active_op_array), &key TSRMLS_CC); - Z_HASH_P(&CONSTANT(opline->op1.constant)) = zend_hash_func(Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRLEN(CONSTANT(opline->op1.constant))); + Z_HASH_P(&CONSTANT(opline->op1.constant)) = zend_hash_func(Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRSIZE(CONSTANT(opline->op1.constant))); opline->op2_type = IS_CONST; LITERAL_STRINGL(opline->op2, lcname, name_len, 0); CALCULATE_LITERAL_HASH(opline->op2.constant); opline->extended_value = ZEND_DECLARE_FUNCTION; - zend_hash_quick_update(CG(function_table), Z_STRVAL(key), Z_STRLEN(key), Z_HASH_P(&CONSTANT(opline->op1.constant)), &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)); + zend_hash_quick_update(CG(function_table), Z_STRVAL(key), Z_STRSIZE(key), Z_HASH_P(&CONSTANT(opline->op1.constant)), &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)); zend_stack_push(&CG(context_stack), (void *) &CG(context), sizeof(CG(context))); zend_init_compiler_context(TSRMLS_C); } @@ -1842,14 +1842,14 @@ void zend_do_receive_arg(zend_uchar op, znode *varname, const znode *offset, con if (class_type->op_type == IS_CONST && Z_TYPE(class_type->u.constant) == IS_STRING && - Z_STRLEN(class_type->u.constant) == 0) { + Z_STRSIZE(class_type->u.constant) == 0) { /* Usage of namespace as class name not in namespace */ zval_dtor(&class_type->u.constant); zend_error(E_COMPILE_ERROR, "Cannot use 'namespace' as a class name"); return; } - if (zend_is_auto_global_quick(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant), 0 TSRMLS_CC)) { + if (zend_is_auto_global_quick(Z_STRVAL(varname->u.constant), Z_STRSIZE(varname->u.constant), 0 TSRMLS_CC)) { zend_error(E_COMPILE_ERROR, "Cannot re-assign auto-global variable %s", Z_STRVAL(varname->u.constant)); } else { var.op_type = IS_CV; @@ -1857,7 +1857,7 @@ void zend_do_receive_arg(zend_uchar op, znode *varname, const znode *offset, con Z_STRVAL(varname->u.constant) = (char*)CG(active_op_array)->vars[var.u.op.var].name; var.EA = 0; if (CG(active_op_array)->vars[var.u.op.var].hash_value == THIS_HASHVAL && - Z_STRLEN(varname->u.constant) == sizeof("this")-1 && + Z_STRSIZE(varname->u.constant) == sizeof("this")-1 && !memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this")-1)) { if (CG(active_op_array)->scope && (CG(active_op_array)->fn_flags & ZEND_ACC_STATIC) == 0) { @@ -1912,7 +1912,7 @@ void zend_do_receive_arg(zend_uchar op, znode *varname, const znode *offset, con } } else { cur_arg_info->type_hint = IS_OBJECT; - if (ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_type->u.constant), Z_STRLEN(class_type->u.constant))) { + if (ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_type->u.constant), Z_STRSIZE(class_type->u.constant))) { zend_resolve_class_name(class_type, opline->extended_value, 1 TSRMLS_CC); } Z_STRVAL(class_type->u.constant) = (char*)zend_new_interned_string(class_type->u.constant.value.str.val, class_type->u.constant.value.str.len + 1, 1 TSRMLS_CC); @@ -1935,7 +1935,7 @@ int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace { zend_function *function; char *lcname; - char *is_compound = memchr(Z_STRVAL(function_name->u.constant), '\\', Z_STRLEN(function_name->u.constant)); + char *is_compound = memchr(Z_STRVAL(function_name->u.constant), '\\', Z_STRSIZE(function_name->u.constant)); zend_resolve_non_class_name(function_name, check_namespace TSRMLS_CC); @@ -1981,8 +1981,8 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) /* {{{ */ last_op_number = get_next_op_number(CG(active_op_array))-1; last_op = &CG(active_op_array)->opcodes[last_op_number]; - if ((last_op->op2_type == IS_CONST) && (Z_TYPE(CONSTANT(last_op->op2.constant)) == IS_STRING) && (Z_STRLEN(CONSTANT(last_op->op2.constant)) == sizeof(ZEND_CLONE_FUNC_NAME)-1) - && !zend_binary_strcasecmp(Z_STRVAL(CONSTANT(last_op->op2.constant)), Z_STRLEN(CONSTANT(last_op->op2.constant)), ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1)) { + if ((last_op->op2_type == IS_CONST) && (Z_TYPE(CONSTANT(last_op->op2.constant)) == IS_STRING) && (Z_STRSIZE(CONSTANT(last_op->op2.constant)) == sizeof(ZEND_CLONE_FUNC_NAME)-1) + && !zend_binary_strcasecmp(Z_STRVAL(CONSTANT(last_op->op2.constant)), Z_STRSIZE(CONSTANT(last_op->op2.constant)), ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1)) { zend_error(E_COMPILE_ERROR, "Cannot call __clone() method on objects - use 'clone $obj' instead"); } @@ -1994,7 +1994,7 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) /* {{{ */ zend_error(E_COMPILE_ERROR, "Method name must be a string"); } if (!IS_INTERNED(Z_STRVAL(name))) { - Z_STRVAL(name) = estrndup(Z_STRVAL(name), Z_STRLEN(name)); + Z_STRVAL(name) = estrndup(Z_STRVAL(name), Z_STRSIZE(name)); } FREE_POLYMORPHIC_CACHE_SLOT(last_op->op2.constant); last_op->op2.constant = @@ -2081,12 +2081,12 @@ void zend_resolve_non_class_name(znode *element_name, zend_bool check_namespace znode tmp; zend_str_size len; zval **ns; - char *lcname, *compound = memchr(Z_STRVAL(element_name->u.constant), '\\', Z_STRLEN(element_name->u.constant)); + char *lcname, *compound = memchr(Z_STRVAL(element_name->u.constant), '\\', Z_STRSIZE(element_name->u.constant)); if (Z_STRVAL(element_name->u.constant)[0] == '\\') { /* name starts with \ so it is known and unambiguos, nothing to do here but shorten it */ - memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+1, Z_STRLEN(element_name->u.constant)); - --Z_STRLEN(element_name->u.constant); + memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+1, Z_STRSIZE(element_name->u.constant)); + --Z_STRSIZE(element_name->u.constant); return; } @@ -2104,8 +2104,8 @@ void zend_resolve_non_class_name(znode *element_name, zend_bool check_namespace tmp.u.constant = **ns; zval_copy_ctor(&tmp.u.constant); len += 1; - Z_STRLEN(element_name->u.constant) -= len; - memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+len, Z_STRLEN(element_name->u.constant)+1); + Z_STRSIZE(element_name->u.constant) -= len; + memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+len, Z_STRSIZE(element_name->u.constant)+1); zend_do_build_namespace_name(&tmp, &tmp, element_name TSRMLS_CC); *element_name = tmp; efree(lcname); @@ -2116,11 +2116,11 @@ void zend_resolve_non_class_name(znode *element_name, zend_bool check_namespace if (CG(current_namespace)) { tmp = *element_name; - Z_STRLEN(tmp.u.constant) = sizeof("\\")-1 + Z_STRLEN(element_name->u.constant) + Z_STRLEN_P(CG(current_namespace)); - Z_STRVAL(tmp.u.constant) = (char *) emalloc(Z_STRLEN(tmp.u.constant)+1); - memcpy(Z_STRVAL(tmp.u.constant), Z_STRVAL_P(CG(current_namespace)), Z_STRLEN_P(CG(current_namespace))); - memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN_P(CG(current_namespace))]), "\\", sizeof("\\")-1); - memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN_P(CG(current_namespace)) + sizeof("\\")-1]), Z_STRVAL(element_name->u.constant), Z_STRLEN(element_name->u.constant)+1); + Z_STRSIZE(tmp.u.constant) = sizeof("\\")-1 + Z_STRSIZE(element_name->u.constant) + Z_STRSIZE_P(CG(current_namespace)); + Z_STRVAL(tmp.u.constant) = (char *) emalloc(Z_STRSIZE(tmp.u.constant)+1); + memcpy(Z_STRVAL(tmp.u.constant), Z_STRVAL_P(CG(current_namespace)), Z_STRSIZE_P(CG(current_namespace))); + memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRSIZE_P(CG(current_namespace))]), "\\", sizeof("\\")-1); + memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRSIZE_P(CG(current_namespace)) + sizeof("\\")-1]), Z_STRVAL(element_name->u.constant), Z_STRSIZE(element_name->u.constant)+1); STR_FREE(Z_STRVAL(element_name->u.constant)); *element_name = tmp; } @@ -2182,18 +2182,18 @@ void zend_resolve_class_name(znode *class_name, ulong fetch_type, int check_ns_n znode tmp; zend_str_size len; - compound = memchr(Z_STRVAL(class_name->u.constant), '\\', Z_STRLEN(class_name->u.constant)); + compound = memchr(Z_STRVAL(class_name->u.constant), '\\', Z_STRSIZE(class_name->u.constant)); if (compound) { /* This is a compound class name that contains namespace prefix */ if (Z_STRVAL(class_name->u.constant)[0] == '\\') { /* The STRING name has "\" prefix */ - Z_STRLEN(class_name->u.constant) -= 1; - memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+1, Z_STRLEN(class_name->u.constant)+1); + Z_STRSIZE(class_name->u.constant) -= 1; + memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+1, Z_STRSIZE(class_name->u.constant)+1); Z_STRVAL(class_name->u.constant) = erealloc( Z_STRVAL(class_name->u.constant), - Z_STRLEN(class_name->u.constant) + 1); + Z_STRSIZE(class_name->u.constant) + 1); - if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { + if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant))) { zend_error(E_COMPILE_ERROR, "'\\%s' is an invalid class name", Z_STRVAL(class_name->u.constant)); } } else { @@ -2207,8 +2207,8 @@ void zend_resolve_class_name(znode *class_name, ulong fetch_type, int check_ns_n tmp.u.constant = **ns; zval_copy_ctor(&tmp.u.constant); len += 1; - Z_STRLEN(class_name->u.constant) -= len; - memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+len, Z_STRLEN(class_name->u.constant)+1); + Z_STRSIZE(class_name->u.constant) -= len; + memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+len, Z_STRSIZE(class_name->u.constant)+1); zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC); *class_name = tmp; efree(lcname); @@ -2227,10 +2227,10 @@ void zend_resolve_class_name(znode *class_name, ulong fetch_type, int check_ns_n } } else if (CG(current_import) || CG(current_namespace)) { /* this is a plain name (without \) */ - lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant)); + lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant)); if (CG(current_import) && - zend_hash_find(CG(current_import), lcname, Z_STRLEN(class_name->u.constant)+1, (void**)&ns) == SUCCESS) { + zend_hash_find(CG(current_import), lcname, Z_STRSIZE(class_name->u.constant)+1, (void**)&ns) == SUCCESS) { /* The given name is an import name. Substitute it. */ zval_dtor(&class_name->u.constant); class_name->u.constant = **ns; @@ -2255,7 +2255,7 @@ void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC) /* {{{ */ if (class_name->op_type == IS_CONST && Z_TYPE(class_name->u.constant) == IS_STRING && - Z_STRLEN(class_name->u.constant) == 0) { + Z_STRSIZE(class_name->u.constant) == 0) { /* Usage of namespace as class name not in namespace */ zval_dtor(&class_name->u.constant); zend_error(E_COMPILE_ERROR, "Cannot use 'namespace' as a class name"); @@ -2310,7 +2310,7 @@ void zend_do_label(znode *label TSRMLS_DC) /* {{{ */ dest.brk_cont = CG(context).current_brk_cont; dest.opline_num = get_next_op_number(CG(active_op_array)); - if (zend_hash_add(CG(context).labels, Z_STRVAL(label->u.constant), Z_STRLEN(label->u.constant) + 1, (void**)&dest, sizeof(zend_label), NULL) == FAILURE) { + if (zend_hash_add(CG(context).labels, Z_STRVAL(label->u.constant), Z_STRSIZE(label->u.constant) + 1, (void**)&dest, sizeof(zend_label), NULL) == FAILURE) { zend_error(E_COMPILE_ERROR, "Label '%s' already defined", Z_STRVAL(label->u.constant)); } @@ -2331,7 +2331,7 @@ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 label = &CONSTANT_EX(op_array, opline->op2.constant); } if (CG(context).labels == NULL || - zend_hash_find(CG(context).labels, Z_STRVAL_P(label), Z_STRLEN_P(label)+1, (void**)&dest) == FAILURE) { + zend_hash_find(CG(context).labels, Z_STRVAL_P(label), Z_STRSIZE_P(label)+1, (void**)&dest) == FAILURE) { if (pass2) { CG(in_compilation) = 1; @@ -2447,8 +2447,8 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na if (Z_TYPE(method_name->u.constant) != IS_STRING) { zend_error(E_COMPILE_ERROR, "Method name must be a string"); } - lcname = zend_str_tolower_dup(Z_STRVAL(method_name->u.constant), Z_STRLEN(method_name->u.constant)); - if ((sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRLEN(method_name->u.constant) && + lcname = zend_str_tolower_dup(Z_STRVAL(method_name->u.constant), Z_STRSIZE(method_name->u.constant)); + if ((sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRSIZE(method_name->u.constant) && memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == 0) { zval_dtor(&method_name->u.constant); method_name->op_type = IS_UNUSED; @@ -2457,7 +2457,7 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na } if (class_name->op_type == IS_CONST && - ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { + ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant))) { zend_resolve_class_name(class_name, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); class_node = *class_name; opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -2895,7 +2895,7 @@ void zend_do_begin_catch(znode *catch_token, znode *class_name, znode *catch_var znode catch_class; if (class_name->op_type == IS_CONST && - ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { + ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant))) { zend_resolve_class_name(class_name, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); catch_class = *class_name; } else { @@ -3360,10 +3360,10 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{ offset += 4; } else if (Z_TYPE_P(zv) == IS_STRING) { *(offset++) = '\''; - REALLOC_BUF_IF_EXCEED(buf, offset, length, MIN(Z_STRLEN_P(zv), 10)); - memcpy(offset, Z_STRVAL_P(zv), MIN(Z_STRLEN_P(zv), 10)); - offset += MIN(Z_STRLEN_P(zv), 10); - if (Z_STRLEN_P(zv) > 10) { + REALLOC_BUF_IF_EXCEED(buf, offset, length, MIN(Z_STRSIZE_P(zv), 10)); + memcpy(offset, Z_STRVAL_P(zv), MIN(Z_STRSIZE_P(zv), 10)); + offset += MIN(Z_STRSIZE_P(zv), 10); + if (Z_STRSIZE_P(zv) > 10) { *(offset++) = '.'; *(offset++) = '.'; *(offset++) = '.'; @@ -3374,9 +3374,9 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{ offset += 5; } else { zend_make_printable_zval(zv, &zv_copy, &use_copy); - REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRLEN(zv_copy)); - memcpy(offset, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy)); - offset += Z_STRLEN(zv_copy); + REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRSIZE(zv_copy)); + memcpy(offset, Z_STRVAL(zv_copy), Z_STRSIZE(zv_copy)); + offset += Z_STRSIZE(zv_copy); if (use_copy) { zval_dtor(&zv_copy); } @@ -4438,12 +4438,12 @@ ZEND_API int do_bind_function(const zend_op_array *op_array, zend_op *opline, Ha op2 = opline->op2.zv; } - zend_hash_quick_find(function_table, Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_HASH_P(op1), (void *) &function); - if (zend_hash_quick_add(function_table, Z_STRVAL_P(op2), Z_STRLEN_P(op2)+1, Z_HASH_P(op2), function, sizeof(zend_function), NULL)==FAILURE) { + zend_hash_quick_find(function_table, Z_STRVAL_P(op1), Z_STRSIZE_P(op1), Z_HASH_P(op1), (void *) &function); + if (zend_hash_quick_add(function_table, Z_STRVAL_P(op2), Z_STRSIZE_P(op2)+1, Z_HASH_P(op2), function, sizeof(zend_function), NULL)==FAILURE) { int error_level = compile_time ? E_COMPILE_ERROR : E_ERROR; zend_function *old_function; - if (zend_hash_quick_find(function_table, Z_STRVAL_P(op2), Z_STRLEN_P(op2)+1, Z_HASH_P(op2), (void *) &old_function)==SUCCESS + if (zend_hash_quick_find(function_table, Z_STRVAL_P(op2), Z_STRSIZE_P(op2)+1, Z_HASH_P(op2), (void *) &old_function)==SUCCESS && old_function->type == ZEND_USER_FUNCTION && old_function->op_array.last > 0) { zend_error(error_level, "Cannot redeclare %s() (previously declared in %s:%d)", @@ -4472,14 +4472,14 @@ void zend_prepare_reference(znode *result, znode *class_name, znode *method_name if (class_name) { zend_resolve_class_name(class_name, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); method_ref->class_name = Z_STRVAL(class_name->u.constant); - method_ref->cname_len = Z_STRLEN(class_name->u.constant); + method_ref->cname_len = Z_STRSIZE(class_name->u.constant); } else { method_ref->class_name = NULL; method_ref->cname_len = 0; } method_ref->method_name = Z_STRVAL(method_name->u.constant); - method_ref->mname_len = Z_STRLEN(method_name->u.constant); + method_ref->mname_len = Z_STRSIZE(method_name->u.constant); result->u.op.ptr = method_ref; result->op_type = IS_TMP_VAR; @@ -4507,7 +4507,7 @@ void zend_add_trait_alias(znode *method_reference, znode *modifiers, znode *alia trait_alias->modifiers = Z_LVAL(modifiers->u.constant); if (alias) { trait_alias->alias = Z_STRVAL(alias->u.constant); - trait_alias->alias_len = Z_STRLEN(alias->u.constant); + trait_alias->alias_len = Z_STRSIZE(alias->u.constant); } else { trait_alias->alias = NULL; } @@ -4539,14 +4539,14 @@ ZEND_API zend_class_entry *do_bind_class(const zend_op_array* op_array, const ze op1 = opline->op1.zv; op2 = opline->op2.zv; } - if (zend_hash_quick_find(class_table, Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_HASH_P(op1), (void **) &pce)==FAILURE) { + if (zend_hash_quick_find(class_table, Z_STRVAL_P(op1), Z_STRSIZE_P(op1), Z_HASH_P(op1), (void **) &pce)==FAILURE) { zend_error(E_COMPILE_ERROR, "Internal Zend error - Missing class information for %s", Z_STRVAL_P(op1)); return NULL; } else { ce = *pce; } ce->refcount++; - if (zend_hash_quick_add(class_table, Z_STRVAL_P(op2), Z_STRLEN_P(op2)+1, Z_HASH_P(op2), &ce, sizeof(zend_class_entry *), NULL)==FAILURE) { + if (zend_hash_quick_add(class_table, Z_STRVAL_P(op2), Z_STRSIZE_P(op2)+1, Z_HASH_P(op2), &ce, sizeof(zend_class_entry *), NULL)==FAILURE) { ce->refcount--; if (!compile_time) { /* If we're in compile time, in practice, it's quite possible @@ -4580,7 +4580,7 @@ ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array op2 = opline->op2.zv; } - found_ce = zend_hash_quick_find(class_table, Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_HASH_P(op1), (void **) &pce); + found_ce = zend_hash_quick_find(class_table, Z_STRVAL_P(op1), Z_STRSIZE_P(op1), Z_HASH_P(op1), (void **) &pce); if (found_ce == FAILURE) { if (!compile_time) { @@ -4607,7 +4607,7 @@ ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array ce->refcount++; /* Register the derived class */ - if (zend_hash_quick_add(class_table, Z_STRVAL_P(op2), Z_STRLEN_P(op2)+1, Z_HASH_P(op2), pce, sizeof(zend_class_entry *), NULL)==FAILURE) { + if (zend_hash_quick_add(class_table, Z_STRVAL_P(op2), Z_STRSIZE_P(op2)+1, Z_HASH_P(op2), pce, sizeof(zend_class_entry *), NULL)==FAILURE) { zend_error(E_COMPILE_ERROR, "Cannot redeclare class %s", ce->name); } return ce; @@ -4643,7 +4643,7 @@ void zend_do_early_binding(TSRMLS_D) /* {{{ */ zend_class_entry **pce; parent_name = &CONSTANT(fetch_class_opline->op2.constant); - if ((zend_lookup_class(Z_STRVAL_P(parent_name), Z_STRLEN_P(parent_name), &pce TSRMLS_CC) == FAILURE) || + if ((zend_lookup_class(Z_STRVAL_P(parent_name), Z_STRSIZE_P(parent_name), &pce TSRMLS_CC) == FAILURE) || ((CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES) && ((*pce)->type == ZEND_INTERNAL_CLASS))) { if (CG(compiler_options) & ZEND_COMPILE_DELAYED_BINDING) { @@ -4681,7 +4681,7 @@ void zend_do_early_binding(TSRMLS_D) /* {{{ */ return; } - zend_hash_quick_del(table, Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRLEN(CONSTANT(opline->op1.constant)), Z_HASH_P(&CONSTANT(opline->op1.constant))); + zend_hash_quick_del(table, Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRSIZE(CONSTANT(opline->op1.constant)), Z_HASH_P(&CONSTANT(opline->op1.constant))); zend_del_literal(CG(active_op_array), opline->op1.constant); zend_del_literal(CG(active_op_array), opline->op2.constant); MAKE_NOP(opline); @@ -4697,7 +4697,7 @@ ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array TSRMLS CG(in_compilation) = 1; while (opline_num != -1) { - if (zend_lookup_class(Z_STRVAL_P(op_array->opcodes[opline_num-1].op2.zv), Z_STRLEN_P(op_array->opcodes[opline_num-1].op2.zv), &pce TSRMLS_CC) == SUCCESS) { + if (zend_lookup_class(Z_STRVAL_P(op_array->opcodes[opline_num-1].op2.zv), Z_STRSIZE_P(op_array->opcodes[opline_num-1].op2.zv), &pce TSRMLS_CC) == SUCCESS) { do_bind_inherited_class(op_array, &op_array->opcodes[opline_num], EG(class_table), *pce, 0 TSRMLS_CC); } opline_num = op_array->opcodes[opline_num].result.opline_num; @@ -4982,7 +4982,7 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name /* Class name must not conflict with import names */ if (CG(current_import) && - zend_hash_find(CG(current_import), lcname, Z_STRLEN(class_name->u.constant)+1, (void**)&ns_name) == SUCCESS) { + zend_hash_find(CG(current_import), lcname, Z_STRSIZE(class_name->u.constant)+1, (void**)&ns_name) == SUCCESS) { error = 1; } @@ -4996,14 +4996,14 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC); *class_name = tmp; efree(lcname); - lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant)); + lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant)); } if (error) { - char *tmp = zend_str_tolower_dup(Z_STRVAL_PP(ns_name), Z_STRLEN_PP(ns_name)); + char *tmp = zend_str_tolower_dup(Z_STRVAL_PP(ns_name), Z_STRSIZE_PP(ns_name)); - if (Z_STRLEN_PP(ns_name) != Z_STRLEN(class_name->u.constant) || - memcmp(tmp, lcname, Z_STRLEN(class_name->u.constant))) { + if (Z_STRSIZE_PP(ns_name) != Z_STRSIZE(class_name->u.constant) || + memcmp(tmp, lcname, Z_STRSIZE(class_name->u.constant))) { zend_error(E_COMPILE_ERROR, "Cannot declare class %s because the name is already in use", Z_STRVAL(class_name->u.constant)); } efree(tmp); @@ -5011,8 +5011,8 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name new_class_entry = emalloc(sizeof(zend_class_entry)); new_class_entry->type = ZEND_USER_CLASS; - new_class_entry->name = zend_new_interned_string(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant) + 1, 1 TSRMLS_CC); - new_class_entry->name_length = Z_STRLEN(class_name->u.constant); + new_class_entry->name = zend_new_interned_string(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant) + 1, 1 TSRMLS_CC); + new_class_entry->name_length = Z_STRSIZE(class_name->u.constant); zend_initialize_class_data(new_class_entry, 1 TSRMLS_CC); new_class_entry->info.user.filename = zend_get_compiled_filename(TSRMLS_C); @@ -5040,7 +5040,7 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name opline->op1_type = IS_CONST; build_runtime_defined_function_key(&key, lcname, new_class_entry->name_length TSRMLS_CC); opline->op1.constant = zend_add_literal(CG(active_op_array), &key TSRMLS_CC); - Z_HASH_P(&CONSTANT(opline->op1.constant)) = zend_hash_func(Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRLEN(CONSTANT(opline->op1.constant))); + Z_HASH_P(&CONSTANT(opline->op1.constant)) = zend_hash_func(Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRSIZE(CONSTANT(opline->op1.constant))); opline->op2_type = IS_CONST; @@ -5059,7 +5059,7 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name LITERAL_STRINGL(opline->op2, lcname, new_class_entry->name_length, 0); CALCULATE_LITERAL_HASH(opline->op2.constant); - zend_hash_quick_update(CG(class_table), Z_STRVAL(key), Z_STRLEN(key), Z_HASH_P(&CONSTANT(opline->op1.constant)), &new_class_entry, sizeof(zend_class_entry *), NULL); + zend_hash_quick_update(CG(class_table), Z_STRVAL(key), Z_STRSIZE(key), Z_HASH_P(&CONSTANT(opline->op1.constant)), &new_class_entry, sizeof(zend_class_entry *), NULL); CG(active_class_entry) = new_class_entry; opline->result.var = get_temporary_variable(CG(active_op_array)); @@ -5158,7 +5158,7 @@ void zend_do_implements_interface(znode *interface_name TSRMLS_DC) /* {{{ */ CG(active_class_entry)->name); } - switch (zend_get_class_fetch_type(Z_STRVAL(interface_name->u.constant), Z_STRLEN(interface_name->u.constant))) { + switch (zend_get_class_fetch_type(Z_STRVAL(interface_name->u.constant), Z_STRSIZE(interface_name->u.constant))) { case ZEND_FETCH_CLASS_SELF: case ZEND_FETCH_CLASS_PARENT: case ZEND_FETCH_CLASS_STATIC: @@ -5190,7 +5190,7 @@ void zend_do_use_trait(znode *trait_name TSRMLS_DC) /* {{{ */ } - switch (zend_get_class_fetch_type(Z_STRVAL(trait_name->u.constant), Z_STRLEN(trait_name->u.constant))) { + switch (zend_get_class_fetch_type(Z_STRVAL(trait_name->u.constant), Z_STRSIZE(trait_name->u.constant))) { case ZEND_FETCH_CLASS_SELF: case ZEND_FETCH_CLASS_PARENT: case ZEND_FETCH_CLASS_STATIC: @@ -5511,10 +5511,10 @@ static zend_constant* zend_get_ct_const(const zval *const_name, int all_internal zend_constant *c = NULL; if (Z_STRVAL_P(const_name)[0] == '\\') { - if (zend_hash_find(EG(zend_constants), Z_STRVAL_P(const_name)+1, Z_STRLEN_P(const_name), (void **) &c) == FAILURE) { - char *lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name)+1, Z_STRLEN_P(const_name)-1); + if (zend_hash_find(EG(zend_constants), Z_STRVAL_P(const_name)+1, Z_STRSIZE_P(const_name), (void **) &c) == FAILURE) { + char *lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name)+1, Z_STRSIZE_P(const_name)-1); - if (zend_hash_find(EG(zend_constants), lookup_name, Z_STRLEN_P(const_name), (void **) &c)==SUCCESS) { + if (zend_hash_find(EG(zend_constants), lookup_name, Z_STRSIZE_P(const_name), (void **) &c)==SUCCESS) { if ((c->flags & CONST_CT_SUBST) && !(c->flags & CONST_CS)) { efree(lookup_name); return c; @@ -5523,10 +5523,10 @@ static zend_constant* zend_get_ct_const(const zval *const_name, int all_internal efree(lookup_name); return NULL; } - } else if (zend_hash_find(EG(zend_constants), Z_STRVAL_P(const_name), Z_STRLEN_P(const_name)+1, (void **) &c) == FAILURE) { - char *lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name), Z_STRLEN_P(const_name)); + } else if (zend_hash_find(EG(zend_constants), Z_STRVAL_P(const_name), Z_STRSIZE_P(const_name)+1, (void **) &c) == FAILURE) { + char *lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name), Z_STRSIZE_P(const_name)); - if (zend_hash_find(EG(zend_constants), lookup_name, Z_STRLEN_P(const_name)+1, (void **) &c)==SUCCESS) { + if (zend_hash_find(EG(zend_constants), lookup_name, Z_STRSIZE_P(const_name)+1, (void **) &c)==SUCCESS) { if ((c->flags & CONST_CT_SUBST) && !(c->flags & CONST_CS)) { efree(lookup_name); return c; @@ -5577,7 +5577,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con switch (mode) { case ZEND_CT: /* this is a class constant */ - type = zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRLEN(constant_container->u.constant)); + type = zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRSIZE(constant_container->u.constant)); if (ZEND_FETCH_CLASS_STATIC == type) { zend_error(E_ERROR, "\"static::\" is not allowed in compile-time constants"); @@ -5590,7 +5590,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con break; case ZEND_RT: if (constant_container->op_type == IS_CONST && - ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRLEN(constant_container->u.constant))) { + ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRSIZE(constant_container->u.constant))) { zend_resolve_class_name(constant_container, fetch_type, 1 TSRMLS_CC); } else { zend_do_fetch_class(&tmp, constant_container TSRMLS_CC); @@ -5622,7 +5622,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con /* only one that did not contain \ from the start can be converted to string if unknown */ switch (mode) { case ZEND_CT: - compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRLEN(constant_name->u.constant)); + compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRSIZE(constant_name->u.constant)); /* this is a namespace constant, or an unprefixed constant */ if (zend_constant_ct_subst(result, &constant_name->u.constant, 0 TSRMLS_CC)) { @@ -5639,7 +5639,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con result->u.constant.type = IS_CONSTANT | fetch_type; break; case ZEND_RT: - compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRLEN(constant_name->u.constant)); + compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRSIZE(constant_name->u.constant)); zend_resolve_non_class_name(constant_name, check_namespace TSRMLS_CC); @@ -5730,7 +5730,7 @@ void zend_do_init_array(znode *result, const znode *expr, const znode *offset, z ulong index; int numeric = 0; - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline->op2.constant)), Z_STRLEN(CONSTANT(opline->op2.constant))+1, index, numeric = 1); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline->op2.constant)), Z_STRSIZE(CONSTANT(opline->op2.constant))+1, index, numeric = 1); if (numeric) { zval_dtor(&CONSTANT(opline->op2.constant)); ZVAL_LONG(&CONSTANT(opline->op2.constant), index); @@ -5762,7 +5762,7 @@ void zend_do_add_array_element(znode *result, const znode *expr, const znode *of ulong index; int numeric = 0; - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline->op2.constant)), Z_STRLEN(CONSTANT(opline->op2.constant))+1, index, numeric = 1); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline->op2.constant)), Z_STRSIZE(CONSTANT(opline->op2.constant))+1, index, numeric = 1); if (numeric) { zval_dtor(&CONSTANT(opline->op2.constant)); ZVAL_LONG(&CONSTANT(opline->op2.constant), index); @@ -5788,10 +5788,10 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const znode case IS_CONSTANT: /* Ugly hack to denote that this value has a constant index */ Z_TYPE_P(element) |= IS_CONSTANT_INDEX; - Z_STRVAL(offset->u.constant) = erealloc(Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3); - Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+1] = Z_TYPE(offset->u.constant); - Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+2] = 0; - zend_symtable_update(result->u.constant.value.ht, Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3, &element, sizeof(zval *), NULL); + Z_STRVAL(offset->u.constant) = erealloc(Z_STRVAL(offset->u.constant), Z_STRSIZE(offset->u.constant)+3); + Z_STRVAL(offset->u.constant)[Z_STRSIZE(offset->u.constant)+1] = Z_TYPE(offset->u.constant); + Z_STRVAL(offset->u.constant)[Z_STRSIZE(offset->u.constant)+2] = 0; + zend_symtable_update(result->u.constant.value.ht, Z_STRVAL(offset->u.constant), Z_STRSIZE(offset->u.constant)+3, &element, sizeof(zval *), NULL); zval_dtor(&offset->u.constant); break; case IS_STRING: @@ -6014,7 +6014,7 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC) { znode value; - if (Z_STRLEN(varname->u.constant) == sizeof("this") - 1 && + if (Z_STRSIZE(varname->u.constant) == sizeof("this") - 1 && memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this") - 1) == 0) { zend_error(E_COMPILE_ERROR, "Cannot use $this as lexical variable"); return; @@ -6905,7 +6905,7 @@ void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRM if (prefix) { *result = *prefix; if (Z_TYPE(result->u.constant) == IS_STRING && - Z_STRLEN(result->u.constant) == 0) { + Z_STRSIZE(result->u.constant) == 0) { /* namespace\ */ if (CG(current_namespace)) { znode tmp; @@ -6921,7 +6921,7 @@ void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRM result->op_type = IS_CONST; Z_TYPE(result->u.constant) = IS_STRING; Z_STRVAL(result->u.constant) = NULL; - Z_STRLEN(result->u.constant) = 0; + Z_STRSIZE(result->u.constant) = 0; } /* prefix = result */ zend_do_build_full_name(NULL, result, name, 0 TSRMLS_CC); @@ -6968,10 +6968,10 @@ void zend_do_begin_namespace(const znode *name, zend_bool with_bracket TSRMLS_DC } if (name) { - lcname = zend_str_tolower_dup(Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)); - if (((Z_STRLEN(name->u.constant) == sizeof("self")-1) && + lcname = zend_str_tolower_dup(Z_STRVAL(name->u.constant), Z_STRSIZE(name->u.constant)); + if (((Z_STRSIZE(name->u.constant) == sizeof("self")-1) && !memcmp(lcname, "self", sizeof("self")-1)) || - ((Z_STRLEN(name->u.constant) == sizeof("parent")-1) && + ((Z_STRSIZE(name->u.constant) == sizeof("parent")-1) && !memcmp(lcname, "parent", sizeof("parent")-1))) { zend_error(E_COMPILE_ERROR, "Cannot use '%s' as namespace name", Z_STRVAL(name->u.constant)); } @@ -7027,7 +7027,7 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ /* The form "use A\B" is eqivalent to "use A\B as B". So we extract the last part of compound name to use as a new_name */ name = &tmp; - p = zend_memrchr(Z_STRVAL_P(ns), '\\', Z_STRLEN_P(ns)); + p = zend_memrchr(Z_STRVAL_P(ns), '\\', Z_STRSIZE_P(ns)); if (p) { ZVAL_STRING(name, p+1, 1); } else { @@ -7037,45 +7037,45 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ } } - lcname = zend_str_tolower_dup(Z_STRVAL_P(name), Z_STRLEN_P(name)); + lcname = zend_str_tolower_dup(Z_STRVAL_P(name), Z_STRSIZE_P(name)); - if (((Z_STRLEN_P(name) == sizeof("self")-1) && + if (((Z_STRSIZE_P(name) == sizeof("self")-1) && !memcmp(lcname, "self", sizeof("self")-1)) || - ((Z_STRLEN_P(name) == sizeof("parent")-1) && + ((Z_STRSIZE_P(name) == sizeof("parent")-1) && !memcmp(lcname, "parent", sizeof("parent")-1))) { zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because '%s' is a special class name", Z_STRVAL_P(ns), Z_STRVAL_P(name), Z_STRVAL_P(name)); } if (CG(current_namespace)) { /* Prefix import name with current namespace name to avoid conflicts with classes */ - char *c_ns_name = emalloc(Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name) + 1); + char *c_ns_name = emalloc(Z_STRSIZE_P(CG(current_namespace)) + 1 + Z_STRSIZE_P(name) + 1); - zend_str_tolower_copy(c_ns_name, Z_STRVAL_P(CG(current_namespace)), Z_STRLEN_P(CG(current_namespace))); - c_ns_name[Z_STRLEN_P(CG(current_namespace))] = '\\'; - memcpy(c_ns_name+Z_STRLEN_P(CG(current_namespace))+1, lcname, Z_STRLEN_P(name)+1); - if (zend_hash_exists(CG(class_table), c_ns_name, Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name)+1)) { - char *tmp2 = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns)); + zend_str_tolower_copy(c_ns_name, Z_STRVAL_P(CG(current_namespace)), Z_STRSIZE_P(CG(current_namespace))); + c_ns_name[Z_STRSIZE_P(CG(current_namespace))] = '\\'; + memcpy(c_ns_name+Z_STRSIZE_P(CG(current_namespace))+1, lcname, Z_STRSIZE_P(name)+1); + if (zend_hash_exists(CG(class_table), c_ns_name, Z_STRSIZE_P(CG(current_namespace)) + 1 + Z_STRSIZE_P(name)+1)) { + char *tmp2 = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRSIZE_P(ns)); - if (Z_STRLEN_P(ns) != Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name) || - memcmp(tmp2, c_ns_name, Z_STRLEN_P(ns))) { + if (Z_STRSIZE_P(ns) != Z_STRSIZE_P(CG(current_namespace)) + 1 + Z_STRSIZE_P(name) || + memcmp(tmp2, c_ns_name, Z_STRSIZE_P(ns))) { zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); } efree(tmp2); } efree(c_ns_name); - } else if (zend_hash_find(CG(class_table), lcname, Z_STRLEN_P(name)+1, (void**)&pce) == SUCCESS && + } else if (zend_hash_find(CG(class_table), lcname, Z_STRSIZE_P(name)+1, (void**)&pce) == SUCCESS && (*pce)->type == ZEND_USER_CLASS && (*pce)->info.user.filename == CG(compiled_filename)) { - char *c_tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns)); + char *c_tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRSIZE_P(ns)); - if (Z_STRLEN_P(ns) != Z_STRLEN_P(name) || - memcmp(c_tmp, lcname, Z_STRLEN_P(ns))) { + if (Z_STRSIZE_P(ns) != Z_STRSIZE_P(name) || + memcmp(c_tmp, lcname, Z_STRSIZE_P(ns))) { zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); } efree(c_tmp); } - if (zend_hash_add(CG(current_import), lcname, Z_STRLEN_P(name)+1, &ns, sizeof(zval*), NULL) != SUCCESS) { + if (zend_hash_add(CG(current_import), lcname, Z_STRSIZE_P(name)+1, &ns, sizeof(zval*), NULL) != SUCCESS) { zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); } if (warn) { @@ -7107,7 +7107,7 @@ void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */ tmp.op_type = IS_CONST; tmp.u.constant = *CG(current_namespace); - Z_STRVAL(tmp.u.constant) = zend_str_tolower_dup(Z_STRVAL(tmp.u.constant), Z_STRLEN(tmp.u.constant)); + Z_STRVAL(tmp.u.constant) = zend_str_tolower_dup(Z_STRVAL(tmp.u.constant), Z_STRSIZE(tmp.u.constant)); zend_do_build_namespace_name(&tmp, &tmp, name TSRMLS_CC); *name = tmp; } diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 21580d3d5f607..656d38bc02992 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -176,7 +176,7 @@ void clean_non_persistent_constants(TSRMLS_D) } -ZEND_API void zend_register_long_constant(const char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC) +ZEND_API void zend_register_long_constant(const char *name, zend_str_size_uint name_len, long lval, int flags, int module_number TSRMLS_DC) { zend_constant c; @@ -190,7 +190,7 @@ ZEND_API void zend_register_long_constant(const char *name, uint name_len, long } -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, zend_str_size_uint name_len, double dval, int flags, int module_number TSRMLS_DC) { zend_constant c; @@ -204,7 +204,7 @@ ZEND_API void zend_register_double_constant(const char *name, uint name_len, dou } -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, zend_str_size_uint name_len, char *strval, zend_str_size_uint strlen, int flags, int module_number TSRMLS_DC) { zend_constant c; @@ -219,12 +219,12 @@ ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, ch } -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, zend_str_size_uint name_len, char *strval, int flags, int module_number TSRMLS_DC) { zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number TSRMLS_CC); } -static int zend_get_special_constant(const char *name, uint name_len, zend_constant **c TSRMLS_DC) +static int zend_get_special_constant(const char *name, zend_str_size_uint name_len, zend_constant **c TSRMLS_DC) { int ret; static char haltoff[] = "__COMPILER_HALT_OFFSET__"; @@ -237,7 +237,7 @@ static int zend_get_special_constant(const char *name, uint name_len, zend_const /* Returned constants may be cached, so they have to be stored */ if (EG(scope) && EG(scope)->name) { - int const_name_len; + zend_str_size const_name_len; char *const_name; ALLOCA_FLAG(use_heap) @@ -249,7 +249,7 @@ static int zend_get_special_constant(const char *name, uint name_len, zend_const zend_hash_add(EG(zend_constants), const_name, const_name_len, (void*)&tmp, sizeof(zend_constant), (void**)c); memset(*c, 0, sizeof(zend_constant)); Z_STRVAL((**c).value) = estrndup(EG(scope)->name, EG(scope)->name_length); - Z_STRLEN((**c).value) = EG(scope)->name_length; + Z_STRSIZE((**c).value) = EG(scope)->name_length; Z_TYPE((**c).value) = IS_STRING; } free_alloca(const_name, use_heap); @@ -258,7 +258,7 @@ static int zend_get_special_constant(const char *name, uint name_len, zend_const zend_hash_add(EG(zend_constants), "\0__CLASS__", sizeof("\0__CLASS__"), (void*)&tmp, sizeof(zend_constant), (void**)c); memset(*c, 0, sizeof(zend_constant)); Z_STRVAL((**c).value) = estrndup("", 0); - Z_STRLEN((**c).value) = 0; + Z_STRSIZE((**c).value) = 0; Z_TYPE((**c).value) = IS_STRING; } } @@ -267,7 +267,7 @@ static int zend_get_special_constant(const char *name, uint name_len, zend_const !memcmp(name, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1)) { const char *cfilename; char *haltname; - int len, clen; + zend_str_size len, clen; cfilename = zend_get_executed_filename(TSRMLS_C); clen = strlen(cfilename); @@ -283,7 +283,7 @@ static int zend_get_special_constant(const char *name, uint name_len, zend_const } -ZEND_API int zend_get_constant(const char *name, uint name_len, zval *result TSRMLS_DC) +ZEND_API int zend_get_constant(const char *name, zend_str_size_uint name_len, zval *result TSRMLS_DC) { zend_constant *c; int retval = 1; @@ -312,7 +312,7 @@ ZEND_API int zend_get_constant(const char *name, uint name_len, zval *result TSR return retval; } -ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC) +ZEND_API int zend_get_constant_ex(const char *name, zend_str_size_uint name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC) { zend_constant *c; int retval = 1; @@ -330,8 +330,8 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result, if ((colon = zend_memrchr(name, ':', name_len)) && colon > name && (*(colon - 1) == ':')) { - int class_name_len = colon - name - 1; - int const_name_len = name_len - class_name_len - 2; + zend_str_size class_name_len = colon - name - 1; + zend_str_size const_name_len = name_len - class_name_len - 2; const char *constant_name = colon + 1; char *lcname; @@ -393,8 +393,8 @@ ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result, /* non-class constant */ if ((colon = zend_memrchr(name, '\\', name_len)) != NULL) { /* compound constant name */ - int prefix_len = colon - name; - int const_name_len = name_len - prefix_len - 1; + zend_str_size prefix_len = colon - name; + zend_str_size const_name_len = name_len - prefix_len - 1; const char *constant_name = colon + 1; char *lcname; int found_const = 0; @@ -452,26 +452,26 @@ zend_constant *zend_quick_get_constant(const zend_literal *key, ulong flags TSRM { zend_constant *c; - if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE) { + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRSIZE(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE) { key++; - if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE || + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRSIZE(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE || (c->flags & CONST_CS) != 0) { if ((flags & (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) == (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) { key++; - if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE) { + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRSIZE(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE) { key++; - if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE || + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRSIZE(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE || (c->flags & CONST_CS) != 0) { key--; - if (!zend_get_special_constant(Z_STRVAL(key->constant), Z_STRLEN(key->constant), &c TSRMLS_CC)) { + if (!zend_get_special_constant(Z_STRVAL(key->constant), Z_STRSIZE(key->constant), &c TSRMLS_CC)) { return NULL; } } } } else { key--; - if (!zend_get_special_constant(Z_STRVAL(key->constant), Z_STRLEN(key->constant), &c TSRMLS_CC)) { + if (!zend_get_special_constant(Z_STRVAL(key->constant), Z_STRSIZE(key->constant), &c TSRMLS_CC)) { return NULL; } } diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h index c7261946c826f..fd1270369539e 100644 --- a/Zend/zend_constants.h +++ b/Zend/zend_constants.h @@ -34,7 +34,7 @@ typedef struct _zend_constant { zval value; int flags; char *name; - uint name_len; + zend_str_size_uint name_len; int module_number; } zend_constant; @@ -60,12 +60,12 @@ int zend_startup_constants(TSRMLS_D); int zend_shutdown_constants(TSRMLS_D); void zend_register_standard_constants(TSRMLS_D); void clean_non_persistent_constants(TSRMLS_D); -ZEND_API int zend_get_constant(const char *name, uint name_len, zval *result TSRMLS_DC); -ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC); -ZEND_API void zend_register_long_constant(const char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC); -ZEND_API void zend_register_double_constant(const char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC); -ZEND_API void zend_register_string_constant(const char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC); -ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC); +ZEND_API int zend_get_constant(const char *name, zend_str_size_uint name_len, zval *result TSRMLS_DC); +ZEND_API int zend_get_constant_ex(const char *name, zend_str_size_uint name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC); +ZEND_API void zend_register_long_constant(const char *name, zend_str_size_uint name_len, long lval, int flags, int module_number TSRMLS_DC); +ZEND_API void zend_register_double_constant(const char *name, zend_str_size_uint name_len, double dval, int flags, int module_number TSRMLS_DC); +ZEND_API void zend_register_string_constant(const char *name, zend_str_size_uint name_len, char *strval, int flags, int module_number TSRMLS_DC); +ZEND_API void zend_register_stringl_constant(const char *name, zend_str_size_uint name_len, char *strval, zend_str_size_uint strlen, int flags, int module_number TSRMLS_DC); ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC); void zend_copy_constants(HashTable *target, HashTable *sourc); void copy_zend_constant(zend_constant *c); diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index f07c1135f0dea..59fbcc0055d89 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -356,7 +356,7 @@ ZEND_METHOD(error_exception, getSeverity) zend_error(E_WARNING, "Value for %s is no string", key); \ TRACE_APPEND_STR("[unknown]"); \ } else { \ - TRACE_APPEND_STRL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); \ + TRACE_APPEND_STRL(Z_STRVAL_PP(tmp), Z_STRSIZE_PP(tmp)); \ } \ } @@ -383,12 +383,12 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z case IS_STRING: { int l_added; TRACE_APPEND_CHR('\''); - if (Z_STRLEN_PP(arg) > 15) { + if (Z_STRSIZE_PP(arg) > 15) { TRACE_APPEND_STRL(Z_STRVAL_PP(arg), 15); TRACE_APPEND_STR("...', "); l_added = 15 + 6 + 1; /* +1 because of while (--l_added) */ } else { - l_added = Z_STRLEN_PP(arg); + l_added = Z_STRSIZE_PP(arg); TRACE_APPEND_STRL(Z_STRVAL_PP(arg), l_added); TRACE_APPEND_STR("', "); l_added += 3 + 1; @@ -494,7 +494,7 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg } else { line = 0; } - s_tmp = emalloc(Z_STRLEN_PP(file) + MAX_LENGTH_OF_LONG + 4 + 1); + s_tmp = emalloc(Z_STRSIZE_PP(file) + MAX_LENGTH_OF_LONG + 4 + 1); sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_PP(file), line); TRACE_APPEND_STRL(s_tmp, strlen(s_tmp)); efree(s_tmp); @@ -616,15 +616,15 @@ ZEND_METHOD(exception, __toString) trace = NULL; } - if (Z_STRLEN(message) > 0) { + if (Z_STRSIZE(message) > 0) { len = zend_spprintf(&str, 0, "exception '%s' with message '%s' in %s:%ld\nStack trace:\n%s%s%s", Z_OBJCE_P(exception)->name, Z_STRVAL(message), Z_STRVAL(file), Z_LVAL(line), - (trace && Z_STRLEN_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n", + (trace && Z_STRSIZE_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n", len ? "\n\nNext " : "", prev_str); } else { len = zend_spprintf(&str, 0, "exception '%s' in %s:%ld\nStack trace:\n%s%s%s", Z_OBJCE_P(exception)->name, Z_STRVAL(file), Z_LVAL(line), - (trace && Z_STRLEN_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n", + (trace && Z_STRSIZE_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n", len ? "\n\nNext " : "", prev_str); } efree(prev_str); @@ -819,7 +819,7 @@ ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* { line = zend_read_property(default_exception_ce, EG(exception), "line", sizeof("line")-1, 1 TSRMLS_CC); convert_to_string(file); - file = (Z_STRLEN_P(file) > 0) ? file : NULL; + file = (Z_STRSIZE_P(file) > 0) ? file : NULL; line = (Z_TYPE_P(line) == IS_LONG) ? line : NULL; } else { file = NULL; @@ -836,7 +836,7 @@ ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* { convert_to_string(file); convert_to_long(line); - 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)); + zend_error_va(severity, (Z_STRSIZE_P(file) > 0) ? Z_STRVAL_P(file) : NULL, Z_LVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str)); } else { zend_error(severity, "Uncaught exception '%s'", ce_exception->name); } diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 3c3dd8e3b0b57..50c19adc4a365 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -566,7 +566,7 @@ static inline void make_real_object(zval **object_ptr TSRMLS_DC) { if (Z_TYPE_PP(object_ptr) == IS_NULL || (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr) == 0) - || (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRLEN_PP(object_ptr) == 0) + || (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRSIZE_PP(object_ptr) == 0) ) { SEPARATE_ZVAL_IF_NOT_REF(object_ptr); zval_dtor(*object_ptr); @@ -684,7 +684,7 @@ static inline void zend_assign_to_object(zval **retval, zval **object_ptr, zval } if (Z_TYPE_P(object) == IS_NULL || (Z_TYPE_P(object) == IS_BOOL && Z_LVAL_P(object) == 0) || - (Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0)) { + (Z_TYPE_P(object) == IS_STRING && Z_STRSIZE_P(object) == 0)) { SEPARATE_ZVAL_IF_NOT_REF(object_ptr); object = *object_ptr; Z_ADDREF_P(object); @@ -774,24 +774,24 @@ static inline int zend_assign_to_string_offset(const temp_variable *T, const zva return 0; } - if (T->str_offset.offset >= Z_STRLEN_P(T->str_offset.str)) { + if (T->str_offset.offset >= Z_STRSIZE_P(T->str_offset.str)) { if (IS_INTERNED(Z_STRVAL_P(T->str_offset.str))) { char *tmp = (char *) emalloc(T->str_offset.offset+1+1); - memcpy(tmp, Z_STRVAL_P(T->str_offset.str), Z_STRLEN_P(T->str_offset.str)+1); + memcpy(tmp, Z_STRVAL_P(T->str_offset.str), Z_STRSIZE_P(T->str_offset.str)+1); Z_STRVAL_P(T->str_offset.str) = tmp; } else { Z_STRVAL_P(T->str_offset.str) = (char *) erealloc(Z_STRVAL_P(T->str_offset.str), T->str_offset.offset+1+1); } - memset(Z_STRVAL_P(T->str_offset.str) + Z_STRLEN_P(T->str_offset.str), + memset(Z_STRVAL_P(T->str_offset.str) + Z_STRSIZE_P(T->str_offset.str), ' ', - T->str_offset.offset - Z_STRLEN_P(T->str_offset.str)); + T->str_offset.offset - Z_STRSIZE_P(T->str_offset.str)); Z_STRVAL_P(T->str_offset.str)[T->str_offset.offset+1] = 0; - Z_STRLEN_P(T->str_offset.str) = T->str_offset.offset+1; + Z_STRSIZE_P(T->str_offset.str) = T->str_offset.offset+1; } else if (IS_INTERNED(Z_STRVAL_P(T->str_offset.str))) { - char *tmp = (char *) emalloc(Z_STRLEN_P(T->str_offset.str) + 1); + char *tmp = (char *) emalloc(Z_STRSIZE_P(T->str_offset.str) + 1); - memcpy(tmp, Z_STRVAL_P(T->str_offset.str), Z_STRLEN_P(T->str_offset.str) + 1); + memcpy(tmp, Z_STRVAL_P(T->str_offset.str), Z_STRSIZE_P(T->str_offset.str) + 1); Z_STRVAL_P(T->str_offset.str) = tmp; } @@ -1148,7 +1148,7 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container case IS_STRING: { zval tmp; - if (type != BP_VAR_UNSET && Z_STRLEN_P(container)==0) { + if (type != BP_VAR_UNSET && Z_STRSIZE_P(container)==0) { goto convert_to_array; } if (dim == NULL) { @@ -1164,7 +1164,7 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container switch(Z_TYPE_P(dim)) { /* case IS_LONG: */ case IS_STRING: - if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) { + if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRSIZE_P(dim), NULL, NULL, -1)) { break; } if (type != BP_VAR_UNSET) { @@ -1284,7 +1284,7 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval **cont switch(Z_TYPE_P(dim)) { /* case IS_LONG: */ case IS_STRING: - if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) { + if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRSIZE_P(dim), NULL, NULL, -1)) { break; } if (type != BP_VAR_IS) { @@ -1313,17 +1313,17 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval **cont INIT_PZVAL(ptr); Z_TYPE_P(ptr) = IS_STRING; - if (Z_LVAL_P(dim) < 0 || Z_STRLEN_P(container) <= Z_LVAL_P(dim)) { + if (Z_LVAL_P(dim) < 0 || Z_STRSIZE_P(container) <= Z_LVAL_P(dim)) { if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim)); } Z_STRVAL_P(ptr) = STR_EMPTY_ALLOC(); - Z_STRLEN_P(ptr) = 0; + Z_STRSIZE_P(ptr) = 0; } else { Z_STRVAL_P(ptr) = (char*)emalloc(2); Z_STRVAL_P(ptr)[0] = Z_STRVAL_P(container)[Z_LVAL_P(dim)]; Z_STRVAL_P(ptr)[1] = 0; - Z_STRLEN_P(ptr) = 1; + Z_STRSIZE_P(ptr) = 1; } AI_SET_PTR(result, ptr); return; @@ -1378,7 +1378,7 @@ static void zend_fetch_property_address(temp_variable *result, zval **container_ if (type != BP_VAR_UNSET && ((Z_TYPE_P(container) == IS_NULL || (Z_TYPE_P(container) == IS_BOOL && Z_LVAL_P(container)==0) || - (Z_TYPE_P(container) == IS_STRING && Z_STRLEN_P(container)==0)))) { + (Z_TYPE_P(container) == IS_STRING && Z_STRSIZE_P(container)==0)))) { if (!PZVAL_IS_REF(container)) { SEPARATE_ZVAL(container_ptr); container = *container_ptr; diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index bc4027b03757b..f247244431c18 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -492,11 +492,11 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco if (!zend_get_constant_ex(p->value.str.val, p->value.str.len, &const_value, scope, Z_REAL_TYPE_P(p) TSRMLS_CC)) { char *actual = Z_STRVAL_P(p); - if ((colon = (char*)zend_memrchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p)))) { + if ((colon = (char*)zend_memrchr(Z_STRVAL_P(p), ':', Z_STRSIZE_P(p)))) { zend_error(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(p)); - Z_STRLEN_P(p) -= ((colon - Z_STRVAL_P(p)) + 1); + Z_STRSIZE_P(p) -= ((colon - Z_STRVAL_P(p)) + 1); if (inline_change) { - colon = estrndup(colon, Z_STRLEN_P(p)); + colon = estrndup(colon, Z_STRSIZE_P(p)); str_efree(Z_STRVAL_P(p)); Z_STRVAL_P(p) = colon; } else { @@ -504,20 +504,20 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco } } else { char *save = actual, *slash; - zend_str_size actual_len = Z_STRLEN_P(p); + zend_str_size actual_len = Z_STRSIZE_P(p); if ((Z_TYPE_P(p) & IS_CONSTANT_UNQUALIFIED) && (slash = (char *)zend_memrchr(actual, '\\', actual_len))) { actual = slash + 1; actual_len -= (actual - Z_STRVAL_P(p)); if (inline_change) { actual = estrndup(actual, actual_len); Z_STRVAL_P(p) = actual; - Z_STRLEN_P(p) = actual_len; + Z_STRSIZE_P(p) = actual_len; } } if (actual[0] == '\\') { if (inline_change) { - memmove(Z_STRVAL_P(p), Z_STRVAL_P(p)+1, Z_STRLEN_P(p)); - --Z_STRLEN_P(p); + memmove(Z_STRVAL_P(p), Z_STRVAL_P(p)+1, Z_STRSIZE_P(p)); + --Z_STRSIZE_P(p); } else { ++actual; } @@ -545,7 +545,7 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco p->type = IS_STRING; if (!inline_change) { Z_STRVAL_P(p) = actual; - Z_STRLEN_P(p) = actual_len; + Z_STRSIZE_P(p) = actual_len; zval_copy_ctor(p); } } @@ -636,7 +636,7 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco switch (Z_TYPE(const_value)) { case IS_STRING: - ret = zend_symtable_update_current_key(Z_ARRVAL_P(p), Z_STRVAL(const_value), Z_STRLEN(const_value) + 1, HASH_UPDATE_KEY_IF_BEFORE); + ret = zend_symtable_update_current_key(Z_ARRVAL_P(p), Z_STRVAL(const_value), Z_STRSIZE(const_value) + 1, HASH_UPDATE_KEY_IF_BEFORE); break; case IS_BOOL: case IS_LONG: @@ -1028,7 +1028,7 @@ ZEND_API int zend_lookup_class_ex(const char *name, zend_str_size_int name_lengt if (key) { lc_name = Z_STRVAL(key->constant); - lc_length = Z_STRLEN(key->constant) + 1; + lc_length = Z_STRSIZE(key->constant) + 1; hash = key->hash_value; } else { if (name == NULL || !name_length) { @@ -1143,14 +1143,14 @@ ZEND_API int zend_eval_stringl(char *str, zend_str_size_int str_len, zval *retva int retval; if (retval_ptr) { - Z_STRLEN(pv) = str_len + sizeof("return ;") - 1; - Z_STRVAL(pv) = emalloc(Z_STRLEN(pv) + 1); + Z_STRSIZE(pv) = str_len + sizeof("return ;") - 1; + Z_STRVAL(pv) = emalloc(Z_STRSIZE(pv) + 1); memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1); memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, str, str_len); - Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';'; - Z_STRVAL(pv)[Z_STRLEN(pv)] = '\0'; + Z_STRVAL(pv)[Z_STRSIZE(pv) - 1] = ';'; + Z_STRVAL(pv)[Z_STRSIZE(pv)] = '\0'; } else { - Z_STRLEN(pv) = str_len; + Z_STRSIZE(pv) = str_len; Z_STRVAL(pv) = str; } Z_TYPE(pv) = IS_STRING; diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 1afa5d4ea8e6c..68944ce142ff1 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -1159,7 +1159,7 @@ ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, } else if (p->nKeyLength) { Z_TYPE_P(key) = IS_STRING; Z_STRVAL_P(key) = estrndup(p->arKey, p->nKeyLength - 1); - Z_STRLEN_P(key) = p->nKeyLength - 1; + Z_STRSIZE_P(key) = p->nKeyLength - 1; } else { Z_TYPE_P(key) = IS_LONG; Z_LVAL_P(key) = p->h; diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 2c74f20f6a426..9e8e828d840d8 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -205,9 +205,9 @@ ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int modu hashed_ini_entry->module_number = module_number; if ((zend_get_configuration_directive(p->name, p->name_length, &default_value)) == SUCCESS) { if (!hashed_ini_entry->on_modify - || hashed_ini_entry->on_modify(hashed_ini_entry, Z_STRVAL(default_value), Z_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->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->value = Z_STRVAL(default_value); - hashed_ini_entry->value_length = Z_STRLEN(default_value); + hashed_ini_entry->value_length = Z_STRSIZE(default_value); config_directive_success = 1; } } diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y index 901babad60aef..1fa70c6b541cc 100644 --- a/Zend/zend_ini_parser.y +++ b/Zend/zend_ini_parser.y @@ -81,10 +81,10 @@ static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2) break; } - Z_STRLEN_P(result) = zend_sprintf(str_result, "%d", i_result); - Z_STRVAL_P(result) = (char *) malloc(Z_STRLEN_P(result)+1); - memcpy(Z_STRVAL_P(result), str_result, Z_STRLEN_P(result)); - Z_STRVAL_P(result)[Z_STRLEN_P(result)] = 0; + Z_STRSIZE_P(result) = zend_sprintf(str_result, "%d", i_result); + Z_STRVAL_P(result) = (char *) malloc(Z_STRSIZE_P(result)+1); + memcpy(Z_STRVAL_P(result), str_result, Z_STRSIZE_P(result)); + Z_STRVAL_P(result)[Z_STRSIZE_P(result)] = 0; Z_TYPE_P(result) = IS_STRING; } /* }}} */ @@ -95,7 +95,7 @@ static void zend_ini_init_string(zval *result) { Z_STRVAL_P(result) = malloc(1); Z_STRVAL_P(result)[0] = 0; - Z_STRLEN_P(result) = 0; + Z_STRSIZE_P(result) = 0; Z_TYPE_P(result) = IS_STRING; } /* }}} */ @@ -104,12 +104,12 @@ static void zend_ini_init_string(zval *result) */ static void zend_ini_add_string(zval *result, zval *op1, zval *op2) { - int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); + zend_str_size length = Z_STRSIZE_P(op1) + Z_STRSIZE_P(op2); Z_STRVAL_P(result) = (char *) realloc(Z_STRVAL_P(op1), length+1); - memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); + memcpy(Z_STRVAL_P(result)+Z_STRSIZE_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op2)); Z_STRVAL_P(result)[length] = 0; - Z_STRLEN_P(result) = length; + Z_STRSIZE_P(result) = length; Z_TYPE_P(result) = IS_STRING; } /* }}} */ @@ -121,12 +121,12 @@ static void zend_ini_get_constant(zval *result, zval *name TSRMLS_DC) zval z_constant; /* If name contains ':' it is not a constant. Bug #26893. */ - if (!memchr(Z_STRVAL_P(name), ':', Z_STRLEN_P(name)) - && zend_get_constant(Z_STRVAL_P(name), Z_STRLEN_P(name), &z_constant TSRMLS_CC)) { + if (!memchr(Z_STRVAL_P(name), ':', Z_STRSIZE_P(name)) + && zend_get_constant(Z_STRVAL_P(name), Z_STRSIZE_P(name), &z_constant TSRMLS_CC)) { /* z_constant is emalloc()'d */ convert_to_string(&z_constant); - Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(z_constant), Z_STRLEN(z_constant)); - Z_STRLEN_P(result) = Z_STRLEN(z_constant); + Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(z_constant), Z_STRSIZE(z_constant)); + Z_STRSIZE_P(result) = Z_STRSIZE(z_constant); Z_TYPE_P(result) = Z_TYPE(z_constant); zval_dtor(&z_constant); free(Z_STRVAL_P(name)); @@ -144,14 +144,14 @@ static void zend_ini_get_var(zval *result, zval *name TSRMLS_DC) char *envvar; /* Fetch configuration option value */ - if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRLEN_P(name)+1, &curval) == SUCCESS) { - Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(curval), Z_STRLEN(curval)); - Z_STRLEN_P(result) = Z_STRLEN(curval); + if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRSIZE_P(name)+1, &curval) == SUCCESS) { + Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(curval), Z_STRSIZE(curval)); + Z_STRSIZE_P(result) = Z_STRSIZE(curval); /* ..or if not found, try ENV */ - } else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRLEN_P(name) TSRMLS_CC)) != NULL || + } else if ((envvar = zend_getenv(Z_STRVAL_P(name), Z_STRSIZE_P(name) TSRMLS_CC)) != NULL || (envvar = getenv(Z_STRVAL_P(name))) != NULL) { Z_STRVAL_P(result) = strdup(envvar); - Z_STRLEN_P(result) = strlen(envvar); + Z_STRSIZE_P(result) = strlen(envvar); } else { zend_ini_init_string(result); } @@ -163,7 +163,7 @@ static void zend_ini_get_var(zval *result, zval *name TSRMLS_DC) static void ini_error(char *msg) { char *error_buf; - int error_buf_len; + zend_str_size error_buf_len; char *currently_parsed_filename; TSRMLS_FETCH(); diff --git a/Zend/zend_ini_scanner.c b/Zend/zend_ini_scanner.c index 87ba664312712..792110254821c 100644 --- a/Zend/zend_ini_scanner.c +++ b/Zend/zend_ini_scanner.c @@ -57,7 +57,7 @@ #define yytext ((char*)SCNG(yy_text)) #define yyleng SCNG(yy_leng) #define yyless(x) do { YYCURSOR = (unsigned char*)yytext + x; \ - yyleng = (unsigned int)x; } while(0) + yyleng = (zend_str_size)x; } while(0) /* #define yymore() goto yymore_restart */ @@ -135,7 +135,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals; #define zend_ini_copy_value(retval, str, len) { \ Z_STRVAL_P(retval) = zend_strndup(str, len); \ - Z_STRLEN_P(retval) = len; \ + Z_STRSIZE_P(retval) = len; \ Z_TYPE_P(retval) = IS_STRING; \ } @@ -263,7 +263,7 @@ int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC) /* {{{ zend_ini_escape_string() */ -static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type TSRMLS_DC) +static void zend_ini_escape_string(zval *lval, char *str, zend_str_size_int len, char quote_type TSRMLS_DC) { register char *s, *t; char *end; @@ -272,7 +272,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty /* convert escape sequences */ s = t = Z_STRVAL_P(lval); - end = s + Z_STRLEN_P(lval); + end = s + Z_STRSIZE_P(lval); while (s < end) { if (*s == '\\') { @@ -291,7 +291,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty case '\\': case '$': *t++ = *s; - Z_STRLEN_P(lval)--; + Z_STRSIZE_P(lval)--; break; default: *t++ = '\\'; diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index 92fb08f02d837..cb59b5b4d259d 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -55,7 +55,7 @@ #define yytext ((char*)SCNG(yy_text)) #define yyleng SCNG(yy_leng) #define yyless(x) do { YYCURSOR = (unsigned char*)yytext + x; \ - yyleng = (unsigned int)x; } while(0) + yyleng = (zend_str_size)x; } while(0) /* #define yymore() goto yymore_restart */ @@ -133,7 +133,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals; #define zend_ini_copy_value(retval, str, len) { \ Z_STRVAL_P(retval) = zend_strndup(str, len); \ - Z_STRLEN_P(retval) = len; \ + Z_STRSIZE_P(retval) = len; \ Z_TYPE_P(retval) = IS_STRING; \ } @@ -261,7 +261,7 @@ int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC) /* {{{ zend_ini_escape_string() */ -static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type TSRMLS_DC) +static void zend_ini_escape_string(zval *lval, char *str, zend_str_size_int len, char quote_type TSRMLS_DC) { register char *s, *t; char *end; @@ -270,7 +270,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty /* convert escape sequences */ s = t = Z_STRVAL_P(lval); - end = s + Z_STRLEN_P(lval); + end = s + Z_STRSIZE_P(lval); while (s < end) { if (*s == '\\') { @@ -289,7 +289,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty case '\\': case '$': *t++ = *s; - Z_STRLEN_P(lval)--; + Z_STRSIZE_P(lval)--; break; default: *t++ = '\\'; diff --git a/Zend/zend_ini_scanner_defs.h b/Zend/zend_ini_scanner_defs.h index 57239549783be..287d7bc1fbb9f 100644 --- a/Zend/zend_ini_scanner_defs.h +++ b/Zend/zend_ini_scanner_defs.h @@ -1,13 +1,13 @@ -/* Generated by re2c 0.13.5 */ -#line 3 "Zend/zend_ini_scanner_defs.h" - -enum YYCONDTYPE { - yycINITIAL, - yycST_OFFSET, - yycST_SECTION_VALUE, - yycST_VALUE, - yycST_SECTION_RAW, - yycST_DOUBLE_QUOTES, - yycST_VARNAME, - yycST_RAW, -}; +/* Generated by re2c 0.13.5 */ +#line 3 "Zend/zend_ini_scanner_defs.h" + +enum YYCONDTYPE { + yycINITIAL, + yycST_OFFSET, + yycST_SECTION_VALUE, + yycST_VALUE, + yycST_SECTION_RAW, + yycST_DOUBLE_QUOTES, + yycST_VARNAME, + yycST_RAW, +}; diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 16751549b46c2..31cd261bc7af6 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -415,8 +415,8 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint zval_ptr_dtor(&retval); return FAILURE; case IS_STRING: - *buffer = (unsigned char*)estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); - *buf_len = Z_STRLEN_P(retval); + *buffer = (unsigned char*)estrndup(Z_STRVAL_P(retval), Z_STRSIZE_P(retval)); + *buf_len = Z_STRSIZE_P(retval); result = SUCCESS; break; default: /* failure */ diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 6a9a24a87ea72..534d178d89612 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -872,13 +872,13 @@ class_name: T_STATIC { $$.op_type = IS_CONST; ZVAL_STRINGL(&$$.u.constant, "static", sizeof("static")-1, 1);} | namespace_name { $$ = $1; } | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); $$ = $2; } + | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRSIZE($2.u.constant); $$ = $2; } ; fully_qualified_class_name: namespace_name { $$ = $1; } | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); $$ = $2; } + | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRSIZE($2.u.constant); $$ = $2; } ; @@ -947,7 +947,7 @@ static_scalar: /* compile-time evaluated scalars */ | static_class_name_scalar { $$ = $1; } | namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT, 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_CT, 0 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0 TSRMLS_CC); } + | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRSIZE($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0 TSRMLS_CC); } | '+' static_scalar { ZVAL_LONG(&$1.u.constant, 0); add_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } | '-' static_scalar { ZVAL_LONG(&$1.u.constant, 0); sub_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; Z_TYPE($$.u.constant) = IS_CONSTANT_ARRAY; } @@ -966,7 +966,7 @@ scalar: | class_constant { $$ = $1; } | namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 TSRMLS_CC); } | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_RT, 0 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); } + | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRSIZE($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); } | common_scalar { $$ = $1; } | '"' encaps_list '"' { $$ = $2; } | T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; } @@ -1231,7 +1231,7 @@ static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr) if (CG(parse_error) == 0) { char buffer[120]; const unsigned char *end, *str, *tok1 = NULL, *tok2 = NULL; - unsigned int len = 0, toklen = 0, yystr_len; + zend_str_size len = 0, toklen = 0, yystr_len; CG(parse_error) = 1; diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index fc373e7c34bdc..8040730ac79ce 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -280,7 +280,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui if (UNEXPECTED(Z_STRVAL_P(member)[0] == '\0')) { if (!silent) { - if (Z_STRLEN_P(member) == 0) { + if (Z_STRSIZE_P(member) == 0) { zend_error_noreturn(E_ERROR, "Cannot access empty property"); } else { zend_error_noreturn(E_ERROR, "Cannot access property started with '\\0'"); @@ -289,8 +289,8 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui return NULL; } property_info = NULL; - h = key ? key->hash_value : zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member) + 1); - if (zend_hash_quick_find(&ce->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &property_info)==SUCCESS) { + h = key ? key->hash_value : zend_get_hash_value(Z_STRVAL_P(member), Z_STRSIZE_P(member) + 1); + if (zend_hash_quick_find(&ce->properties_info, Z_STRVAL_P(member), Z_STRSIZE_P(member)+1, h, (void **) &property_info)==SUCCESS) { if (UNEXPECTED((property_info->flags & ZEND_ACC_SHADOW) != 0)) { /* if it's a shadow - go to access it's private */ property_info = NULL; @@ -320,7 +320,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui if (EG(scope) != ce && EG(scope) && is_derived_class(ce, EG(scope)) - && zend_hash_quick_find(&EG(scope)->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &scope_property_info)==SUCCESS + && zend_hash_quick_find(&EG(scope)->properties_info, Z_STRVAL_P(member), Z_STRSIZE_P(member)+1, h, (void **) &scope_property_info)==SUCCESS && scope_property_info->flags & ZEND_ACC_PRIVATE) { if (key) { CACHE_POLYMORPHIC_PTR(key->cache_slot, ce, scope_property_info); @@ -342,7 +342,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui } else { EG(std_property_info).flags = ZEND_ACC_PUBLIC; EG(std_property_info).name = Z_STRVAL_P(member); - EG(std_property_info).name_length = Z_STRLEN_P(member); + EG(std_property_info).name_length = Z_STRSIZE_P(member); EG(std_property_info).h = h; EG(std_property_info).ce = ce; EG(std_property_info).offset = -1; @@ -392,8 +392,8 @@ static int zend_get_property_guard(zend_object *zobj, zend_property_info *proper if (!property_info) { property_info = &info; info.name = Z_STRVAL_P(member); - info.name_length = Z_STRLEN_P(member); - info.h = zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member) + 1); + info.name_length = Z_STRSIZE_P(member); + info.h = zend_get_hash_value(Z_STRVAL_P(member), Z_STRSIZE_P(member) + 1); } else if(property_info->name[0] == '\0'){ const char *class_name = NULL, *prop_name = NULL; zend_unmangle_property_name(property_info->name, property_info->name_length, &class_name, &prop_name); @@ -498,7 +498,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, const zend_li } else { if (zobj->ce->__get && guard && guard->in_get == 1) { if (Z_STRVAL_P(member)[0] == '\0') { - if (Z_STRLEN_P(member) == 0) { + if (Z_STRSIZE_P(member) == 0) { zend_error(E_ERROR, "Cannot access empty property"); } else { zend_error(E_ERROR, "Cannot access property started with '\\0'"); @@ -616,7 +616,7 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, c } } else if (zobj->ce->__set && guard && guard->in_set == 1) { if (Z_STRVAL_P(member)[0] == '\0') { - if (Z_STRLEN_P(member) == 0) { + if (Z_STRSIZE_P(member) == 0) { zend_error(E_ERROR, "Cannot access empty property"); } else { zend_error(E_ERROR, "Cannot access property started with '\\0'"); @@ -834,7 +834,7 @@ static void zend_std_unset_property(zval *object, zval *member, const zend_liter zval_ptr_dtor(&object); } else if (zobj->ce->__unset && guard && guard->in_unset == 1) { if (Z_STRVAL_P(member)[0] == '\0') { - if (Z_STRLEN_P(member) == 0) { + if (Z_STRSIZE_P(member) == 0) { zend_error(E_ERROR, "Cannot access empty property"); } else { zend_error(E_ERROR, "Cannot access property started with '\\0'"); diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 9f570cccde623..ec5f8bc65239d 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -189,7 +189,7 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) /* {{{ */ char *strval; strval = Z_STRVAL_P(op); - if ((Z_TYPE_P(op)=is_numeric_string(strval, Z_STRLEN_P(op), &Z_LVAL_P(op), &Z_DVAL_P(op), 1)) == 0) { + if ((Z_TYPE_P(op)=is_numeric_string(strval, Z_STRSIZE_P(op), &Z_LVAL_P(op), &Z_DVAL_P(op), 1)) == 0) { ZVAL_LONG(op, 0); } STR_FREE(strval); @@ -222,7 +222,7 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) /* {{{ */ switch (Z_TYPE_P(op)) { \ case IS_STRING: \ { \ - if ((Z_TYPE(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL(holder), &Z_DVAL(holder), 1)) == 0) { \ + if ((Z_TYPE(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRSIZE_P(op), &Z_LVAL(holder), &Z_DVAL(holder), 1)) == 0) { \ ZVAL_LONG(&(holder), 0); \ } \ (op) = &(holder); \ @@ -305,8 +305,8 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) /* {{{ */ Z_LVAL(holder) = (Z_DVAL_P(op) ? 1 : 0); \ break; \ case IS_STRING: \ - if (Z_STRLEN_P(op) == 0 \ - || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { \ + if (Z_STRSIZE_P(op) == 0 \ + || (Z_STRSIZE_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { \ Z_LVAL(holder) = 0; \ } else { \ Z_LVAL(holder) = 1; \ @@ -534,8 +534,8 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */ { char *strval = Z_STRVAL_P(op); - if (Z_STRLEN_P(op) == 0 - || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { + if (Z_STRSIZE_P(op) == 0 + || (Z_STRSIZE_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { Z_LVAL_P(op) = 0; } else { Z_LVAL_P(op) = 1; @@ -579,7 +579,7 @@ ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC) /* {{{ */ case IS_DOUBLE: { TSRMLS_FETCH(); dval = Z_DVAL_P(op); - Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*H", (int) EG(precision), dval); + Z_STRSIZE_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*H", (int) EG(precision), dval); /* %H already handles removing trailing zeros from the fractional part, yay */ break; } @@ -598,17 +598,17 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ switch (Z_TYPE_P(op)) { case IS_NULL: Z_STRVAL_P(op) = STR_EMPTY_ALLOC(); - Z_STRLEN_P(op) = 0; + Z_STRSIZE_P(op) = 0; break; case IS_STRING: break; case IS_BOOL: if (Z_LVAL_P(op)) { Z_STRVAL_P(op) = estrndup_rel("1", 1); - Z_STRLEN_P(op) = 1; + Z_STRSIZE_P(op) = 1; } else { Z_STRVAL_P(op) = STR_EMPTY_ALLOC(); - Z_STRLEN_P(op) = 0; + Z_STRSIZE_P(op) = 0; } break; case IS_RESOURCE: { @@ -616,18 +616,18 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ TSRMLS_FETCH(); zend_list_delete(Z_LVAL_P(op)); - Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "Resource id #%ld", tmp); + Z_STRSIZE_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "Resource id #%ld", tmp); break; } case IS_LONG: lval = Z_LVAL_P(op); - Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%ld", lval); + Z_STRSIZE_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%ld", lval); break; case IS_DOUBLE: { TSRMLS_FETCH(); dval = Z_DVAL_P(op); - Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*G", (int) EG(precision), dval); + Z_STRSIZE_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*G", (int) EG(precision), dval); /* %G already handles removing trailing zeros from the fractional part, yay */ break; } @@ -635,7 +635,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ zend_error(E_NOTICE, "Array to string conversion"); zval_dtor(op); Z_STRVAL_P(op) = estrndup_rel("Array", sizeof("Array")-1); - Z_STRLEN_P(op) = sizeof("Array")-1; + Z_STRSIZE_P(op) = sizeof("Array")-1; break; case IS_OBJECT: { TSRMLS_FETCH(); @@ -649,7 +649,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ zend_error(E_NOTICE, "Object of class %s to string conversion", Z_OBJCE_P(op)->name); zval_dtor(op); Z_STRVAL_P(op) = estrndup_rel("Object", sizeof("Object")-1); - Z_STRLEN_P(op) = sizeof("Object")-1; + Z_STRSIZE_P(op) = sizeof("Object")-1; break; } default: @@ -1112,9 +1112,9 @@ ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */ zval op1_copy = *op1; Z_TYPE_P(result) = IS_STRING; - Z_STRVAL_P(result) = estrndup(Z_STRVAL(op1_copy), Z_STRLEN(op1_copy)); - Z_STRLEN_P(result) = Z_STRLEN(op1_copy); - for (i = 0; i < Z_STRLEN(op1_copy); i++) { + Z_STRVAL_P(result) = estrndup(Z_STRVAL(op1_copy), Z_STRSIZE(op1_copy)); + Z_STRSIZE_P(result) = Z_STRSIZE(op1_copy); + for (i = 0; i < Z_STRSIZE(op1_copy); i++) { Z_STRVAL_P(result)[i] = ~Z_STRVAL(op1_copy)[i]; } return SUCCESS; @@ -1138,7 +1138,7 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) / char *result_str; zend_str_size i, result_len; - if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { + if (Z_STRSIZE_P(op1) >= Z_STRSIZE_P(op2)) { longer = op1; shorter = op2; } else { @@ -1147,16 +1147,16 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) / } Z_TYPE_P(result) = IS_STRING; - result_len = Z_STRLEN_P(longer); - result_str = estrndup(Z_STRVAL_P(longer), Z_STRLEN_P(longer)); - for (i = 0; i < Z_STRLEN_P(shorter); i++) { + result_len = Z_STRSIZE_P(longer); + result_str = estrndup(Z_STRVAL_P(longer), Z_STRSIZE_P(longer)); + for (i = 0; i < Z_STRSIZE_P(shorter); i++) { result_str[i] |= Z_STRVAL_P(shorter)[i]; } if (result==op1) { STR_FREE(Z_STRVAL_P(result)); } Z_STRVAL_P(result) = result_str; - Z_STRLEN_P(result) = result_len; + Z_STRSIZE_P(result) = result_len; return SUCCESS; } @@ -1185,7 +1185,7 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) char *result_str; zend_str_size i, result_len; - if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { + if (Z_STRSIZE_P(op1) >= Z_STRSIZE_P(op2)) { longer = op1; shorter = op2; } else { @@ -1194,16 +1194,16 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) } Z_TYPE_P(result) = IS_STRING; - result_len = Z_STRLEN_P(shorter); - result_str = estrndup(Z_STRVAL_P(shorter), Z_STRLEN_P(shorter)); - for (i = 0; i < Z_STRLEN_P(shorter); i++) { + result_len = Z_STRSIZE_P(shorter); + result_str = estrndup(Z_STRVAL_P(shorter), Z_STRSIZE_P(shorter)); + for (i = 0; i < Z_STRSIZE_P(shorter); i++) { result_str[i] &= Z_STRVAL_P(longer)[i]; } if (result==op1) { STR_FREE(Z_STRVAL_P(result)); } Z_STRVAL_P(result) = result_str; - Z_STRLEN_P(result) = result_len; + Z_STRSIZE_P(result) = result_len; return SUCCESS; } @@ -1232,7 +1232,7 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) char *result_str; zend_str_size i, result_len; - if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { + if (Z_STRSIZE_P(op1) >= Z_STRSIZE_P(op2)) { longer = op1; shorter = op2; } else { @@ -1241,16 +1241,16 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) } Z_TYPE_P(result) = IS_STRING; - result_len = Z_STRLEN_P(shorter); - result_str = estrndup(Z_STRVAL_P(shorter), Z_STRLEN_P(shorter)); - for (i = 0; i < Z_STRLEN_P(shorter); i++) { + result_len = Z_STRSIZE_P(shorter); + result_str = estrndup(Z_STRVAL_P(shorter), Z_STRSIZE_P(shorter)); + for (i = 0; i < Z_STRSIZE_P(shorter); i++) { result_str[i] ^= Z_STRVAL_P(longer)[i]; } if (result==op1) { STR_FREE(Z_STRVAL_P(result)); } Z_STRVAL_P(result) = result_str; - Z_STRLEN_P(result) = result_len; + Z_STRSIZE_P(result) = result_len; return SUCCESS; } @@ -1312,12 +1312,12 @@ ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* must support result==op1 */ ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */ { - zend_str_size length = Z_STRLEN_P(op1) + 1; + zend_str_size length = Z_STRSIZE_P(op1) + 1; char *buf; if (IS_INTERNED(Z_STRVAL_P(op1))) { buf = (char *) emalloc(length + 1); - memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); + memcpy(buf, Z_STRVAL_P(op1), Z_STRSIZE_P(op1)); } else { buf = (char *) erealloc(Z_STRVAL_P(op1), length + 1); } @@ -1331,16 +1331,16 @@ ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) /* must support result==op1 */ ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */ { - zend_str_size length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); + zend_str_size length = Z_STRSIZE_P(op1) + Z_STRSIZE_P(op2); char *buf; if (IS_INTERNED(Z_STRVAL_P(op1))) { buf = (char *) emalloc(length+1); - memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); + memcpy(buf, Z_STRVAL_P(op1), Z_STRSIZE_P(op1)); } else { buf = (char *) erealloc(Z_STRVAL_P(op1), length+1); } - memcpy(buf + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); + memcpy(buf + Z_STRSIZE_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op2)); buf[length] = 0; ZVAL_STRINGL(result, buf, length, 0); return SUCCESS; @@ -1376,9 +1376,9 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{ op2 = &op2_copy; } if (result==op1 && !IS_INTERNED(Z_STRVAL_P(op1))) { /* special case, perform operations on result */ - zend_str_size res_len = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); + zend_str_size res_len = Z_STRSIZE_P(op1) + Z_STRSIZE_P(op2); - if (res_len < Z_STRLEN_P(op1) || res_len < Z_STRLEN_P(op2)) { + if (res_len < Z_STRSIZE_P(op1) || res_len < Z_STRSIZE_P(op2)) { efree(Z_STRVAL_P(result)); ZVAL_EMPTY_STRING(result); zend_error(E_ERROR, "String size overflow"); @@ -1386,15 +1386,15 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{ Z_STRVAL_P(result) = erealloc(Z_STRVAL_P(result), res_len+1); - memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(result), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); + memcpy(Z_STRVAL_P(result)+Z_STRSIZE_P(result), Z_STRVAL_P(op2), Z_STRSIZE_P(op2)); Z_STRVAL_P(result)[res_len]=0; - Z_STRLEN_P(result) = res_len; + Z_STRSIZE_P(result) = res_len; } else { - zend_str_size length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); + zend_str_size length = Z_STRSIZE_P(op1) + Z_STRSIZE_P(op2); char *buf = (char *) emalloc(length + 1); - memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); - memcpy(buf + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); + memcpy(buf, Z_STRVAL_P(op1), Z_STRSIZE_P(op1)); + memcpy(buf + Z_STRSIZE_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op2)); buf[length] = 0; ZVAL_STRINGL(result, buf, length, 0); } @@ -1576,11 +1576,11 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* { return SUCCESS; case TYPE_PAIR(IS_NULL, IS_STRING): - ZVAL_LONG(result, zend_binary_strcmp("", 0, Z_STRVAL_P(op2), Z_STRLEN_P(op2))); + ZVAL_LONG(result, zend_binary_strcmp("", 0, Z_STRVAL_P(op2), Z_STRSIZE_P(op2))); return SUCCESS; case TYPE_PAIR(IS_STRING, IS_NULL): - ZVAL_LONG(result, zend_binary_strcmp(Z_STRVAL_P(op1), Z_STRLEN_P(op1), "", 0)); + ZVAL_LONG(result, zend_binary_strcmp(Z_STRVAL_P(op1), Z_STRSIZE_P(op1), "", 0)); return SUCCESS; case TYPE_PAIR(IS_OBJECT, IS_NULL): @@ -1728,8 +1728,8 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) Z_LVAL_P(result) = (Z_DVAL_P(op1) == Z_DVAL_P(op2)); break; case IS_STRING: - Z_LVAL_P(result) = ((Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) - && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)))); + Z_LVAL_P(result) = ((Z_STRSIZE_P(op1) == Z_STRSIZE_P(op2)) + && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op1)))); break; case IS_ARRAY: Z_LVAL_P(result) = (Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) || @@ -1835,22 +1835,22 @@ ZEND_API zend_bool instanceof_function(const zend_class_entry *instance_ce, cons static void increment_string(zval *str) /* {{{ */ { int carry=0; - zend_str_size pos=Z_STRLEN_P(str)-1; + zend_str_size pos=Z_STRSIZE_P(str)-1; char *s=Z_STRVAL_P(str); char *t; int last=0; /* Shut up the compiler warning */ int ch; - if (Z_STRLEN_P(str) == 0) { + if (Z_STRSIZE_P(str) == 0) { STR_FREE(Z_STRVAL_P(str)); Z_STRVAL_P(str) = estrndup("1", sizeof("1")-1); - Z_STRLEN_P(str) = 1; + Z_STRSIZE_P(str) = 1; return; } if (IS_INTERNED(s)) { - s = (char*) emalloc(Z_STRLEN_P(str) + 1); - memcpy(s, Z_STRVAL_P(str), Z_STRLEN_P(str) + 1); + s = (char*) emalloc(Z_STRSIZE_P(str) + 1); + memcpy(s, Z_STRVAL_P(str), Z_STRSIZE_P(str) + 1); Z_STRVAL_P(str) = s; } @@ -1894,10 +1894,10 @@ static void increment_string(zval *str) /* {{{ */ } if (carry) { - t = (char *) emalloc(Z_STRLEN_P(str)+1+1); - memcpy(t+1, Z_STRVAL_P(str), Z_STRLEN_P(str)); - Z_STRLEN_P(str)++; - t[Z_STRLEN_P(str)] = '\0'; + t = (char *) emalloc(Z_STRSIZE_P(str)+1+1); + memcpy(t+1, Z_STRVAL_P(str), Z_STRSIZE_P(str)); + Z_STRSIZE_P(str)++; + t[Z_STRSIZE_P(str)] = '\0'; switch (last) { case NUMERIC: t[0] = '1'; @@ -1937,7 +1937,7 @@ ZEND_API int increment_function(zval *op1) /* {{{ */ long lval; double dval; - switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { + switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRSIZE_P(op1), &lval, &dval, 0)) { case IS_LONG: str_efree(Z_STRVAL_P(op1)); if (lval == LONG_MAX) { @@ -1998,12 +1998,12 @@ ZEND_API int decrement_function(zval *op1) /* {{{ */ Z_DVAL_P(op1) = Z_DVAL_P(op1) - 1; break; case IS_STRING: /* Like perl we only support string increment */ - if (Z_STRLEN_P(op1) == 0) { /* consider as 0 */ + if (Z_STRSIZE_P(op1) == 0) { /* consider as 0 */ STR_FREE(Z_STRVAL_P(op1)); ZVAL_LONG(op1, -1); break; } - switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { + switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRSIZE_P(op1), &lval, &dval, 0)) { case IS_LONG: STR_FREE(Z_STRVAL_P(op1)); if (lval == LONG_MIN) { @@ -2209,25 +2209,25 @@ ZEND_API zend_str_size_int zend_binary_strncasecmp_l(const char *s1, zend_str_si ZEND_API zend_str_size_int zend_binary_zval_strcmp(zval *s1, zval *s2) /* {{{ */ { - return zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); + return zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2)); } /* }}} */ ZEND_API zend_str_size_int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) /* {{{ */ { - return zend_binary_strncmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); + return zend_binary_strncmp(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2), Z_LVAL_P(s3)); } /* }}} */ ZEND_API zend_str_size_int zend_binary_zval_strcasecmp(zval *s1, zval *s2) /* {{{ */ { - return zend_binary_strcasecmp_l(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); + return zend_binary_strcasecmp_l(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2)); } /* }}} */ ZEND_API zend_str_size_int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) /* {{{ */ { - return zend_binary_strncasecmp_l(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); + return zend_binary_strncasecmp_l(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2), Z_LVAL_P(s3)); } /* }}} */ @@ -2238,8 +2238,8 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */ long lval1, lval2; double dval1, dval2; - if ((ret1=is_numeric_string_ex(Z_STRVAL_P(s1), Z_STRLEN_P(s1), &lval1, &dval1, 0, &oflow1)) && - (ret2=is_numeric_string_ex(Z_STRVAL_P(s2), Z_STRLEN_P(s2), &lval2, &dval2, 0, &oflow2))) { + if ((ret1=is_numeric_string_ex(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), &lval1, &dval1, 0, &oflow1)) && + (ret2=is_numeric_string_ex(Z_STRVAL_P(s2), Z_STRSIZE_P(s2), &lval2, &dval2, 0, &oflow2))) { #if ULONG_MAX == 0xFFFFFFFF if (oflow1 != 0 && oflow1 == oflow2 && dval1 - dval2 == 0. && ((oflow1 == 1 && dval1 > 9007199254740991. /*0x1FFFFFFFFFFFFF*/) @@ -2333,7 +2333,7 @@ ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC) /* {{{ */ { TSRMLS_FETCH(); - Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*G", (int) EG(precision), (double)Z_DVAL_P(op)); + Z_STRSIZE_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*G", (int) EG(precision), (double)Z_DVAL_P(op)); } /* }}} */ diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 5ea7cd285618d..147fe23551df0 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1026,7 +1026,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST| if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (OP1_TYPE != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -1040,7 +1040,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST| } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); FREE_OP1(); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -1055,10 +1055,10 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST| } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -1072,7 +1072,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST| /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -2302,7 +2302,7 @@ ZEND_VM_HANDLER(54, ZEND_ADD_CHAR, TMP|UNUSED, CONST) if (OP1_TYPE == IS_UNUSED) { /* Initialize for erealloc in add_char_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -2325,7 +2325,7 @@ ZEND_VM_HANDLER(55, ZEND_ADD_STRING, TMP|UNUSED, CONST) if (OP1_TYPE == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -2353,7 +2353,7 @@ ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP|UNUSED, TMP|VAR|CV) if (OP1_TYPE == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -2403,13 +2403,13 @@ ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMP|VAR|UNUSED|CV) if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -2445,7 +2445,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV) } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R); @@ -2518,7 +2518,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -2551,7 +2551,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS if (OP2_TYPE == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = GET_OP2_ZVAL_PTR(BP_VAR_R); @@ -2562,7 +2562,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -2635,7 +2635,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) function_name = (zval*)(opline->op2.literal+1); if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -2657,7 +2657,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); if (function_name_strval[0] == '\\') { function_name_strlen -= 1; lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); @@ -2716,7 +2716,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) } if (Z_TYPE_PP(obj) == IS_STRING) { - ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), NULL, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -2725,15 +2725,15 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) call->object = NULL; if (ce->get_static_method) { - call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC); + call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) TSRMLS_CC); } else { - call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); } } else { call->object = *obj; ce = call->called_scope = Z_OBJCE_PP(obj); - call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); if (UNEXPECTED(call->fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method)); } @@ -2781,9 +2781,9 @@ ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST) func_name = opline->op2.literal + 1; if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE) { + } else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRSIZE(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE) { func_name++; - if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE)) { + if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRSIZE(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -2815,7 +2815,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, CONST, ANY) if (CACHED_PTR(opline->op1.literal->cache_slot)) { EX(function_state).function = CACHED_PTR(opline->op1.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRLEN_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRSIZE_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", fname->value.str.val); } else { @@ -3002,7 +3002,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV) if (CACHED_PTR(opline->op1.literal->cache_slot)) { catch_ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC); + catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC); CACHE_PTR(opline->op1.literal->cache_slot, catch_ce); } @@ -3494,7 +3494,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) c = CACHED_PTR(opline->op2.literal->cache_slot); } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) { if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); + char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv)); if(!actual) { actual = Z_STRVAL_P(opline->op2.zv); } else { @@ -3502,7 +3502,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) } /* non-qualified constant - allow text substitution */ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); + ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -3531,7 +3531,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) } else if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -3548,7 +3548,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) } } - if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { + if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { zend_class_entry *old_scope = EG(scope); @@ -3564,7 +3564,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) } ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value); zval_copy_ctor(&EX_T(opline->result.var).tmp_var); - } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { + } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */ ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1); } else { @@ -3632,14 +3632,14 @@ ZEND_VM_C_LABEL(num_index): if (OP2_TYPE == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index)); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index)); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -3754,7 +3754,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) inc_filename = tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -3767,7 +3767,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); } else { @@ -3910,7 +3910,7 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (OP1_TYPE != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -3926,7 +3926,7 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -3982,17 +3982,17 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) if (OP2_TYPE == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_dim)); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_dim)); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) { zval_ptr_dtor(&offset); @@ -4418,7 +4418,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -4428,7 +4428,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -4502,15 +4502,15 @@ ZEND_VM_C_LABEL(num_index_prop): hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_prop)); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_prop)); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -4568,7 +4568,7 @@ ZEND_VM_C_LABEL(num_index_prop): if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -4580,11 +4580,11 @@ ZEND_VM_C_LABEL(num_index_prop): } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -4704,7 +4704,7 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY) efree(EG(error_reporting_ini_entry)->value); } EG(error_reporting_ini_entry)->value = Z_STRVAL(restored_error_reporting); - EG(error_reporting_ini_entry)->value_length = Z_STRLEN(restored_error_reporting); + EG(error_reporting_ini_entry)->value_length = Z_STRSIZE(restored_error_reporting); } else { zendi_zval_dtor(restored_error_reporting); } @@ -4879,8 +4879,8 @@ ZEND_VM_HANDLER(145, ZEND_DECLARE_INHERITED_CLASS_DELAYED, ANY, ANY) zend_class_entry **pce, **pce_orig; SAVE_OPLINE(); - if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE || - (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS && + if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE || + (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS && *pce != *pce_orig)) { do_bind_inherited_class(EX(op_array), opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC); } @@ -4954,7 +4954,7 @@ ZEND_VM_HANDLER(144, ZEND_ADD_INTERFACE, ANY, CONST) if (CACHED_PTR(opline->op2.literal->cache_slot)) { iface = CACHED_PTR(opline->op2.literal->cache_slot); } else { - iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(iface == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -4982,7 +4982,7 @@ ZEND_VM_HANDLER(154, ZEND_ADD_TRAIT, ANY, ANY) trait = CACHED_PTR(opline->op2.literal->cache_slot); } else { trait = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), - Z_STRLEN_P(opline->op2.zv), + Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(trait == NULL)) { @@ -5096,7 +5096,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) Z_TYPE(restored_error_reporting) = IS_LONG; Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting)); convert_to_string(&restored_error_reporting); - zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); + zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRSIZE(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); zendi_zval_dtor(restored_error_reporting); } EX(old_error_reporting) = NULL; @@ -5185,8 +5185,8 @@ ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST) zval_copy_ctor(&c.value); } c.flags = CONST_CS; /* non persistent, case sensetive */ - c.name = IS_INTERNED(Z_STRVAL_P(name)) ? Z_STRVAL_P(name) : zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); - c.name_len = Z_STRLEN_P(name)+1; + c.name = IS_INTERNED(Z_STRVAL_P(name)) ? Z_STRVAL_P(name) : zend_strndup(Z_STRVAL_P(name), Z_STRSIZE_P(name)); + c.name_len = Z_STRSIZE_P(name)+1; c.module_number = PHP_USER_CONSTANT; if (zend_register_constant(&c TSRMLS_CC) == FAILURE) { @@ -5205,7 +5205,7 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED) SAVE_OPLINE(); - if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) || + if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) || UNEXPECTED(op_array->type != ZEND_USER_FUNCTION)) { zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index a2da483595b63..deccf93bb849f 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -889,8 +889,8 @@ static int ZEND_FASTCALL ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER(ZEND zend_class_entry **pce, **pce_orig; SAVE_OPLINE(); - if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE || - (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS && + if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE || + (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS && *pce != *pce_orig)) { do_bind_inherited_class(EX(op_array), opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC); } @@ -944,7 +944,7 @@ static int ZEND_FASTCALL ZEND_ADD_TRAIT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) trait = CACHED_PTR(opline->op2.literal->cache_slot); } else { trait = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), - Z_STRLEN_P(opline->op2.zv), + Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(trait == NULL)) { @@ -1058,7 +1058,7 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER Z_TYPE(restored_error_reporting) = IS_LONG; Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting)); convert_to_string(&restored_error_reporting); - zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); + zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRSIZE(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); zendi_zval_dtor(restored_error_reporting); } EX(old_error_reporting) = NULL; @@ -1191,13 +1191,13 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLE if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -1220,7 +1220,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE function_name = (zval*)(opline->op2.literal+1); if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -1242,7 +1242,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); if (function_name_strval[0] == '\\') { function_name_strlen -= 1; lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); @@ -1301,7 +1301,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE } if (Z_TYPE_PP(obj) == IS_STRING) { - ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), NULL, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -1310,15 +1310,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE call->object = NULL; if (ce->get_static_method) { - call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC); + call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) TSRMLS_CC); } else { - call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); } } else { call->object = *obj; ce = call->called_scope = Z_OBJCE_PP(obj); - call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); if (UNEXPECTED(call->fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method)); } @@ -1366,9 +1366,9 @@ static int ZEND_FASTCALL ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPC func_name = opline->op2.literal + 1; if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE) { + } else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRSIZE(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE) { func_name++; - if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE)) { + if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRSIZE(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -1478,7 +1478,7 @@ static int ZEND_FASTCALL ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND if (CACHED_PTR(opline->op2.literal->cache_slot)) { iface = CACHED_PTR(opline->op2.literal->cache_slot); } else { - iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(iface == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -1515,13 +1515,13 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -1545,7 +1545,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H function_name = (zval*)(opline->op2.literal+1); if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -1567,7 +1567,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); if (function_name_strval[0] == '\\') { function_name_strlen -= 1; lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); @@ -1626,7 +1626,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H } if (Z_TYPE_PP(obj) == IS_STRING) { - ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), NULL, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -1635,15 +1635,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H call->object = NULL; if (ce->get_static_method) { - call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC); + call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) TSRMLS_CC); } else { - call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); } } else { call->object = *obj; ce = call->called_scope = Z_OBJCE_PP(obj); - call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); if (UNEXPECTED(call->fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method)); } @@ -1702,13 +1702,13 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -1732,7 +1732,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H function_name = (zval*)(opline->op2.literal+1); if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -1754,7 +1754,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); if (function_name_strval[0] == '\\') { function_name_strlen -= 1; lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); @@ -1813,7 +1813,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H } if (Z_TYPE_PP(obj) == IS_STRING) { - ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), NULL, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -1822,15 +1822,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H call->object = NULL; if (ce->get_static_method) { - call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC); + call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) TSRMLS_CC); } else { - call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); } } else { call->object = *obj; ce = call->called_scope = Z_OBJCE_PP(obj); - call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); if (UNEXPECTED(call->fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method)); } @@ -1889,13 +1889,13 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDL if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -1928,13 +1928,13 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -1957,7 +1957,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA function_name = (zval*)(opline->op2.literal+1); if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -1979,7 +1979,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); if (function_name_strval[0] == '\\') { function_name_strlen -= 1; lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); @@ -2038,7 +2038,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA } if (Z_TYPE_PP(obj) == IS_STRING) { - ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), NULL, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -2047,15 +2047,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA call->object = NULL; if (ce->get_static_method) { - call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC); + call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) TSRMLS_CC); } else { - call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); } } else { call->object = *obj; ce = call->called_scope = Z_OBJCE_PP(obj); - call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); if (UNEXPECTED(call->fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method)); } @@ -2311,7 +2311,7 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A if (CACHED_PTR(opline->op1.literal->cache_slot)) { EX(function_state).function = CACHED_PTR(opline->op1.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRLEN_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRSIZE_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", fname->value.str.val); } else { @@ -2654,7 +2654,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA inc_filename = tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -2667,7 +2667,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); } else { @@ -3361,7 +3361,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -3375,7 +3375,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -3390,10 +3390,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -3407,7 +3407,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -3560,7 +3560,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -3593,7 +3593,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( if (IS_CONST == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = opline->op2.zv; @@ -3604,7 +3604,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -3694,7 +3694,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO c = CACHED_PTR(opline->op2.literal->cache_slot); } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) { if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); + char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv)); if(!actual) { actual = Z_STRVAL_P(opline->op2.zv); } else { @@ -3702,7 +3702,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO } /* non-qualified constant - allow text substitution */ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); + ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -3731,7 +3731,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO } else if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -3748,7 +3748,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO } } - if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { + if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { zend_class_entry *old_scope = EG(scope); @@ -3764,7 +3764,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO } ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value); zval_copy_ctor(&EX_T(opline->result.var).tmp_var); - } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { + } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */ ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1); } else { @@ -3832,14 +3832,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_O if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -3917,7 +3917,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -3933,7 +3933,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -3991,7 +3991,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -4001,7 +4001,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -4064,8 +4064,8 @@ static int ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCOD zval_copy_ctor(&c.value); } c.flags = CONST_CS; /* non persistent, case sensetive */ - c.name = IS_INTERNED(Z_STRVAL_P(name)) ? Z_STRVAL_P(name) : zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); - c.name_len = Z_STRLEN_P(name)+1; + c.name = IS_INTERNED(Z_STRVAL_P(name)) ? Z_STRVAL_P(name) : zend_strndup(Z_STRVAL_P(name), Z_STRSIZE_P(name)); + c.name_len = Z_STRSIZE_P(name)+1; c.module_number = PHP_USER_CONSTANT; if (zend_register_constant(&c TSRMLS_CC) == FAILURE) { @@ -4547,7 +4547,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -4580,7 +4580,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE if (IS_TMP_VAR == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); @@ -4591,7 +4591,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -4725,14 +4725,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPC if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -5228,7 +5228,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -5242,7 +5242,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -5257,10 +5257,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -5274,7 +5274,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -5403,7 +5403,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -5436,7 +5436,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE if (IS_VAR == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); @@ -5447,7 +5447,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -5581,14 +5581,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPC if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -5666,7 +5666,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -5682,7 +5682,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -5740,7 +5740,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -5750,7 +5750,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -5970,7 +5970,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -5984,7 +5984,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -5999,10 +5999,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -6016,7 +6016,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -6119,7 +6119,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -6152,7 +6152,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER if (IS_UNUSED == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = NULL; @@ -6163,7 +6163,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -6282,14 +6282,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_ if (IS_UNUSED == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -6367,7 +6367,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -6383,7 +6383,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -6441,7 +6441,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_ if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -6451,7 +6451,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_ } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -6493,7 +6493,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER SAVE_OPLINE(); - if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) || + if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) || UNEXPECTED(op_array->type != ZEND_USER_FUNCTION)) { zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); } @@ -6975,7 +6975,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -7008,7 +7008,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN if (IS_CV == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC); @@ -7019,7 +7019,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -7098,7 +7098,7 @@ static int ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A if (CACHED_PTR(opline->op1.literal->cache_slot)) { catch_ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC); + catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC); CACHE_PTR(opline->op1.literal->cache_slot, catch_ce); } @@ -7212,14 +7212,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCO if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -7962,7 +7962,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND inc_filename = tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -7975,7 +7975,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); } else { @@ -8277,7 +8277,7 @@ static int ZEND_FASTCALL ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ efree(EG(error_reporting_ini_entry)->value); } EG(error_reporting_ini_entry)->value = Z_STRVAL(restored_error_reporting); - EG(error_reporting_ini_entry)->value_length = Z_STRLEN(restored_error_reporting); + EG(error_reporting_ini_entry)->value_length = Z_STRSIZE(restored_error_reporting); } else { zendi_zval_dtor(restored_error_reporting); } @@ -8721,7 +8721,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -8735,7 +8735,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_dtor(free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -8750,10 +8750,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -8767,7 +8767,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -8916,7 +8916,7 @@ static int ZEND_FASTCALL ZEND_ADD_CHAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDL if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_char_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -8939,7 +8939,7 @@ static int ZEND_FASTCALL ZEND_ADD_STRING_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAN if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -8974,7 +8974,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -9101,14 +9101,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPC if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -9186,7 +9186,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -9202,7 +9202,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -9260,7 +9260,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -9270,7 +9270,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -9777,7 +9777,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -9829,7 +9829,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -9958,14 +9958,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCOD if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -10461,7 +10461,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -10475,7 +10475,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_dtor(free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -10490,10 +10490,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -10507,7 +10507,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -10637,7 +10637,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -10689,7 +10689,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -10818,14 +10818,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -10903,7 +10903,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -10919,7 +10919,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -10977,7 +10977,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -10987,7 +10987,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -11207,7 +11207,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -11221,7 +11221,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_dtor(free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -11236,10 +11236,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -11253,7 +11253,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -11398,14 +11398,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OP if (IS_UNUSED == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -11483,7 +11483,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -11499,7 +11499,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -11557,7 +11557,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -11567,7 +11567,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -12074,7 +12074,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_A if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -12125,7 +12125,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_ } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -12252,14 +12252,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -13292,7 +13292,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND inc_filename = tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -13305,7 +13305,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); } else { @@ -14616,7 +14616,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -14630,7 +14630,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_ptr_dtor(&free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -14645,10 +14645,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -14662,7 +14662,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -15358,7 +15358,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -15430,7 +15430,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -15463,7 +15463,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE if (IS_CONST == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = opline->op2.zv; @@ -15474,7 +15474,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -15564,7 +15564,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE c = CACHED_PTR(opline->op2.literal->cache_slot); } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) { if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); + char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv)); if(!actual) { actual = Z_STRVAL_P(opline->op2.zv); } else { @@ -15572,7 +15572,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE } /* non-qualified constant - allow text substitution */ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); + ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -15601,7 +15601,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE } else if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -15618,7 +15618,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE } } - if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { + if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { zend_class_entry *old_scope = EG(scope); @@ -15634,7 +15634,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE } ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value); zval_copy_ctor(&EX_T(opline->result.var).tmp_var); - } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { + } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */ ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1); } else { @@ -15702,14 +15702,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPC if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -15787,7 +15787,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -15803,7 +15803,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -15859,17 +15859,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_CONST == IS_CV || IS_CONST == IS_VAR) { zval_ptr_dtor(&offset); @@ -16002,7 +16002,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16012,7 +16012,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -16086,15 +16086,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -16152,7 +16152,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -16164,11 +16164,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -17704,7 +17704,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -17777,7 +17777,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -17810,7 +17810,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND if (IS_TMP_VAR == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); @@ -17821,7 +17821,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -17955,14 +17955,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCOD if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -18036,17 +18036,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -18178,15 +18178,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -18244,7 +18244,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -18256,11 +18256,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -19217,7 +19217,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -19231,7 +19231,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_ptr_dtor(&free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -19246,10 +19246,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -19263,7 +19263,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -20015,7 +20015,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -20088,7 +20088,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -20121,7 +20121,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND if (IS_VAR == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); @@ -20132,7 +20132,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -20266,14 +20266,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -20351,7 +20351,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -20367,7 +20367,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -20423,17 +20423,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -20566,7 +20566,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -20576,7 +20576,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -20650,15 +20650,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -20716,7 +20716,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -20728,11 +20728,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -21207,7 +21207,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -21221,7 +21221,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_ptr_dtor(&free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -21236,10 +21236,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -21253,7 +21253,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -21524,7 +21524,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -21557,7 +21557,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z if (IS_UNUSED == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = NULL; @@ -21568,7 +21568,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -21687,14 +21687,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OP if (IS_UNUSED == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -21772,7 +21772,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -21788,7 +21788,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -21846,7 +21846,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -21856,7 +21856,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -23466,7 +23466,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_ } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -23538,7 +23538,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -23571,7 +23571,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ if (IS_CV == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC); @@ -23582,7 +23582,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -23715,14 +23715,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -23796,17 +23796,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_CV == IS_CV || IS_CV == IS_VAR) { zval_ptr_dtor(&offset); @@ -23938,15 +23938,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -24004,7 +24004,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -24016,11 +24016,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -25044,7 +25044,7 @@ static int ZEND_FASTCALL ZEND_ADD_CHAR_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HA if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_char_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -25067,7 +25067,7 @@ static int ZEND_FASTCALL ZEND_ADD_STRING_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_ if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -25102,7 +25102,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_obj_zval_ptr_unused(TSRMLS_C); @@ -25172,7 +25172,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC c = CACHED_PTR(opline->op2.literal->cache_slot); } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) { if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); + char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv)); if(!actual) { actual = Z_STRVAL_P(opline->op2.zv); } else { @@ -25180,7 +25180,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC } /* non-qualified constant - allow text substitution */ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); + ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -25209,7 +25209,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC } else if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -25226,7 +25226,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC } } - if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { + if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { zend_class_entry *old_scope = EG(scope); @@ -25242,7 +25242,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC } ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value); zval_copy_ctor(&EX_T(opline->result.var).tmp_var); - } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { + } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */ ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1); } else { @@ -25306,17 +25306,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_H if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_CONST == IS_CV || IS_CONST == IS_VAR) { zval_ptr_dtor(&offset); @@ -25446,15 +25446,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -25512,7 +25512,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -25524,11 +25524,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -26467,7 +26467,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDL if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -26519,7 +26519,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_obj_zval_ptr_unused(TSRMLS_C); @@ -26629,17 +26629,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -26769,15 +26769,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -26835,7 +26835,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -26847,11 +26847,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -27790,7 +27790,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDL if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -27842,7 +27842,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_obj_zval_ptr_unused(TSRMLS_C); @@ -27952,17 +27952,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -28092,15 +28092,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -28158,7 +28158,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -28170,11 +28170,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -29537,7 +29537,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLE if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -29588,7 +29588,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_obj_zval_ptr_unused(TSRMLS_C); @@ -29697,17 +29697,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAND if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_CV == IS_CV || IS_CV == IS_VAR) { zval_ptr_dtor(&offset); @@ -29837,15 +29837,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV( hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -29903,7 +29903,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV( if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -29915,11 +29915,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV( } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -30915,7 +30915,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL inc_filename = tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -30928,7 +30928,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); } else { @@ -32104,7 +32104,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -32118,7 +32118,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -32133,10 +32133,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -32150,7 +32150,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -32839,7 +32839,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); @@ -32966,14 +32966,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCO if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -33051,7 +33051,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -33067,7 +33067,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -33123,17 +33123,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_CONST == IS_CV || IS_CONST == IS_VAR) { zval_ptr_dtor(&offset); @@ -33264,7 +33264,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -33274,7 +33274,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -33348,15 +33348,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -33414,7 +33414,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -33426,11 +33426,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -34955,7 +34955,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_ } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); @@ -35084,14 +35084,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -35165,17 +35165,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -35305,15 +35305,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -35371,7 +35371,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -35383,11 +35383,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -36340,7 +36340,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -36354,7 +36354,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -36369,10 +36369,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -36386,7 +36386,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -37130,7 +37130,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_ } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); @@ -37259,14 +37259,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -37344,7 +37344,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -37360,7 +37360,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -37416,17 +37416,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -37557,7 +37557,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -37567,7 +37567,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -37641,15 +37641,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -37707,7 +37707,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -37719,11 +37719,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -38194,7 +38194,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -38208,7 +38208,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -38223,10 +38223,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -38240,7 +38240,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -38552,14 +38552,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPC if (IS_UNUSED == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -38637,7 +38637,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -38653,7 +38653,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -38711,7 +38711,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -38721,7 +38721,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -40300,7 +40300,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); @@ -40427,14 +40427,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_ if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -40508,17 +40508,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_CV == IS_CV || IS_CV == IS_VAR) { zval_ptr_dtor(&offset); @@ -40648,15 +40648,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -40714,7 +40714,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -40726,11 +40726,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c index 76f5c1b765866..b2e64267e9320 100644 --- a/ext/ereg/ereg.c +++ b/ext/ereg/ereg.c @@ -562,8 +562,8 @@ static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase) } if (Z_TYPE_PP(arg_pattern) == IS_STRING) { - if (Z_STRVAL_PP(arg_pattern) && Z_STRLEN_PP(arg_pattern)) { - pattern = estrndup(Z_STRVAL_PP(arg_pattern), Z_STRLEN_PP(arg_pattern)); + if (Z_STRVAL_PP(arg_pattern) && Z_STRSIZE_PP(arg_pattern)) { + pattern = estrndup(Z_STRVAL_PP(arg_pattern), Z_STRSIZE_PP(arg_pattern)); } else { pattern = STR_EMPTY_ALLOC(); } @@ -575,8 +575,8 @@ static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase) } if (Z_TYPE_PP(arg_replace) == IS_STRING) { - if (Z_STRVAL_PP(arg_replace) && Z_STRLEN_PP(arg_replace)) { - replace = estrndup(Z_STRVAL_PP(arg_replace), Z_STRLEN_PP(arg_replace)); + if (Z_STRVAL_PP(arg_replace) && Z_STRSIZE_PP(arg_replace)) { + replace = estrndup(Z_STRVAL_PP(arg_replace), Z_STRSIZE_PP(arg_replace)); } else { replace = STR_EMPTY_ALLOC(); } diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 7d34d9feb15a8..0516d742e4412 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -875,8 +875,8 @@ static int preg_do_repl_func(zval *function, char *subject, int *offsets, char * if (call_user_function_ex(EG(function_table), NULL, function, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) { convert_to_string_ex(&retval_ptr); - *result = estrndup(Z_STRVAL_P(retval_ptr), Z_STRLEN_P(retval_ptr)); - result_len = Z_STRLEN_P(retval_ptr); + *result = estrndup(Z_STRVAL_P(retval_ptr), Z_STRSIZE_P(retval_ptr)); + result_len = Z_STRSIZE_P(retval_ptr); zval_ptr_dtor(&retval_ptr); } else { if (!EG(exception)) { @@ -969,8 +969,8 @@ static int preg_do_eval(char *eval_str, int eval_str_len, char *subject, convert_to_string(&retval); /* Save the return value and its length */ - *result = estrndup(Z_STRVAL(retval), Z_STRLEN(retval)); - result_len = Z_STRLEN(retval); + *result = estrndup(Z_STRVAL(retval), Z_STRSIZE(retval)); + result_len = Z_STRSIZE(retval); /* Clean up */ zval_dtor(&retval); @@ -1048,7 +1048,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub } } else { replace = Z_STRVAL_P(replace_val); - replace_len = Z_STRLEN_P(replace_val); + replace_len = Z_STRSIZE_P(replace_val); replace_end = replace + replace_len; } @@ -1261,8 +1261,8 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, /* If regex is an array */ if (Z_TYPE_P(regex) == IS_ARRAY) { /* Duplicate subject string for repeated replacement */ - subject_value = estrndup(Z_STRVAL_PP(subject), Z_STRLEN_PP(subject)); - subject_len = Z_STRLEN_PP(subject); + subject_value = estrndup(Z_STRVAL_PP(subject), Z_STRSIZE_PP(subject)); + subject_len = Z_STRSIZE_PP(subject); *result_len = subject_len; zend_hash_internal_pointer_reset(Z_ARRVAL_P(regex)); @@ -1294,7 +1294,7 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, /* Do the actual replacement and put the result back into subject_value for further replacements. */ if ((result = php_pcre_replace(Z_STRVAL_PP(regex_entry), - Z_STRLEN_PP(regex_entry), + Z_STRSIZE_PP(regex_entry), subject_value, subject_len, replace_value, @@ -1316,9 +1316,9 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, return subject_value; } else { result = php_pcre_replace(Z_STRVAL_P(regex), - Z_STRLEN_P(regex), + Z_STRSIZE_P(regex), Z_STRVAL_PP(subject), - Z_STRLEN_PP(subject), + Z_STRSIZE_PP(subject), replace, is_callable_replace, result_len, @@ -1810,7 +1810,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return /* Perform the match */ count = pcre_exec(pce->re, extra, Z_STRVAL(subject), - Z_STRLEN(subject), 0, + Z_STRSIZE(subject), 0, 0, offsets, size_offsets); /* Check for too many substrings condition. */ diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index b65ccaa26d919..caeceaeb3e7cf 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -741,8 +741,8 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg string_write(str, "NULL", sizeof("NULL")-1); } else if (Z_TYPE_P(zv) == IS_STRING) { string_write(str, "'", sizeof("'")-1); - string_write(str, Z_STRVAL_P(zv), MIN(Z_STRLEN_P(zv), 15)); - if (Z_STRLEN_P(zv) > 15) { + string_write(str, Z_STRVAL_P(zv), MIN(Z_STRSIZE_P(zv), 15)); + if (Z_STRSIZE_P(zv) > 15) { string_write(str, "...", sizeof("...")-1); } string_write(str, "'", sizeof("'")-1); @@ -750,7 +750,7 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg string_write(str, "Array", sizeof("Array")-1); } else { zend_make_printable_zval(zv, &zv_copy, &use_copy); - string_write(str, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy)); + string_write(str, Z_STRVAL(zv_copy), Z_STRSIZE(zv_copy)); if (use_copy) { zval_dtor(&zv_copy); } @@ -2165,7 +2165,7 @@ ZEND_METHOD(reflection_parameter, __construct) unsigned int lcname_len; char *lcname; - lcname_len = Z_STRLEN_P(reference); + lcname_len = Z_STRSIZE_P(reference); lcname = zend_str_tolower_dup(Z_STRVAL_P(reference), lcname_len); if (zend_hash_find(EG(function_table), lcname, lcname_len + 1, (void**) &fptr) == FAILURE) { efree(lcname); @@ -2196,7 +2196,7 @@ ZEND_METHOD(reflection_parameter, __construct) ce = Z_OBJCE_PP(classref); } else { convert_to_string_ex(classref); - if (zend_lookup_class(Z_STRVAL_PP(classref), Z_STRLEN_PP(classref), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_PP(classref), Z_STRSIZE_PP(classref), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_PP(classref)); return; @@ -2205,7 +2205,7 @@ ZEND_METHOD(reflection_parameter, __construct) } convert_to_string_ex(method); - lcname_len = Z_STRLEN_PP(method); + lcname_len = Z_STRSIZE_PP(method); lcname = zend_str_tolower_dup(Z_STRVAL_PP(method), lcname_len); if (ce == zend_ce_closure && Z_TYPE_PP(classref) == IS_OBJECT && (lcname_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) @@ -2647,7 +2647,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValueConstantName) precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param); if (precv && (Z_TYPE_P(precv->op2.zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { - RETURN_STRINGL(Z_STRVAL_P(precv->op2.zv), Z_STRLEN_P(precv->op2.zv), 1); + RETURN_STRINGL(Z_STRVAL_P(precv->op2.zv), Z_STRSIZE_P(precv->op2.zv), 1); } } /* }}} */ @@ -2704,7 +2704,7 @@ ZEND_METHOD(reflection_method, __construct) /* Find the class entry */ switch (Z_TYPE_P(classname)) { case IS_STRING: - if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRSIZE_P(classname), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(classname)); if (classname == &ztmp) { @@ -3109,7 +3109,7 @@ ZEND_METHOD(reflection_function, inNamespace) RETURN_FALSE; } if (Z_TYPE_PP(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name))) + && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRSIZE_PP(name))) && backslash > Z_STRVAL_PP(name)) { RETURN_TRUE; @@ -3132,7 +3132,7 @@ ZEND_METHOD(reflection_function, getNamespaceName) RETURN_FALSE; } if (Z_TYPE_PP(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name))) + && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRSIZE_PP(name))) && backslash > Z_STRVAL_PP(name)) { RETURN_STRINGL(Z_STRVAL_PP(name), backslash - Z_STRVAL_PP(name), 1); @@ -3155,10 +3155,10 @@ ZEND_METHOD(reflection_function, getShortName) RETURN_FALSE; } if (Z_TYPE_PP(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name))) + && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRSIZE_PP(name))) && backslash > Z_STRVAL_PP(name)) { - RETURN_STRINGL(backslash + 1, Z_STRLEN_PP(name) - (backslash - Z_STRVAL_PP(name) + 1), 1); + RETURN_STRINGL(backslash + 1, Z_STRSIZE_PP(name) - (backslash - Z_STRVAL_PP(name) + 1), 1); } RETURN_ZVAL(*name, 1, 0); } @@ -3320,7 +3320,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob } } else { convert_to_string_ex(&argument); - if (zend_lookup_class(Z_STRVAL_P(argument), Z_STRLEN_P(argument), &ce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(argument), Z_STRSIZE_P(argument), &ce TSRMLS_CC) == FAILURE) { if (!EG(exception)) { zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(argument)); } @@ -4534,7 +4534,7 @@ ZEND_METHOD(reflection_class, isSubclassOf) switch(class_name->type) { case IS_STRING: - if (zend_lookup_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(class_name)); return; @@ -4579,7 +4579,7 @@ ZEND_METHOD(reflection_class, implementsInterface) switch(interface->type) { case IS_STRING: - if (zend_lookup_class(Z_STRVAL_P(interface), Z_STRLEN_P(interface), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(interface), Z_STRSIZE_P(interface), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Interface %s does not exist", Z_STRVAL_P(interface)); return; @@ -4686,7 +4686,7 @@ ZEND_METHOD(reflection_class, inNamespace) RETURN_FALSE; } if (Z_TYPE_PP(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name))) + && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRSIZE_PP(name))) && backslash > Z_STRVAL_PP(name)) { RETURN_TRUE; @@ -4709,7 +4709,7 @@ ZEND_METHOD(reflection_class, getNamespaceName) RETURN_FALSE; } if (Z_TYPE_PP(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name))) + && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRSIZE_PP(name))) && backslash > Z_STRVAL_PP(name)) { RETURN_STRINGL(Z_STRVAL_PP(name), backslash - Z_STRVAL_PP(name), 1); @@ -4732,10 +4732,10 @@ ZEND_METHOD(reflection_class, getShortName) RETURN_FALSE; } if (Z_TYPE_PP(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name))) + && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRSIZE_PP(name))) && backslash > Z_STRVAL_PP(name)) { - RETURN_STRINGL(backslash + 1, Z_STRLEN_PP(name) - (backslash - Z_STRVAL_PP(name) + 1), 1); + RETURN_STRINGL(backslash + 1, Z_STRSIZE_PP(name) - (backslash - Z_STRVAL_PP(name) + 1), 1); } RETURN_ZVAL(*name, 1, 0); } @@ -4793,7 +4793,7 @@ ZEND_METHOD(reflection_property, __construct) /* Find the class entry */ switch (Z_TYPE_P(classname)) { case IS_STRING: - if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRSIZE_P(classname), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(classname)); return; @@ -4853,7 +4853,7 @@ ZEND_METHOD(reflection_property, __construct) if (dynam_prop) { reference->prop.flags = ZEND_ACC_IMPLICIT_PUBLIC; reference->prop.name = Z_STRVAL_P(propname); - reference->prop.name_length = Z_STRLEN_P(propname); + reference->prop.name_length = Z_STRSIZE_P(propname); reference->prop.h = zend_get_hash_value(name_str, name_len+1); reference->prop.doc_comment = NULL; reference->prop.ce = ce; @@ -6081,9 +6081,9 @@ static zend_object_handlers *zend_std_obj_handlers; static void _reflection_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC) { if ((Z_TYPE_P(member) == IS_STRING) - && zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1) - && ((Z_STRLEN_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name"))) - || (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class"))))) + && zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STRVAL_P(member), Z_STRSIZE_P(member)+1) + && ((Z_STRSIZE_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name"))) + || (Z_STRSIZE_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class"))))) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot set read-only property %s::$%s", Z_OBJCE_P(object)->name, Z_STRVAL_P(member)); diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 35f4e5056bb45..7092af24fcba1 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -105,7 +105,7 @@ PHP_FUNCTION(class_parents) } if (Z_TYPE_P(obj) == IS_STRING) { - if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), Z_STRLEN_P(obj), autoload TSRMLS_CC))) { + if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), Z_STRSIZE_P(obj), autoload TSRMLS_CC))) { RETURN_FALSE; } } else { @@ -138,7 +138,7 @@ PHP_FUNCTION(class_implements) } if (Z_TYPE_P(obj) == IS_STRING) { - if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), Z_STRLEN_P(obj), autoload TSRMLS_CC))) { + if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), Z_STRSIZE_P(obj), autoload TSRMLS_CC))) { RETURN_FALSE; } } else { @@ -167,7 +167,7 @@ PHP_FUNCTION(class_uses) } if (Z_TYPE_P(obj) == IS_STRING) { - if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), Z_STRLEN_P(obj), autoload TSRMLS_CC))) { + if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), Z_STRSIZE_P(obj), autoload TSRMLS_CC))) { RETURN_FALSE; } } else { @@ -427,7 +427,7 @@ PHP_FUNCTION(spl_autoload_call) if (SPL_G(autoload_functions)) { int l_autoload_running = SPL_G(autoload_running); SPL_G(autoload_running) = 1; - class_name_len = Z_STRLEN_P(class_name); + class_name_len = Z_STRSIZE_P(class_name); lc_name = zend_str_tolower_dup(Z_STRVAL_P(class_name), class_name_len); zend_hash_internal_pointer_reset_ex(SPL_G(autoload_functions), &function_pos); while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions), &function_pos) == SUCCESS) { @@ -482,7 +482,7 @@ PHP_FUNCTION(spl_autoload_register) if (ZEND_NUM_ARGS()) { if (Z_TYPE_P(zcallable) == IS_STRING) { - if (Z_STRLEN_P(zcallable) == sizeof("spl_autoload_call") - 1) { + if (Z_STRSIZE_P(zcallable) == sizeof("spl_autoload_call") - 1) { if (!zend_binary_strcasecmp(Z_STRVAL_P(zcallable), sizeof("spl_autoload_call"), "spl_autoload_call", sizeof("spl_autoload_call"))) { if (do_throw) { zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Function spl_autoload_call() cannot be registered"); diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 1a417d0f5850a..78d160f365c3d 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2205,8 +2205,8 @@ static int spl_filesystem_file_read_line_ex(zval * this_ptr, spl_filesystem_obje } spl_filesystem_file_free_line(intern TSRMLS_CC); if (Z_TYPE_P(retval) == IS_STRING) { - intern->u.file.current_line = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); - intern->u.file.current_line_len = Z_STRLEN_P(retval); + intern->u.file.current_line = estrndup(Z_STRVAL_P(retval), Z_STRSIZE_P(retval)); + intern->u.file.current_line_len = Z_STRSIZE_P(retval); } else { MAKE_STD_ZVAL(intern->u.file.current_zval); ZVAL_ZVAL(intern->u.file.current_zval, retval, 1, 0); @@ -2228,13 +2228,13 @@ static int spl_filesystem_file_is_empty_line(spl_filesystem_object *intern TSRML } else if (intern->u.file.current_zval) { switch(Z_TYPE_P(intern->u.file.current_zval)) { case IS_STRING: - return Z_STRLEN_P(intern->u.file.current_zval) == 0; + return Z_STRSIZE_P(intern->u.file.current_zval) == 0; case IS_ARRAY: if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_CSV) && zend_hash_num_elements(Z_ARRVAL_P(intern->u.file.current_zval)) == 1) { zval ** first = Z_ARRVAL_P(intern->u.file.current_zval)->pListHead->pData; - return Z_TYPE_PP(first) == IS_STRING && Z_STRLEN_PP(first) == 0; + return Z_TYPE_PP(first) == IS_STRING && Z_STRSIZE_PP(first) == 0; } return zend_hash_num_elements(Z_ARRVAL_P(intern->u.file.current_zval)) == 0; case IS_NULL: diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c index ea2349f41e9dd..5cec25654dd31 100644 --- a/ext/spl/spl_engine.c +++ b/ext/spl/spl_engine.c @@ -47,7 +47,7 @@ PHPAPI long spl_offset_convert_to_long(zval *offset TSRMLS_DC) /* {{{ */ { switch (Z_TYPE_P(offset)) { case IS_STRING: - ZEND_HANDLE_NUMERIC(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, idx); + ZEND_HANDLE_NUMERIC(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, idx); break; case IS_DOUBLE: return (long)Z_DVAL_P(offset); diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 25b8b4c126eeb..c986ea08bf71f 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -1130,16 +1130,16 @@ SPL_METHOD(RecursiveTreeIterator, current) } spl_recursive_tree_iterator_get_postfix(object, &postfix TSRMLS_CC); - str_len = Z_STRLEN(prefix) + Z_STRLEN(entry) + Z_STRLEN(postfix); + str_len = Z_STRSIZE(prefix) + Z_STRSIZE(entry) + Z_STRSIZE(postfix); str = (char *) emalloc(str_len + 1U); ptr = str; - memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix)); - ptr += Z_STRLEN(prefix); - memcpy(ptr, Z_STRVAL(entry), Z_STRLEN(entry)); - ptr += Z_STRLEN(entry); - memcpy(ptr, Z_STRVAL(postfix), Z_STRLEN(postfix)); - ptr += Z_STRLEN(postfix); + memcpy(ptr, Z_STRVAL(prefix), Z_STRSIZE(prefix)); + ptr += Z_STRSIZE(prefix); + memcpy(ptr, Z_STRVAL(entry), Z_STRSIZE(entry)); + ptr += Z_STRSIZE(entry); + memcpy(ptr, Z_STRVAL(postfix), Z_STRSIZE(postfix)); + ptr += Z_STRSIZE(postfix); *ptr = 0; zval_dtor(&prefix); @@ -1187,16 +1187,16 @@ SPL_METHOD(RecursiveTreeIterator, key) spl_recursive_tree_iterator_get_prefix(object, &prefix TSRMLS_CC); spl_recursive_tree_iterator_get_postfix(object, &postfix TSRMLS_CC); - str_len = Z_STRLEN(prefix) + Z_STRLEN(key) + Z_STRLEN(postfix); + str_len = Z_STRSIZE(prefix) + Z_STRSIZE(key) + Z_STRSIZE(postfix); str = (char *) emalloc(str_len + 1U); ptr = str; - memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix)); - ptr += Z_STRLEN(prefix); - memcpy(ptr, Z_STRVAL(key), Z_STRLEN(key)); - ptr += Z_STRLEN(key); - memcpy(ptr, Z_STRVAL(postfix), Z_STRLEN(postfix)); - ptr += Z_STRLEN(postfix); + memcpy(ptr, Z_STRVAL(prefix), Z_STRSIZE(prefix)); + ptr += Z_STRSIZE(prefix); + memcpy(ptr, Z_STRVAL(key), Z_STRSIZE(key)); + ptr += Z_STRSIZE(key); + memcpy(ptr, Z_STRVAL(postfix), Z_STRSIZE(postfix)); + ptr += Z_STRSIZE(postfix); *ptr = 0; zval_dtor(&prefix); @@ -1966,10 +1966,10 @@ SPL_METHOD(RegexIterator, accept) zend_make_printable_zval(subject_ptr, &subject_copy, &use_copy); if (use_copy) { subject = Z_STRVAL(subject_copy); - subject_len = Z_STRLEN(subject_copy); + subject_len = Z_STRSIZE(subject_copy); } else { subject = Z_STRVAL_P(subject_ptr); - subject_len = Z_STRLEN_P(subject_ptr); + subject_len = Z_STRSIZE_P(subject_ptr); } switch (intern->u.regex.mode) @@ -2727,7 +2727,7 @@ SPL_METHOD(CachingIterator, __toString) return; } if (intern->u.caching.zstr) { - RETURN_STRINGL(Z_STRVAL_P(intern->u.caching.zstr), Z_STRLEN_P(intern->u.caching.zstr), 1); + RETURN_STRINGL(Z_STRVAL_P(intern->u.caching.zstr), Z_STRSIZE_P(intern->u.caching.zstr), 1); } else { RETURN_NULL(); } diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index 5d89566eec1fa..c0c37c25cc526 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -116,7 +116,7 @@ static char *spl_object_storage_get_hash(spl_SplObjectStorage *intern, zval *thi zend_call_method_with_1_params(&this, intern->std.ce, &intern->fptr_get_hash, "getHash", &rv, obj); if (rv) { if (Z_TYPE_P(rv) == IS_STRING) { - int hash_len = Z_STRLEN_P(rv); + int hash_len = Z_STRSIZE_P(rv); char *hash = emalloc((hash_len+1)*sizeof(char)); strncpy(hash, Z_STRVAL_P(rv), hash_len); hash[hash_len] = 0; @@ -1220,7 +1220,7 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_ add_index_zval(return_value, Z_LVAL_P(element->inf), retval); break; case IS_STRING: - add_assoc_zval_ex(return_value, Z_STRVAL_P(element->inf), Z_STRLEN_P(element->inf)+1U, retval); + add_assoc_zval_ex(return_value, Z_STRVAL_P(element->inf), Z_STRSIZE_P(element->inf)+1U, retval); break; default: zval_ptr_dtor(&retval); diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 631834c97c0f3..669f9beff6cb7 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -165,7 +165,7 @@ PHP_FUNCTION(assert) } compiled_string_description = zend_make_compiled_string_description("assert code" TSRMLS_CC); - if (zend_eval_stringl(myeval, Z_STRLEN_PP(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) { + if (zend_eval_stringl(myeval, Z_STRSIZE_PP(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) { efree(compiled_string_description); if (description_len == 0) { php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval); @@ -277,7 +277,7 @@ PHP_FUNCTION(assert_options) oldint = ASSERTG(active); if (ac == 2) { convert_to_string_ex(value); - zend_alter_ini_entry_ex("assert.active", sizeof("assert.active"), Z_STRVAL_PP(value), Z_STRLEN_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); + zend_alter_ini_entry_ex("assert.active", sizeof("assert.active"), Z_STRVAL_PP(value), Z_STRSIZE_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); } RETURN_LONG(oldint); break; @@ -286,7 +286,7 @@ PHP_FUNCTION(assert_options) oldint = ASSERTG(bail); if (ac == 2) { convert_to_string_ex(value); - zend_alter_ini_entry_ex("assert.bail", sizeof("assert.bail"), Z_STRVAL_PP(value), Z_STRLEN_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); + zend_alter_ini_entry_ex("assert.bail", sizeof("assert.bail"), Z_STRVAL_PP(value), Z_STRSIZE_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); } RETURN_LONG(oldint); break; @@ -295,7 +295,7 @@ PHP_FUNCTION(assert_options) oldint = ASSERTG(quiet_eval); if (ac == 2) { convert_to_string_ex(value); - zend_alter_ini_entry_ex("assert.quiet_eval", sizeof("assert.quiet_eval"), Z_STRVAL_PP(value), Z_STRLEN_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); + zend_alter_ini_entry_ex("assert.quiet_eval", sizeof("assert.quiet_eval"), Z_STRVAL_PP(value), Z_STRSIZE_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); } RETURN_LONG(oldint); break; @@ -304,7 +304,7 @@ PHP_FUNCTION(assert_options) oldint = ASSERTG(warning); if (ac == 2) { convert_to_string_ex(value); - zend_alter_ini_entry_ex("assert.warning", sizeof("assert.warning"), Z_STRVAL_PP(value), Z_STRLEN_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); + zend_alter_ini_entry_ex("assert.warning", sizeof("assert.warning"), Z_STRVAL_PP(value), Z_STRSIZE_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); } RETURN_LONG(oldint); break; diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 55326dbdd3c33..a0cb511d58dbb 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -214,12 +214,12 @@ PHP_MINIT_FUNCTION(dir) static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) { char *dirname; - int dir_len; + zend_str_size dir_len; zval *zcontext = NULL; php_stream_context *context = NULL; php_stream *dirp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|r", &dirname, &dir_len, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|r", &dirname, &dir_len, &zcontext) == FAILURE) { RETURN_NULL(); } @@ -292,9 +292,10 @@ PHP_FUNCTION(closedir) PHP_FUNCTION(chroot) { char *str; - int ret, str_len; + int ret; + zend_str_size str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { RETURN_FALSE; } @@ -323,9 +324,10 @@ PHP_FUNCTION(chroot) PHP_FUNCTION(chdir) { char *str; - int ret, str_len; + int ret; + zend_str_size str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P", &str, &str_len) == FAILURE) { RETURN_FALSE; } @@ -429,14 +431,14 @@ PHP_FUNCTION(glob) char *result; #endif char *pattern = NULL; - int pattern_len; + zend_str_size pattern_len; long flags = 0; glob_t globbuf; int n; int ret; zend_bool basedir_limit = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &pattern, &pattern_len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|l", &pattern, &pattern_len, &flags) == FAILURE) { return; } @@ -545,14 +547,14 @@ PHP_FUNCTION(glob) PHP_FUNCTION(scandir) { char *dirn; - int dirn_len; + zend_str_size dirn_len; long flags = 0; char **namelist; int n, i; zval *zcontext = NULL; php_stream_context *context = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lr", &dirn, &dirn_len, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|lr", &dirn, &dirn_len, &flags, &zcontext) == FAILURE) { return; } diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 7b783ca60f60f..a5f702fa41e7c 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -61,10 +61,11 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_ { FILE *fp; char *buf; - int l = 0, pclose_return; + zend_str_size l = 0; + int pclose_return; char *b, *d=NULL; php_stream *stream; - size_t buflen, bufl = 0; + zend_str_size buflen, bufl = 0; #if PHP_SIGCHILD void (*sig_handler)() = NULL; #endif @@ -116,7 +117,7 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_ /* strip trailing whitespaces */ l = bufl; while (l-- && isspace(((unsigned char *)buf)[l])); - if (l != (int)(bufl - 1)) { + if (l != (bufl - 1)) { bufl = l + 1; buf[bufl] = '\0'; } @@ -129,7 +130,7 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_ if ((type == 2 && buf != b) || type != 2) { l = bufl; while (l-- && isspace(((unsigned char *)buf)[l])); - if (l != (int)(bufl - 1)) { + if (l != (bufl - 1)) { bufl = l + 1; buf[bufl] = '\0'; } @@ -171,16 +172,16 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ { char *cmd; - int cmd_len; + zend_str_size cmd_len; zval *ret_code=NULL, *ret_array=NULL; int ret; if (mode) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/", &cmd, &cmd_len, &ret_code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|z/", &cmd, &cmd_len, &ret_code) == FAILURE) { RETURN_FALSE; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/", &cmd, &cmd_len, &ret_array, &ret_code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|z/z/", &cmd, &cmd_len, &ret_array, &ret_code) == FAILURE) { RETURN_FALSE; } } @@ -240,10 +241,10 @@ PHP_FUNCTION(passthru) */ PHPAPI char *php_escape_shell_cmd(char *str) { - register int x, y, l = strlen(str); + register zend_str_size x, y, l = strlen(str); char *cmd; char *p = NULL; - size_t estimate = (2 * l) + 1; + zend_str_size estimate = (2 * l) + 1; TSRMLS_FETCH(); @@ -331,9 +332,9 @@ PHPAPI char *php_escape_shell_cmd(char *str) */ PHPAPI char *php_escape_shell_arg(char *str) { - int x, y = 0, l = strlen(str); + zend_str_size x, y = 0, l = strlen(str); char *cmd; - size_t estimate = (4 * l) + 3; + zend_str_size estimate = (4 * l) + 3; TSRMLS_FETCH(); @@ -346,7 +347,7 @@ PHPAPI char *php_escape_shell_arg(char *str) #endif for (x = 0; x < l; x++) { - int mb_len = php_mblen(str + x, (l - x)); + zend_str_size mb_len = php_mblen(str + x, (l - x)); /* skip non-valid multibyte characters */ if (mb_len < 0) { @@ -396,10 +397,10 @@ PHPAPI char *php_escape_shell_arg(char *str) PHP_FUNCTION(escapeshellcmd) { char *command; - int command_len; + zend_str_size command_len; char *cmd = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &command, &command_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &command, &command_len) == FAILURE) { return; } @@ -417,10 +418,10 @@ PHP_FUNCTION(escapeshellcmd) PHP_FUNCTION(escapeshellarg) { char *argument; - int argument_len; + zend_str_size argument_len; char *cmd = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &argument, &argument_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &argument, &argument_len) == FAILURE) { return; } @@ -438,11 +439,11 @@ PHP_FUNCTION(shell_exec) FILE *in; size_t total_readbytes; char *command; - int command_len; + zend_str_size command_len; char *ret; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &command, &command_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &command, &command_len) == FAILURE) { return; } diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 2713d23f1d826..697bcdd1140e2 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -233,9 +233,9 @@ PHP_FUNCTION(disk_total_space) { double bytestotal; char *path; - int path_len; + zend_str_size path_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &path, &path_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P", &path, &path_len) == FAILURE) { return; } @@ -368,9 +368,9 @@ PHP_FUNCTION(disk_free_space) { double bytesfree; char *path; - int path_len; + zend_str_size path_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &path, &path_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P", &path, &path_len) == FAILURE) { return; } @@ -420,7 +420,7 @@ PHPAPI int php_get_gid_by_name(const char *name, gid_t *gid TSRMLS_DC) static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */ { char *filename; - int filename_len; + zend_str_size filename_len; zval *group; #if !defined(WINDOWS) gid_t gid; @@ -428,7 +428,7 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */ #endif php_stream_wrapper *wrapper; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pz/", &filename, &filename_len, &group) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Pz/", &filename, &filename_len, &group) == FAILURE) { RETURN_FALSE; } @@ -557,7 +557,7 @@ PHPAPI uid_t php_get_uid_by_name(const char *name, uid_t *uid TSRMLS_DC) static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */ { char *filename; - int filename_len; + zend_str_size filename_len; zval *user; #if !defined(WINDOWS) uid_t uid; @@ -565,7 +565,7 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */ #endif php_stream_wrapper *wrapper; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pz/", &filename, &filename_len, &user) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Pz/", &filename, &filename_len, &user) == FAILURE) { return; } @@ -667,13 +667,13 @@ PHP_FUNCTION(lchown) PHP_FUNCTION(chmod) { char *filename; - int filename_len; + zend_str_size filename_len; long mode; int ret; mode_t imode; php_stream_wrapper *wrapper; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl", &filename, &filename_len, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Pl", &filename, &filename_len, &mode) == FAILURE) { return; } @@ -713,7 +713,7 @@ PHP_FUNCTION(chmod) PHP_FUNCTION(touch) { char *filename; - int filename_len; + zend_str_size filename_len; long filetime = 0, fileatime = 0; int ret, argc = ZEND_NUM_ARGS(); FILE *file; @@ -721,7 +721,7 @@ PHP_FUNCTION(touch) struct utimbuf *newtime = &newtimebuf; php_stream_wrapper *wrapper; - if (zend_parse_parameters(argc TSRMLS_CC, "p|ll", &filename, &filename_len, &filetime, &fileatime) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "P|ll", &filename, &filename_len, &filetime, &fileatime) == FAILURE) { return; } @@ -800,7 +800,7 @@ PHP_FUNCTION(touch) /* {{{ php_clear_stat_cache() */ -PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, int filename_len TSRMLS_DC) +PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, zend_str_size_int filename_len TSRMLS_DC) { /* always clear CurrentStatFile and CurrentLStatFile even if filename is not NULL * as it may contain outdated data (e.g. "nlink" for a directory when deleting a file @@ -829,9 +829,9 @@ PHP_FUNCTION(clearstatcache) { zend_bool clear_realpath_cache = 0; char *filename = NULL; - int filename_len = 0; + zend_str_size filename_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|bp", &clear_realpath_cache, &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|bP", &clear_realpath_cache, &filename, &filename_len) == FAILURE) { return; } @@ -1080,9 +1080,9 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ #define FileFunction(name, funcnum) \ void name(INTERNAL_FUNCTION_PARAMETERS) { \ char *filename; \ - int filename_len; \ + zend_str_size filename_len; \ \ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { \ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P", &filename, &filename_len) == FAILURE) { \ return; \ } \ \ diff --git a/ext/standard/filters.c b/ext/standard/filters.c index 0a59039635881..0ceb37295b94a 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -265,7 +265,7 @@ static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zv while (zend_hash_get_current_data_ex(Z_ARRVAL_P(filterparams), (void **) &tmp, &pos) == SUCCESS) { convert_to_string_ex(tmp); smart_str_appendc(&tags_ss, '<'); - smart_str_appendl(&tags_ss, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); + smart_str_appendl(&tags_ss, Z_STRVAL_PP(tmp), Z_STRSIZE_PP(tmp)); smart_str_appendc(&tags_ss, '>'); zend_hash_move_forward_ex(Z_ARRVAL_P(filterparams), &pos); } @@ -275,7 +275,7 @@ static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zv convert_to_string_ex(&filterparams); tags_ss.c = Z_STRVAL_P(filterparams); - tags_ss.len = Z_STRLEN_P(filterparams); + tags_ss.len = Z_STRSIZE_P(filterparams); tags_ss.a = 0; } } @@ -1229,19 +1229,19 @@ static php_conv_err_t php_conv_get_string_prop_ex(const HashTable *ht, char **pr convert_to_string(&zt); - if (NULL == (*pretval = pemalloc(Z_STRLEN(zt) + 1, persistent))) { + if (NULL == (*pretval = pemalloc(Z_STRSIZE(zt) + 1, persistent))) { return PHP_CONV_ERR_ALLOC; } - *pretval_len = Z_STRLEN(zt); - memcpy(*pretval, Z_STRVAL(zt), Z_STRLEN(zt) + 1); + *pretval_len = Z_STRSIZE(zt); + memcpy(*pretval, Z_STRVAL(zt), Z_STRSIZE(zt) + 1); zval_dtor(&zt); } else { - if (NULL == (*pretval = pemalloc(Z_STRLEN_PP(tmpval) + 1, persistent))) { + if (NULL == (*pretval = pemalloc(Z_STRSIZE_PP(tmpval) + 1, persistent))) { return PHP_CONV_ERR_ALLOC; } - *pretval_len = Z_STRLEN_PP(tmpval); - memcpy(*pretval, Z_STRVAL_PP(tmpval), Z_STRLEN_PP(tmpval) + 1); + *pretval_len = Z_STRSIZE_PP(tmpval); + memcpy(*pretval, Z_STRVAL_PP(tmpval), Z_STRSIZE_PP(tmpval) + 1); } } else { return PHP_CONV_ERR_NOT_FOUND; diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 0035d204f6515..cf3e9d77cc6cb 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -418,7 +418,7 @@ php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC currarg = 1; - while (inposwops->label, "proxy", &tmpzval) == FAILURE || Z_TYPE_PP(tmpzval) != IS_STRING || - Z_STRLEN_PP(tmpzval) <= 0) { + Z_STRSIZE_PP(tmpzval) <= 0) { php_url_free(resource); return php_stream_open_wrapper_ex(path, mode, REPORT_ERRORS, NULL, context); } @@ -140,8 +140,8 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, use_ssl = 0; use_proxy = 1; - transport_len = Z_STRLEN_PP(tmpzval); - transport_string = estrndup(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval)); + transport_len = Z_STRSIZE_PP(tmpzval); + transport_string = estrndup(Z_STRVAL_PP(tmpzval), Z_STRSIZE_PP(tmpzval)); } else { /* Normal http request (possibly with proxy) */ @@ -161,10 +161,10 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, if (context && php_stream_context_get_option(context, wrapper->wops->label, "proxy", &tmpzval) == SUCCESS && Z_TYPE_PP(tmpzval) == IS_STRING && - Z_STRLEN_PP(tmpzval) > 0) { + Z_STRSIZE_PP(tmpzval) > 0) { use_proxy = 1; - transport_len = Z_STRLEN_PP(tmpzval); - transport_string = estrndup(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval)); + transport_len = Z_STRSIZE_PP(tmpzval); + transport_string = estrndup(Z_STRVAL_PP(tmpzval), Z_STRSIZE_PP(tmpzval)); } else { transport_len = spprintf(&transport_string, 0, "%s://%s:%d", use_ssl ? "ssl" : "tcp", resource->host, resource->port); } @@ -240,7 +240,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, } while (*s != 0); } } - } else if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval)) { + } else if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRSIZE_PP(tmpzval)) { s = Z_STRVAL_PP(tmpzval); do { while (*s == ' ' || *s == '\t') s++; @@ -321,16 +321,16 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, } if (context && php_stream_context_get_option(context, "http", "method", &tmpzval) == SUCCESS) { - if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval) > 0) { + if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRSIZE_PP(tmpzval) > 0) { /* As per the RFC, automatically redirected requests MUST NOT use other methods than * GET and HEAD unless it can be confirmed by the user */ if (!redirected - || (Z_STRLEN_PP(tmpzval) == 3 && memcmp("GET", Z_STRVAL_PP(tmpzval), 3) == 0) - || (Z_STRLEN_PP(tmpzval) == 4 && memcmp("HEAD",Z_STRVAL_PP(tmpzval), 4) == 0) + || (Z_STRSIZE_PP(tmpzval) == 3 && memcmp("GET", Z_STRVAL_PP(tmpzval), 3) == 0) + || (Z_STRSIZE_PP(tmpzval) == 4 && memcmp("HEAD",Z_STRVAL_PP(tmpzval), 4) == 0) ) { - scratch_len = strlen(path) + 29 + Z_STRLEN_PP(tmpzval); + scratch_len = strlen(path) + 29 + Z_STRSIZE_PP(tmpzval); scratch = emalloc(scratch_len); - strlcpy(scratch, Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval) + 1); + strlcpy(scratch, Z_STRVAL_PP(tmpzval), Z_STRSIZE_PP(tmpzval) + 1); strncat(scratch, " ", 1); } } @@ -407,7 +407,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, zend_hash_move_forward_ex(Z_ARRVAL_PP(tmpzval), &pos) ) { if (Z_TYPE_PP(tmpheader) == IS_STRING) { - smart_str_appendl(&tmpstr, Z_STRVAL_PP(tmpheader), Z_STRLEN_PP(tmpheader)); + smart_str_appendl(&tmpstr, Z_STRVAL_PP(tmpheader), Z_STRSIZE_PP(tmpheader)); smart_str_appendl(&tmpstr, "\r\n", sizeof("\r\n") - 1); } } @@ -418,9 +418,9 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, smart_str_free(&tmpstr); } } - if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval)) { + if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRSIZE_PP(tmpzval)) { /* Remove newlines and spaces from start and end php_trim will estrndup() */ - tmp = php_trim(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval), NULL, 0, NULL, 3 TSRMLS_CC); + tmp = php_trim(Z_STRVAL_PP(tmpzval), Z_STRSIZE_PP(tmpzval), NULL, 0, NULL, 3 TSRMLS_CC); } if (tmp && strlen(tmp) > 0) { char *s; @@ -602,9 +602,9 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, context && !(have_header & HTTP_HEADER_CONTENT_LENGTH) && php_stream_context_get_option(context, "http", "content", &tmpzval) == SUCCESS && - Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval) > 0 + Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRSIZE_PP(tmpzval) > 0 ) { - scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_PP(tmpzval)); + scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRSIZE_PP(tmpzval)); php_stream_write(stream, scratch, scratch_len); have_header |= HTTP_HEADER_CONTENT_LENGTH; } @@ -617,9 +617,9 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, /* Request content, such as for POST requests */ if (header_init && context && php_stream_context_get_option(context, "http", "content", &tmpzval) == SUCCESS && - Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval) > 0) { + Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRSIZE_PP(tmpzval) > 0) { if (!(have_header & HTTP_HEADER_CONTENT_LENGTH)) { - scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_PP(tmpzval)); + scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRSIZE_PP(tmpzval)); php_stream_write(stream, scratch, scratch_len); } if (!(have_header & HTTP_HEADER_TYPE)) { @@ -628,7 +628,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Content-type not specified assuming application/x-www-form-urlencoded"); } php_stream_write(stream, "\r\n", sizeof("\r\n")-1); - php_stream_write(stream, Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval)); + php_stream_write(stream, Z_STRVAL_PP(tmpzval), Z_STRSIZE_PP(tmpzval)); } else { php_stream_write(stream, "\r\n", sizeof("\r\n")-1); } diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c index f854fddf49b0a..35764d880110a 100644 --- a/ext/standard/incomplete_class.c +++ b/ext/standard/incomplete_class.c @@ -92,7 +92,7 @@ static int incomplete_class_has_property(zval *object, zval *member, int check_e } /* }}} */ -static union _zend_function *incomplete_class_get_method(zval **object, char *method, int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */ +static union _zend_function *incomplete_class_get_method(zval **object, char *method, zend_str_size_int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */ { incomplete_class_message(*object, E_ERROR TSRMLS_CC); return NULL; @@ -135,7 +135,7 @@ PHPAPI zend_class_entry *php_create_incomplete_class(TSRMLS_D) /* {{{ php_lookup_class_name */ -PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen) +PHPAPI char *php_lookup_class_name(zval *object, zend_str_size_uint *nlen) { zval **val; char *retval = NULL; @@ -145,10 +145,10 @@ PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen) object_properties = Z_OBJPROP_P(object); if (zend_hash_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER), (void **) &val) == SUCCESS) { - retval = estrndup(Z_STRVAL_PP(val), Z_STRLEN_PP(val)); + retval = estrndup(Z_STRVAL_PP(val), Z_STRSIZE_PP(val)); if (nlen) { - *nlen = Z_STRLEN_PP(val); + *nlen = Z_STRSIZE_PP(val); } } @@ -158,7 +158,7 @@ PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen) /* {{{ php_store_class_name */ -PHPAPI void php_store_class_name(zval *object, const char *name, zend_uint len) +PHPAPI void php_store_class_name(zval *object, const char *name, zend_str_size_uint len) { zval *val; TSRMLS_FETCH(); @@ -167,7 +167,7 @@ PHPAPI void php_store_class_name(zval *object, const char *name, zend_uint len) Z_TYPE_P(val) = IS_STRING; Z_STRVAL_P(val) = estrndup(name, len); - Z_STRLEN_P(val) = len; + Z_STRSIZE_P(val) = len; zend_hash_update(Z_OBJPROP_P(object), MAGIC_MEMBER, sizeof(MAGIC_MEMBER), &val, sizeof(val), NULL); } diff --git a/ext/standard/info.c b/ext/standard/info.c index 32ef94e599fa3..44f9e43e8806a 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -248,10 +248,10 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) } if (!sapi_module.phpinfo_as_text) { - if (Z_STRLEN(tmp2) == 0) { + if (Z_STRSIZE(tmp2) == 0) { php_info_print("no value"); } else { - php_info_print_html_esc(Z_STRVAL(tmp2), Z_STRLEN(tmp2)); + php_info_print_html_esc(Z_STRVAL(tmp2), Z_STRSIZE(tmp2)); } } else { php_info_print(Z_STRVAL(tmp2)); diff --git a/ext/standard/pack.c b/ext/standard/pack.c index 672c0652219b0..d742f2cc5358a 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -126,7 +126,7 @@ PHP_FUNCTION(pack) convert_to_string_ex(argv[0]); format = Z_STRVAL_PP(argv[0]); - formatlen = Z_STRLEN_PP(argv[0]); + formatlen = Z_STRSIZE_PP(argv[0]); /* We have a maximum of format codes to deal with */ formatcodes = safe_emalloc(formatlen, sizeof(*formatcodes), 0); @@ -186,7 +186,7 @@ PHP_FUNCTION(pack) SEPARATE_ZVAL(argv[currentarg]); } convert_to_string_ex(argv[currentarg]); - arg = Z_STRLEN_PP(argv[currentarg]); + arg = Z_STRSIZE_PP(argv[currentarg]); if (code == 'Z') { /* add one because Z is always NUL-terminated: * pack("Z*", "aa") === "aa\0" @@ -332,7 +332,7 @@ PHP_FUNCTION(pack) } convert_to_string_ex(val); memcpy(&output[outputpos], Z_STRVAL_PP(val), - (Z_STRLEN_PP(val) < arg_cp) ? Z_STRLEN_PP(val) : arg_cp); + (Z_STRSIZE_PP(val) < arg_cp) ? Z_STRSIZE_PP(val) : arg_cp); outputpos += arg; break; } @@ -350,9 +350,9 @@ PHP_FUNCTION(pack) convert_to_string_ex(val); v = Z_STRVAL_PP(val); outputpos--; - if(arg > Z_STRLEN_PP(val)) { + if(arg > Z_STRSIZE_PP(val)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: not enough characters in string", code); - arg = Z_STRLEN_PP(val); + arg = Z_STRSIZE_PP(val); } while (arg-- > 0) { diff --git a/ext/standard/password.c b/ext/standard/password.c index 212799100c303..81e8ad54ef348 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -358,8 +358,8 @@ PHP_FUNCTION(password_hash) size_t buffer_len; switch (Z_TYPE_PP(option_buffer)) { case IS_STRING: - buffer = estrndup(Z_STRVAL_PP(option_buffer), Z_STRLEN_PP(option_buffer)); - buffer_len_int = Z_STRLEN_PP(option_buffer); + buffer = estrndup(Z_STRVAL_PP(option_buffer), Z_STRSIZE_PP(option_buffer)); + buffer_len_int = Z_STRSIZE_PP(option_buffer); break; case IS_LONG: case IS_DOUBLE: @@ -368,8 +368,8 @@ PHP_FUNCTION(password_hash) MAKE_COPY_ZVAL(option_buffer, &cast_option_buffer); convert_to_string(&cast_option_buffer); if (Z_TYPE(cast_option_buffer) == IS_STRING) { - buffer = estrndup(Z_STRVAL(cast_option_buffer), Z_STRLEN(cast_option_buffer)); - buffer_len_int = Z_STRLEN(cast_option_buffer); + buffer = estrndup(Z_STRVAL(cast_option_buffer), Z_STRSIZE(cast_option_buffer)); + buffer_len_int = Z_STRSIZE(cast_option_buffer); zval_dtor(&cast_option_buffer); break; } diff --git a/ext/standard/php_filestat.h b/ext/standard/php_filestat.h index e8e798c510262..510ad208e8cd6 100644 --- a/ext/standard/php_filestat.h +++ b/ext/standard/php_filestat.h @@ -83,13 +83,9 @@ PHP_FUNCTION(clearstatcache); #define getuid() 1 #endif -#ifdef PHP_WIN32 -typedef unsigned int php_stat_len; -#else -typedef int php_stat_len; -#endif +typedef zend_str_size php_stat_len; -PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, int filename_len TSRMLS_DC); +PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, zend_str_size_int filename_len TSRMLS_DC); PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int type, zval *return_value TSRMLS_DC); /* Switches for various filestat functions: */ diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h index f998996d62238..c259654a48889 100644 --- a/ext/standard/php_incomplete_class.h +++ b/ext/standard/php_incomplete_class.h @@ -46,7 +46,7 @@ #define PHP_CLASS_ATTRIBUTES \ char *class_name; \ - zend_uint name_len; \ + zend_str_size name_len; \ zend_bool free_class_name = 0; \ zend_bool incomplete_class = 0 @@ -58,8 +58,8 @@ extern "C" { #endif PHPAPI zend_class_entry *php_create_incomplete_class(TSRMLS_D); -PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen); -PHPAPI void php_store_class_name(zval *object, const char *name, zend_uint len); +PHPAPI char *php_lookup_class_name(zval *object, zend_str_size_uint *nlen); +PHPAPI void php_store_class_name(zval *object, const char *name, zend_str_size_uint len); #ifdef __cplusplus }; diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 4e39a40be4ebf..c4dbf86935f79 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -113,7 +113,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent zend_hash_move_forward_ex(target_hash, &pos)) { convert_to_string_ex(element); - el_len = Z_STRLEN_PP(element); + el_len = Z_STRSIZE_PP(element); if (el_len == 0) { continue; } @@ -140,7 +140,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent zend_hash_move_forward_ex(target_hash, &pos)) { convert_to_string_ex(element); - el_len = Z_STRLEN_PP(element); + el_len = Z_STRSIZE_PP(element); if (el_len == 0) { continue; @@ -602,7 +602,7 @@ PHP_FUNCTION(proc_open) #endif descriptors[ndesc].mode_flags = descriptors[ndesc].mode & DESC_PARENT_MODE_WRITE ? O_WRONLY : O_RDONLY; #ifdef PHP_WIN32 - if (Z_STRLEN_PP(zmode) >= 2 && Z_STRVAL_PP(zmode)[1] == 'b') + if (Z_STRSIZE_PP(zmode) >= 2 && Z_STRVAL_PP(zmode)[1] == 'b') descriptors[ndesc].mode_flags |= O_BINARY; #endif diff --git a/ext/standard/type.c b/ext/standard/type.c index 5d93f66f5b725..19e88866b843d 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -326,7 +326,7 @@ PHP_FUNCTION(is_numeric) break; case IS_STRING: - if (is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), NULL, NULL, 0)) { + if (is_numeric_string(Z_STRVAL_PP(arg), Z_STRSIZE_PP(arg), NULL, NULL, 0)) { RETURN_TRUE; } else { RETURN_FALSE; diff --git a/ext/standard/url.c b/ext/standard/url.c index 94f6638d64721..8dce6af893f0f 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -743,7 +743,7 @@ PHP_FUNCTION(get_headers) } if (!format) { no_name_header: - add_next_index_stringl(return_value, Z_STRVAL_PP(hdr), Z_STRLEN_PP(hdr), 1); + add_next_index_stringl(return_value, Z_STRVAL_PP(hdr), Z_STRSIZE_PP(hdr), 1); } else { char c; char *s, *p; @@ -757,10 +757,10 @@ PHP_FUNCTION(get_headers) } if (zend_hash_find(HASH_OF(return_value), Z_STRVAL_PP(hdr), (p - Z_STRVAL_PP(hdr) + 1), (void **) &prev_val) == FAILURE) { - add_assoc_stringl_ex(return_value, Z_STRVAL_PP(hdr), (p - Z_STRVAL_PP(hdr) + 1), s, (Z_STRLEN_PP(hdr) - (s - Z_STRVAL_PP(hdr))), 1); + add_assoc_stringl_ex(return_value, Z_STRVAL_PP(hdr), (p - Z_STRVAL_PP(hdr) + 1), s, (Z_STRSIZE_PP(hdr) - (s - Z_STRVAL_PP(hdr))), 1); } else { /* some headers may occur more then once, therefor we need to remake the string into an array */ convert_to_array(*prev_val); - add_next_index_stringl(*prev_val, s, (Z_STRLEN_PP(hdr) - (s - Z_STRVAL_PP(hdr))), 1); + add_next_index_stringl(*prev_val, s, (Z_STRSIZE_PP(hdr) - (s - Z_STRVAL_PP(hdr))), 1); } *p = c; diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index b44be124a15eb..5592ff11d01e4 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -462,9 +462,9 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS) if (!bucket->own_buf) { bucket = php_stream_bucket_make_writeable(bucket TSRMLS_CC); } - if ((int)bucket->buflen != Z_STRLEN_PP(pzdata)) { - bucket->buf = perealloc(bucket->buf, Z_STRLEN_PP(pzdata), bucket->is_persistent); - bucket->buflen = Z_STRLEN_PP(pzdata); + if ((int)bucket->buflen != Z_STRSIZE_PP(pzdata)) { + bucket->buf = perealloc(bucket->buf, Z_STRSIZE_PP(pzdata), bucket->is_persistent); + bucket->buflen = Z_STRSIZE_PP(pzdata); } memcpy(bucket->buf, Z_STRVAL_PP(pzdata), bucket->buflen); } diff --git a/ext/standard/var.c b/ext/standard/var.c index 4acc6f57b7b71..abeb35dfd9e48 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -63,7 +63,7 @@ static int php_object_property_dump(zval **zv TSRMLS_DC, int num_args, va_list a if (hash_key->nKeyLength == 0) { /* numeric key */ php_printf("%*c[%ld]=>\n", level + 1, ' ', hash_key->h); } else { /* string key */ - int unmangle = zend_unmangle_property_name(hash_key->arKey, hash_key->nKeyLength - 1, &class_name, &prop_name); + zend_str_size unmangle = zend_unmangle_property_name(hash_key->arKey, hash_key->nKeyLength - 1, &class_name, &prop_name); php_printf("%*c[", level + 1, ' '); if (class_name && unmangle == SUCCESS) { @@ -88,7 +88,7 @@ PHPAPI void php_var_dump(zval **struc, int level TSRMLS_DC) /* {{{ */ { HashTable *myht; const char *class_name; - zend_uint class_name_len; + zend_str_size class_name_len; int (*php_element_dump_func)(zval** TSRMLS_DC, int, va_list, zend_hash_key*); int is_temp; @@ -110,8 +110,8 @@ PHPAPI void php_var_dump(zval **struc, int level TSRMLS_DC) /* {{{ */ php_printf("%sfloat(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_PP(struc)); break; case IS_STRING: - php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_PP(struc)); - PHPWRITE(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc)); + php_printf("%sstring(%d) \"", COMMON, Z_STRSIZE_PP(struc)); + PHPWRITE(Z_STRVAL_PP(struc), Z_STRSIZE_PP(struc)); PUTS("\"\n"); break; case IS_ARRAY: @@ -243,7 +243,7 @@ PHPAPI void php_debug_zval_dump(zval **struc, int level TSRMLS_DC) /* {{{ */ { HashTable *myht = NULL; const char *class_name; - zend_uint class_name_len; + zend_str_size class_name_len; int (*zval_element_dump_func)(zval** TSRMLS_DC, int, va_list, zend_hash_key*); int is_temp = 0; @@ -265,8 +265,8 @@ PHPAPI void php_debug_zval_dump(zval **struc, int level TSRMLS_DC) /* {{{ */ php_printf("%sdouble(%.*G) refcount(%u)\n", COMMON, (int) EG(precision), Z_DVAL_PP(struc), Z_REFCOUNT_PP(struc)); break; case IS_STRING: - php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_PP(struc)); - PHPWRITE(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc)); + php_printf("%sstring(%d) \"", COMMON, Z_STRSIZE_PP(struc)); + PHPWRITE(Z_STRVAL_PP(struc), Z_STRSIZE_PP(struc)); php_printf("\" refcount(%u)\n", Z_REFCOUNT_PP(struc)); break; case IS_ARRAY: @@ -335,7 +335,7 @@ PHP_FUNCTION(debug_zval_dump) #define buffer_append_spaces(buf, num_spaces) \ do { \ char *tmp_spaces; \ - int tmp_spaces_len; \ + zend_str_size tmp_spaces_len; \ tmp_spaces_len = spprintf(&tmp_spaces, 0,"%*c", num_spaces, ' '); \ smart_str_appendl(buf, tmp_spaces, tmp_spaces_len); \ efree(tmp_spaces); \ @@ -356,7 +356,7 @@ static int php_array_element_export(zval **zv TSRMLS_DC, int num_args, va_list a } else { /* string key */ char *key, *tmp_str; - int key_len, tmp_len; + zend_str_size key_len, tmp_len; key = php_addcslashes(hash_key->arKey, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC); tmp_str = php_str_to_str_ex(key, key_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len, 0, NULL); @@ -391,7 +391,7 @@ static int php_object_element_export(zval **zv TSRMLS_DC, int num_args, va_list const char *class_name; /* ignored, but must be passed to unmangle */ const char *pname; char *pname_esc; - int pname_esc_len; + zend_str_size pname_esc_len; zend_unmangle_property_name(hash_key->arKey, hash_key->nKeyLength - 1, &class_name, &pname); @@ -417,9 +417,9 @@ PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC) { HashTable *myht; char *tmp_str, *tmp_str2; - int tmp_len, tmp_len2; + zend_str_size tmp_len, tmp_len2; const char *class_name; - zend_uint class_name_len; + zend_str_size class_name_len; switch (Z_TYPE_PP(struc)) { case IS_BOOL: @@ -441,7 +441,7 @@ PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC) efree(tmp_str); break; case IS_STRING: - tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\", 2 TSRMLS_CC); + tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRSIZE_PP(struc), &tmp_len, 0, "'\\", 2 TSRMLS_CC); tmp_str2 = php_str_to_str_ex(tmp_str, tmp_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len2, 0, NULL); smart_str_appendc(buf, '\''); @@ -547,7 +547,7 @@ static inline int php_add_var_hash(HashTable *var_hash, zval *var, void *var_old { ulong var_no; char id[32], *p; - register int len; + register zend_str_size len; /* relies on "(long)" being a perfect hash function for data pointers, * however the actual identity of an object has had to be determined @@ -592,7 +592,7 @@ static inline void php_var_serialize_long(smart_str *buf, long val) /* {{{ */ } /* }}} */ -static inline void php_var_serialize_string(smart_str *buf, char *str, int len) /* {{{ */ +static inline void php_var_serialize_string(smart_str *buf, char *str, zend_str_size_int len) /* {{{ */ { smart_str_appendl(buf, "s:", 2); smart_str_append_long(buf, len); @@ -608,7 +608,7 @@ static inline zend_bool php_var_serialize_class_name(smart_str *buf, zval *struc PHP_SET_CLASS_ATTRIBUTES(struc); smart_str_appendl(buf, "O:", 2); - smart_str_append_long(buf, (int)name_len); + smart_str_append_long(buf, (long)name_len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, class_name, name_len); smart_str_appendl(buf, "\":", 2); @@ -666,18 +666,18 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt continue; } propers = Z_OBJPROP_P(struc); - if (zend_hash_find(propers, Z_STRVAL_PP(name), Z_STRLEN_PP(name) + 1, (void *) &d) == SUCCESS) { - php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRLEN_PP(name)); + if (zend_hash_find(propers, Z_STRVAL_PP(name), Z_STRSIZE_PP(name) + 1, (void *) &d) == SUCCESS) { + php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRSIZE_PP(name)); php_var_serialize_intern(buf, *d, var_hash TSRMLS_CC); } else { zend_class_entry *ce; ce = zend_get_class_entry(struc TSRMLS_CC); if (ce) { char *prot_name, *priv_name; - int prop_name_length; + zend_str_size prop_name_length; do { - zend_mangle_property_name(&priv_name, &prop_name_length, ce->name, ce->name_length, Z_STRVAL_PP(name), Z_STRLEN_PP(name), ce->type & ZEND_INTERNAL_CLASS); + zend_mangle_property_name(&priv_name, &prop_name_length, ce->name, ce->name_length, Z_STRVAL_PP(name), Z_STRSIZE_PP(name), ce->type & ZEND_INTERNAL_CLASS); if (zend_hash_find(propers, priv_name, prop_name_length + 1, (void *) &d) == SUCCESS) { php_var_serialize_string(buf, priv_name, prop_name_length); pefree(priv_name, ce->type & ZEND_INTERNAL_CLASS); @@ -685,7 +685,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt break; } pefree(priv_name, ce->type & ZEND_INTERNAL_CLASS); - zend_mangle_property_name(&prot_name, &prop_name_length, "*", 1, Z_STRVAL_PP(name), Z_STRLEN_PP(name), ce->type & ZEND_INTERNAL_CLASS); + zend_mangle_property_name(&prot_name, &prop_name_length, "*", 1, Z_STRVAL_PP(name), Z_STRSIZE_PP(name), ce->type & ZEND_INTERNAL_CLASS); if (zend_hash_find(propers, prot_name, prop_name_length + 1, (void *) &d) == SUCCESS) { php_var_serialize_string(buf, prot_name, prop_name_length); pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS); @@ -693,12 +693,12 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt break; } pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS); - php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRLEN_PP(name)); + php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRSIZE_PP(name)); php_var_serialize_intern(buf, nvalp, var_hash TSRMLS_CC); php_error_docref(NULL TSRMLS_CC, E_NOTICE, "\"%s\" returned as member variable from __sleep() but does not exist", Z_STRVAL_PP(name)); } while (0); } else { - php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRLEN_PP(name)); + php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRSIZE_PP(name)); php_var_serialize_intern(buf, nvalp, var_hash TSRMLS_CC); } } @@ -760,7 +760,7 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var } case IS_STRING: - php_var_serialize_string(buf, Z_STRVAL_P(struc), Z_STRLEN_P(struc)); + php_var_serialize_string(buf, Z_STRVAL_P(struc), Z_STRSIZE_P(struc)); return; case IS_OBJECT: { @@ -776,7 +776,7 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var if (ce && ce->serialize != NULL) { /* has custom handler */ unsigned char *serialized_data = NULL; - zend_uint serialized_length; + zend_str_size serialized_length; if (ce->serialize(struc, &serialized_data, &serialized_length, (zend_serialize_data *)var_hash TSRMLS_CC) == SUCCESS) { smart_str_appendl(buf, "C:", 2); @@ -854,7 +854,7 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var char *key; zval **data; ulong index; - uint key_len; + zend_str_size key_len; HashPosition pos; zend_hash_internal_pointer_reset_ex(myht, &pos); @@ -926,7 +926,7 @@ PHP_FUNCTION(serialize) Z_TYPE_P(return_value) = IS_STRING; Z_STRVAL_P(return_value) = NULL; - Z_STRLEN_P(return_value) = 0; + Z_STRSIZE_P(return_value) = 0; PHP_VAR_SERIALIZE_INIT(var_hash); php_var_serialize(&buf, struc, &var_hash TSRMLS_CC); @@ -950,12 +950,12 @@ PHP_FUNCTION(serialize) PHP_FUNCTION(unserialize) { char *buf = NULL; - int buf_len; + zend_str_size buf_len; const unsigned char *p; php_unserialize_data_t var_hash; zval *consumed = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &buf, &buf_len, &consumed) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|z", &buf, &buf_len, &consumed) == FAILURE) { RETURN_FALSE; } diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index ddf43b02cf14d..19c3f398c1337 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -302,16 +302,16 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL); break; case IS_STRING: - if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) { + if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRSIZE_P(key) + 1, (void **)&old_data)==SUCCESS) { var_push_dtor(var_hash, old_data); } - zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL); + zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRSIZE_P(key) + 1, &data, sizeof(data), NULL); break; } } else { /* object properties should include no integers */ convert_to_string(key); - zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, + zend_hash_update(ht, Z_STRVAL_P(key), Z_STRSIZE_P(key) + 1, &data, sizeof data, NULL); } diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index 4d99cbfd78944..97588f5d4ca0f 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -306,16 +306,16 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL); break; case IS_STRING: - if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) { + if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRSIZE_P(key) + 1, (void **)&old_data)==SUCCESS) { var_push_dtor(var_hash, old_data); } - zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL); + zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRSIZE_P(key) + 1, &data, sizeof(data), NULL); break; } } else { /* object properties should include no integers */ convert_to_string(key); - zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, + zend_hash_update(ht, Z_STRVAL_P(key), Z_STRSIZE_P(key) + 1, &data, sizeof data, NULL); } diff --git a/main/output.c b/main/output.c index 9324f059da8be..b80dc4b7927d5 100644 --- a/main/output.c +++ b/main/output.c @@ -480,8 +480,8 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_output_handler_default_func, chunk_size, flags TSRMLS_CC); break; case IS_STRING: - if (Z_STRLEN_P(output_handler) && (alias = php_output_handler_alias(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler) TSRMLS_CC))) { - handler = (*alias)(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler), chunk_size, flags TSRMLS_CC); + if (Z_STRSIZE_P(output_handler) && (alias = php_output_handler_alias(Z_STRVAL_P(output_handler), Z_STRSIZE_P(output_handler) TSRMLS_CC))) { + handler = (*alias)(Z_STRVAL_P(output_handler), Z_STRSIZE_P(output_handler), chunk_size, flags TSRMLS_CC); break; } default: @@ -964,9 +964,9 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl status = PHP_OUTPUT_HANDLER_NO_DATA; if (Z_TYPE_P(retval) != IS_BOOL) { convert_to_string_ex(&retval); - if (Z_STRLEN_P(retval)) { - context->out.data = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); - context->out.used = Z_STRLEN_P(retval); + if (Z_STRSIZE_P(retval)) { + context->out.data = estrndup(Z_STRVAL_P(retval), Z_STRSIZE_P(retval)); + context->out.used = Z_STRSIZE_P(retval); context->out.free = 1; status = PHP_OUTPUT_HANDLER_SUCCESS; } diff --git a/main/php_ini.c b/main/php_ini.c index cb2c7ea80895b..4d0c90b2087ec 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -80,7 +80,8 @@ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type TSRMLS_DC) ini_entry->displayer(ini_entry, type); } else { char *display_string; - uint display_string_length, esc_html=0; + zend_str_size display_string_length; + int esc_html=0; if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { if (ini_entry->orig_value && ini_entry->orig_value[0]) { @@ -228,17 +229,17 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t /* PHP and Zend extensions are not added into configuration hash! */ if (!is_special_section && !strcasecmp(Z_STRVAL_P(arg1), PHP_EXTENSION_TOKEN)) { /* load PHP extension */ - extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)); + extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRSIZE_P(arg2)); zend_llist_add_element(&extension_lists.functions, &extension_name); } else if (!is_special_section && !strcasecmp(Z_STRVAL_P(arg1), ZEND_EXTENSION_TOKEN)) { /* load Zend extension */ - extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)); + extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRSIZE_P(arg2)); zend_llist_add_element(&extension_lists.engine, &extension_name); /* All other entries are added into either configuration_hash or active ini section array */ } else { /* Store in active hash */ - zend_hash_update(active_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, arg2, sizeof(zval), (void **) &entry); - Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry)); + zend_hash_update(active_hash, Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, arg2, sizeof(zval), (void **) &entry); + Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRSIZE_P(entry)); } } break; @@ -255,23 +256,23 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t /* fprintf(stdout, "ZEND_INI_PARSER_POP_ENTRY: %s[%s] = %s\n",Z_STRVAL_P(arg1), Z_STRVAL_P(arg3), Z_STRVAL_P(arg2)); */ /* If option not found in hash or is not an array -> create array, otherwise add to existing array */ - if (zend_hash_find(active_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, (void **) &find_arr) == FAILURE || Z_TYPE_P(find_arr) != IS_ARRAY) { + if (zend_hash_find(active_hash, Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, (void **) &find_arr) == FAILURE || Z_TYPE_P(find_arr) != IS_ARRAY) { option_arr = (zval *) pemalloc(sizeof(zval), 1); INIT_PZVAL(option_arr); Z_TYPE_P(option_arr) = IS_ARRAY; Z_ARRVAL_P(option_arr) = (HashTable *) pemalloc(sizeof(HashTable), 1); zend_hash_init(Z_ARRVAL_P(option_arr), 0, NULL, (dtor_func_t) config_zval_dtor, 1); - zend_hash_update(active_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, option_arr, sizeof(zval), (void **) &find_arr); + zend_hash_update(active_hash, Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, option_arr, sizeof(zval), (void **) &find_arr); free(option_arr); } /* arg3 is possible option offset name */ - if (arg3 && Z_STRLEN_P(arg3) > 0) { - zend_symtable_update(Z_ARRVAL_P(find_arr), Z_STRVAL_P(arg3), Z_STRLEN_P(arg3) + 1, arg2, sizeof(zval), (void **) &entry); + if (arg3 && Z_STRSIZE_P(arg3) > 0) { + zend_symtable_update(Z_ARRVAL_P(find_arr), Z_STRVAL_P(arg3), Z_STRSIZE_P(arg3) + 1, arg2, sizeof(zval), (void **) &entry); } else { zend_hash_next_index_insert(Z_ARRVAL_P(find_arr), arg2, sizeof(zval), (void **) &entry); } - Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry)); + Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRSIZE_P(entry)); } break; @@ -280,13 +281,13 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t /* fprintf(stdout, "ZEND_INI_PARSER_SECTION: %s\n",Z_STRVAL_P(arg1)); */ char *key = NULL; - uint key_len; + zend_str_size key_len; /* PATH sections */ if (!strncasecmp(Z_STRVAL_P(arg1), "PATH", sizeof("PATH") - 1)) { key = Z_STRVAL_P(arg1); key = key + sizeof("PATH") - 1; - key_len = Z_STRLEN_P(arg1) - sizeof("PATH") + 1; + key_len = Z_STRSIZE_P(arg1) - sizeof("PATH") + 1; is_special_section = 1; has_per_dir_config = 1; @@ -297,7 +298,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t } else if (!strncasecmp(Z_STRVAL_P(arg1), "HOST", sizeof("HOST") - 1)) { key = Z_STRVAL_P(arg1); key = key + sizeof("HOST") - 1; - key_len = Z_STRLEN_P(arg1) - sizeof("HOST") + 1; + key_len = Z_STRSIZE_P(arg1) - sizeof("HOST") + 1; is_special_section = 1; has_per_host_config = 1; zend_str_tolower(key, key_len); /* host names are case-insensitive. */ @@ -358,14 +359,14 @@ static void php_load_php_extension_cb(void *arg TSRMLS_DC) static void php_load_zend_extension_cb(void *arg TSRMLS_DC) { char *filename = *((char **) arg); - int length = strlen(filename); + zend_str_size length = strlen(filename); if (IS_ABSOLUTE_PATH(filename, length)) { zend_load_extension(filename); } else { char *libpath; char *extension_dir = INI_STR("extension_dir"); - int extension_dir_len = strlen(extension_dir); + zend_str_size extension_dir_len = strlen(extension_dir); if (IS_SLASH(extension_dir[extension_dir_len-1])) { spprintf(&libpath, 0, "%s%s", extension_dir, filename); @@ -384,7 +385,7 @@ int php_init_config(TSRMLS_D) { char *php_ini_file_name = NULL; char *php_ini_search_path = NULL; - int php_ini_scanned_path_len; + zend_str_size php_ini_scanned_path_len; char *open_basedir; int free_ini_search_path = 0; zend_file_handle fh; @@ -407,7 +408,7 @@ int php_init_config(TSRMLS_D) php_ini_search_path = sapi_module.php_ini_path_override; free_ini_search_path = 0; } else if (!sapi_module.php_ini_ignore) { - int search_path_size; + zend_str_size search_path_size; char *default_location; char *env_location; static const char paths_separator[] = { ZEND_PATHS_SEPARATOR, 0 }; @@ -421,7 +422,7 @@ int php_init_config(TSRMLS_D) #ifdef PHP_WIN32 if (!env_location) { char dummybuf; - int size; + zend_str_size size; SetLastError(0); @@ -598,8 +599,8 @@ int php_init_config(TSRMLS_D) { zval tmp; - Z_STRLEN(tmp) = strlen(fh.filename); - Z_STRVAL(tmp) = zend_strndup(fh.filename, Z_STRLEN(tmp)); + Z_STRSIZE(tmp) = strlen(fh.filename); + Z_STRVAL(tmp) = zend_strndup(fh.filename, Z_STRSIZE(tmp)); Z_TYPE(tmp) = IS_STRING; Z_SET_REFCOUNT(tmp, 0); @@ -607,7 +608,7 @@ int php_init_config(TSRMLS_D) if (php_ini_opened_path) { efree(php_ini_opened_path); } - php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); + php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRSIZE(tmp)); } } @@ -671,7 +672,7 @@ int php_init_config(TSRMLS_D) free(namelist); if (total_l) { - int php_ini_scanned_files_len = (php_ini_scanned_files) ? strlen(php_ini_scanned_files) + 1 : 0; + zend_str_size php_ini_scanned_files_len = (php_ini_scanned_files) ? strlen(php_ini_scanned_files) + 1 : 0; php_ini_scanned_files = (char *) realloc(php_ini_scanned_files, php_ini_scanned_files_len + total_l + 1); if (!php_ini_scanned_files_len) { *php_ini_scanned_files = '\0'; @@ -769,7 +770,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int { char *str; zval *data; - uint str_len; + zend_str_size str_len; ulong num_index; /* Walk through config hash and alter matching ini entries using the values found in the hash */ @@ -778,7 +779,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int zend_hash_move_forward(source_hash) ) { zend_hash_get_current_data(source_hash, (void **) &data); - zend_alter_ini_entry_ex(str, str_len, Z_STRVAL_P(data), Z_STRLEN_P(data), modify_type, stage, 0 TSRMLS_CC); + zend_alter_ini_entry_ex(str, str_len, Z_STRVAL_P(data), Z_STRSIZE_P(data), modify_type, stage, 0 TSRMLS_CC); } } /* }}} */ @@ -793,7 +794,7 @@ PHPAPI int php_ini_has_per_dir_config(void) /* {{{ php_ini_activate_per_dir_config */ -PHPAPI void php_ini_activate_per_dir_config(char *path, uint path_len TSRMLS_DC) +PHPAPI void php_ini_activate_per_dir_config(char *path, zend_str_size_uint path_len TSRMLS_DC) { zval *tmp2; char *ptr; @@ -839,7 +840,7 @@ PHPAPI int php_ini_has_per_host_config(void) /* {{{ php_ini_activate_per_host_config */ -PHPAPI void php_ini_activate_per_host_config(const char *host, uint host_len TSRMLS_DC) +PHPAPI void php_ini_activate_per_host_config(const char *host, zend_str_size_uint host_len TSRMLS_DC) { zval *tmp; @@ -854,7 +855,7 @@ PHPAPI void php_ini_activate_per_host_config(const char *host, uint host_len TSR /* {{{ cfg_get_entry */ -PHPAPI zval *cfg_get_entry(const char *name, uint name_length) +PHPAPI zval *cfg_get_entry(const char *name, zend_str_size_uint name_length) { zval *tmp; diff --git a/main/php_ini.h b/main/php_ini.h index 65c80f75933b4..17a5c0e6bc0ef 100644 --- a/main/php_ini.h +++ b/main/php_ini.h @@ -28,7 +28,7 @@ PHPAPI void config_zval_dtor(zval *zvalue); int php_init_config(TSRMLS_D); int php_shutdown_config(void); void php_ini_register_extensions(TSRMLS_D); -PHPAPI zval *cfg_get_entry(const char *name, uint name_length); +PHPAPI zval *cfg_get_entry(const char *name, zend_str_size_uint name_length); PHPAPI int cfg_get_long(const char *varname, long *result); PHPAPI int cfg_get_double(const char *varname, double *result); PHPAPI int cfg_get_string(const char *varname, char **result); @@ -36,8 +36,8 @@ PHPAPI int php_parse_user_ini_file(const char *dirname, char *ini_filename, Hash PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int stage TSRMLS_DC); PHPAPI int php_ini_has_per_dir_config(void); PHPAPI int php_ini_has_per_host_config(void); -PHPAPI void php_ini_activate_per_dir_config(char *path, uint path_len TSRMLS_DC); -PHPAPI void php_ini_activate_per_host_config(const char *host, uint host_len TSRMLS_DC); +PHPAPI void php_ini_activate_per_dir_config(char *path, zend_str_size_uint path_len TSRMLS_DC); +PHPAPI void php_ini_activate_per_host_config(const char *host, zend_str_size_uint host_len TSRMLS_DC); PHPAPI HashTable* php_ini_get_configuration_hash(void); END_EXTERN_C() diff --git a/main/php_variables.c b/main/php_variables.c index fd52f311d17df..465a79dcc219e 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -39,14 +39,14 @@ PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_arra } /* binary-safe version */ -PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zval *track_vars_array TSRMLS_DC) +PHPAPI void php_register_variable_safe(char *var, char *strval, zend_str_size_int str_len, zval *track_vars_array TSRMLS_DC) { zval new_entry; assert(strval != NULL); /* Prepare value */ - Z_STRLEN(new_entry) = str_len; - Z_STRVAL(new_entry) = estrndup(strval, Z_STRLEN(new_entry)); + Z_STRSIZE(new_entry) = str_len; + Z_STRVAL(new_entry) = estrndup(strval, Z_STRSIZE(new_entry)); Z_TYPE(new_entry) = IS_STRING; php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC); @@ -58,7 +58,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars char *ip; /* index pointer */ char *index; char *var, *var_orig; - int var_len, index_len; + zend_str_size var_len, index_len; zval *gpc_element, **gpc_element_p; zend_bool is_array = 0; HashTable *symtable1 = NULL; @@ -124,7 +124,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars int nest_level = 0; while (1) { char *index_s; - int new_idx_len = 0; + zend_str_size new_idx_len = 0; if(++nest_level > PG(max_input_nesting_level)) { HashTable *ht; @@ -244,7 +244,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler) while (s < e && (p = memchr(s, '&', (e - s)))) { last_value: if ((val = memchr(s, '=', (p - s)))) { /* have a value */ - unsigned int val_len, new_val_len; + zend_str_size val_len, new_val_len; if (++count > PG(max_input_vars)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded %ld. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); @@ -379,8 +379,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) } if (val) { /* have a value */ - int val_len; - unsigned int new_val_len; + zend_str_size val_len, new_val_len; *val++ = '\0'; php_url_decode(var, strlen(var)); @@ -391,8 +390,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) } efree(val); } else { - int val_len; - unsigned int new_val_len; + zend_str_size val_len, new_val_len; php_url_decode(var, strlen(var)); val_len = 0; @@ -419,7 +417,7 @@ void _php_import_environment_variables(zval *array_ptr TSRMLS_DC) { char buf[128]; char **env, *p, *t = buf; - size_t alloc_size = sizeof(buf); + zend_str_size alloc_size = sizeof(buf); unsigned long nlen; /* ptrdiff_t is not portable */ for (env = environ; env != NULL && *env != NULL; env++) { @@ -441,7 +439,7 @@ void _php_import_environment_variables(zval *array_ptr TSRMLS_DC) } } -zend_bool php_std_auto_global_callback(char *name, uint name_len TSRMLS_DC) +zend_bool php_std_auto_global_callback(char *name, zend_str_size_uint name_len TSRMLS_DC) { zend_printf("%s\n", name); return 0; /* don't rearm */ @@ -468,8 +466,8 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) for (i = 0; i < SG(request_info).argc; i++) { ALLOC_ZVAL(tmp); Z_TYPE_P(tmp) = IS_STRING; - Z_STRLEN_P(tmp) = strlen(SG(request_info).argv[i]); - Z_STRVAL_P(tmp) = estrndup(SG(request_info).argv[i], Z_STRLEN_P(tmp)); + Z_STRSIZE_P(tmp) = strlen(SG(request_info).argv[i]); + Z_STRVAL_P(tmp) = estrndup(SG(request_info).argv[i], Z_STRSIZE_P(tmp)); INIT_PZVAL(tmp); if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(zval *), NULL) == FAILURE) { if (Z_TYPE_P(tmp) == IS_STRING) { @@ -487,8 +485,8 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) /* auto-type */ ALLOC_ZVAL(tmp); Z_TYPE_P(tmp) = IS_STRING; - Z_STRLEN_P(tmp) = strlen(ss); - Z_STRVAL_P(tmp) = estrndup(ss, Z_STRLEN_P(tmp)); + Z_STRSIZE_P(tmp) = strlen(ss); + Z_STRVAL_P(tmp) = estrndup(ss, Z_STRSIZE_P(tmp)); INIT_PZVAL(tmp); count++; if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(zval *), NULL) == FAILURE) { @@ -580,7 +578,7 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC) { zval **src_entry, **dest_entry; char *string_key; - uint string_key_len; + zend_str_size string_key_len; ulong num_key; HashPosition pos; int key_type; @@ -613,9 +611,9 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC) } /* }}} */ -static zend_bool php_auto_globals_create_server(const char *name, uint name_len TSRMLS_DC); -static zend_bool php_auto_globals_create_env(const char *name, uint name_len TSRMLS_DC); -static zend_bool php_auto_globals_create_request(const char *name, uint name_len TSRMLS_DC); +static zend_bool php_auto_globals_create_server(const char *name, zend_str_size_uint name_len TSRMLS_DC); +static zend_bool php_auto_globals_create_env(const char *name, zend_str_size_uint name_len TSRMLS_DC); +static zend_bool php_auto_globals_create_request(const char *name, zend_str_size_uint name_len TSRMLS_DC); /* {{{ php_hash_environment */ @@ -630,7 +628,7 @@ int php_hash_environment(TSRMLS_D) } /* }}} */ -static zend_bool php_auto_globals_create_get(const char *name, uint name_len TSRMLS_DC) +static zend_bool php_auto_globals_create_get(const char *name, zend_str_size_uint name_len TSRMLS_DC) { zval *vars; @@ -653,7 +651,7 @@ static zend_bool php_auto_globals_create_get(const char *name, uint name_len TSR return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_post(const char *name, uint name_len TSRMLS_DC) +static zend_bool php_auto_globals_create_post(const char *name, zend_str_size_uint name_len TSRMLS_DC) { zval *vars; @@ -680,7 +678,7 @@ static zend_bool php_auto_globals_create_post(const char *name, uint name_len TS return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_cookie(const char *name, uint name_len TSRMLS_DC) +static zend_bool php_auto_globals_create_cookie(const char *name, zend_str_size_uint name_len TSRMLS_DC) { zval *vars; @@ -703,7 +701,7 @@ static zend_bool php_auto_globals_create_cookie(const char *name, uint name_len return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_files(const char *name, uint name_len TSRMLS_DC) +static zend_bool php_auto_globals_create_files(const char *name, zend_str_size_uint name_len TSRMLS_DC) { zval *vars; @@ -722,7 +720,7 @@ static zend_bool php_auto_globals_create_files(const char *name, uint name_len T return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_server(const char *name, uint name_len TSRMLS_DC) +static zend_bool php_auto_globals_create_server(const char *name, zend_str_size_uint name_len TSRMLS_DC) { if (PG(variables_order) && (strchr(PG(variables_order),'S') || strchr(PG(variables_order),'s'))) { php_register_server_variables(TSRMLS_C); @@ -760,7 +758,7 @@ static zend_bool php_auto_globals_create_server(const char *name, uint name_len return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_env(const char *name, uint name_len TSRMLS_DC) +static zend_bool php_auto_globals_create_env(const char *name, zend_str_size_uint name_len TSRMLS_DC) { zval *env_vars = NULL; ALLOC_ZVAL(env_vars); @@ -781,7 +779,7 @@ static zend_bool php_auto_globals_create_env(const char *name, uint name_len TSR return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_request(const char *name, uint name_len TSRMLS_DC) +static zend_bool php_auto_globals_create_request(const char *name, zend_str_size_uint name_len TSRMLS_DC) { zval *form_variables; unsigned char _gpc_flags[3] = {0, 0, 0}; diff --git a/main/php_variables.h b/main/php_variables.h index 8f5e96aac363a..d6d156390bf32 100644 --- a/main/php_variables.h +++ b/main/php_variables.h @@ -38,7 +38,7 @@ void php_startup_auto_globals(TSRMLS_D); extern PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC); PHPAPI void php_register_variable(char *var, char *val, zval *track_vars_array TSRMLS_DC); /* binary-safe version */ -PHPAPI void php_register_variable_safe(char *var, char *val, int val_len, zval *track_vars_array TSRMLS_DC); +PHPAPI void php_register_variable_safe(char *var, char *val, zend_str_size_int val_len, zval *track_vars_array TSRMLS_DC); PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_array TSRMLS_DC); int php_hash_environment(TSRMLS_D); diff --git a/main/snprintf.c b/main/snprintf.c index 4514bd6821fb8..23f4935cfb289 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -787,7 +787,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / if (free_zcopy) { zvp = &zcopy; } - s_len = Z_STRLEN_P(zvp); + s_len = Z_STRSIZE_P(zvp); s = Z_STRVAL_P(zvp); if (adjust_precision && precision < s_len) { s_len = precision; diff --git a/main/spprintf.c b/main/spprintf.c index 596e1ef456b6c..9064e206a9886 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -395,7 +395,7 @@ static void xbuf_format_converter(smart_str *xbuf, const char *fmt, va_list ap) if (free_zcopy) { zvp = &zcopy; } - s_len = Z_STRLEN_P(zvp); + s_len = Z_STRSIZE_P(zvp); s = Z_STRVAL_P(zvp); if (adjust_precision && precision < s_len) { s_len = precision; diff --git a/main/streams/userspace.c b/main/streams/userspace.c index 69edbaafa91d4..635c0cc4b1632 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -406,7 +406,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filena /* if the opened path is set, copy it out */ if (Z_TYPE_P(zopened) == IS_STRING && opened_path) { - *opened_path = estrndup(Z_STRVAL_P(zopened), Z_STRLEN_P(zopened)); + *opened_path = estrndup(Z_STRVAL_P(zopened), Z_STRSIZE_P(zopened)); } /* set wrapper data to be a reference to our object */ @@ -694,7 +694,7 @@ static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count if (call_result == SUCCESS && retval != NULL) { convert_to_string(retval); - didread = Z_STRLEN_P(retval); + didread = Z_STRSIZE_P(retval); if (didread > count) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_READ " - read %ld bytes more data than requested (%ld read, %ld max) - excess data will be lost", us->wrapper->classname, (long)(didread - count), (long)didread, (long)count); @@ -1526,7 +1526,7 @@ static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t cou if (call_result == SUCCESS && retval != NULL && Z_TYPE_P(retval) != IS_BOOL) { convert_to_string(retval); - PHP_STRLCPY(ent->d_name, Z_STRVAL_P(retval), sizeof(ent->d_name), Z_STRLEN_P(retval)); + PHP_STRLCPY(ent->d_name, Z_STRVAL_P(retval), sizeof(ent->d_name), Z_STRSIZE_P(retval)); didread = sizeof(php_stream_dirent); } else if (call_result == FAILURE) { diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index a9c050f2672d2..eaec034992249 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -661,7 +661,7 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_ efree(host); return -1; } - bindto = parse_ip_address_ex(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text TSRMLS_CC); + bindto = parse_ip_address_ex(Z_STRVAL_PP(tmpzval), Z_STRSIZE_PP(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text TSRMLS_CC); } /* Note: the test here for php_stream_udp_socket_ops is important, because we diff --git a/sapi/cli/cli.h b/sapi/cli/cli.h index 7686522a20ad6..cfbf0be8d9d4f 100644 --- a/sapi/cli/cli.h +++ b/sapi/cli/cli.h @@ -30,11 +30,11 @@ #endif -extern PHP_CLI_API size_t sapi_cli_single_write(const char *str, uint str_length TSRMLS_DC); +extern PHP_CLI_API size_t sapi_cli_single_write(const char *str, zend_str_size_uint str_length TSRMLS_DC); typedef struct { - size_t (*cli_shell_write)(const char *str, uint str_length TSRMLS_DC); - int (*cli_shell_ub_write)(const char *str, uint str_length TSRMLS_DC); + zend_str_size_size_t (*cli_shell_write)(const char *str, zend_str_size_uint str_length TSRMLS_DC); + zend_str_size_int (*cli_shell_ub_write)(const char *str, zend_str_size_uint str_length TSRMLS_DC); int (*cli_shell_run)(TSRMLS_D); } cli_shell_callbacks_t; diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 729052334d6c9..fe18682daa43e 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -252,16 +252,16 @@ static inline int sapi_cli_select(int fd TSRMLS_DC) return ret != -1; } -PHP_CLI_API size_t sapi_cli_single_write(const char *str, uint str_length TSRMLS_DC) /* {{{ */ +PHP_CLI_API zend_str_size_size_t sapi_cli_single_write(const char *str, zend_str_size_uint str_length TSRMLS_DC) /* {{{ */ { #ifdef PHP_WRITE_STDOUT long ret; #else - size_t ret; + zend_str_size ret; #endif if (cli_shell_callbacks.cli_shell_write) { - size_t shell_wrote; + zend_str_size shell_wrote; shell_wrote = cli_shell_callbacks.cli_shell_write(str, str_length TSRMLS_CC); if (shell_wrote > -1) { return shell_wrote; @@ -285,10 +285,10 @@ PHP_CLI_API size_t sapi_cli_single_write(const char *str, uint str_length TSRMLS } /* }}} */ -static int sapi_cli_ub_write(const char *str, uint str_length TSRMLS_DC) /* {{{ */ +static zend_str_size_int sapi_cli_ub_write(const char *str, zend_str_size_uint str_length TSRMLS_DC) /* {{{ */ { const char *ptr = str; - uint remaining = str_length; + zend_str_size remaining = str_length; size_t ret; if (!str_length) { @@ -296,7 +296,7 @@ static int sapi_cli_ub_write(const char *str, uint str_length TSRMLS_DC) /* {{{ } if (cli_shell_callbacks.cli_shell_ub_write) { - int ub_wrote; + zend_str_size ub_wrote; ub_wrote = cli_shell_callbacks.cli_shell_ub_write(str, str_length TSRMLS_CC); if (ub_wrote > -1) { return ub_wrote; @@ -338,7 +338,7 @@ static char *script_filename = ""; static void sapi_cli_register_variables(zval *track_vars_array TSRMLS_DC) /* {{{ */ { - unsigned int len; + zend_str_size len; char *docroot = ""; /* In CGI mode, we consider the environment to be a part of the server @@ -618,7 +618,7 @@ static const char *param_mode_conflict = "Either execute direct code, process st /* {{{ cli_seek_file_begin */ -static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file, int *lineno TSRMLS_DC) +static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file, zend_str_size_int *lineno TSRMLS_DC) { int c; @@ -669,7 +669,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ char *arg_free=NULL, **arg_excp=&arg_free; char *script_file=NULL, *translated_path = NULL; int interactive=0; - int lineno = 0; + zend_str_size lineno = 0; const char *param_error=NULL; int hide_argv = 0; @@ -1058,7 +1058,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ } ALLOC_ZVAL(argn); Z_TYPE_P(argn) = IS_STRING; - Z_STRLEN_P(argn) = ++len; + Z_STRSIZE_P(argn) = ++len; Z_STRVAL_P(argn) = estrndup(input, len); INIT_PZVAL(argn); zend_hash_update(&EG(symbol_table), "argn", sizeof("argn"), &argn, sizeof(zval *), NULL); @@ -1213,7 +1213,7 @@ int main(int argc, char *argv[]) int php_optind = 1, use_extended_info = 0; char *ini_path_override = NULL; char *ini_entries = NULL; - int ini_entries_len = 0; + zend_str_size ini_entries_len = 0; int ini_ignore = 0; sapi_module_struct *sapi_module = &cli_sapi_module; @@ -1279,7 +1279,7 @@ int main(int argc, char *argv[]) break; case 'd': { /* define ini entries on command line */ - int len = strlen(php_optarg); + zend_str_size len = strlen(php_optarg); char *val; if ((val = strchr(php_optarg, '='))) { From 91abad1e1b03ad356081dd0dc28f62762bc61f1d Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Tue, 2 Jul 2013 10:20:01 -0400 Subject: [PATCH 05/31] Better test coverage --- Zend/zend_API.c | 3 ++ Zend/zend_exceptions.c | 44 ++++++++++++----------- Zend/zend_exceptions.h | 2 +- ext/pcre/php_pcre.c | 78 ++++++++++++++++++++-------------------- ext/pcre/php_pcre.h | 12 +++---- ext/standard/file.c | 2 +- ext/standard/link.c | 18 +++++----- ext/standard/md5.c | 8 ++--- ext/standard/proc_open.c | 6 ++-- ext/standard/type.c | 4 +-- ext/standard/uniqid.c | 5 +-- main/output.c | 50 +++++++++++++------------- main/php_output.h | 42 +++++++++++----------- 13 files changed, 140 insertions(+), 134 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 5e82177c45384..ddcd2e88d814d 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -710,6 +710,9 @@ static int zend_parse_arg(int arg_num, zval **arg, va_list *va, const char **spe const char *space; const char *class_name = get_active_class_name(&space TSRMLS_CC); + if (0 == strcmp(expected_type, "unknown")) { + severity = E_ERROR; + } if (error) { zend_error(severity, "%s%s%s() expects parameter %d %s", class_name, space, get_active_function_name(TSRMLS_C), arg_num, error); diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 59fbcc0055d89..6477a10060dc8 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -86,7 +86,7 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */ #ifdef HAVE_DTRACE if (DTRACE_EXCEPTION_THROWN_ENABLED()) { char *classname; - int name_len; + zend_str_size name_len; if (exception != NULL) { zend_get_object_classname(exception, &classname, &name_len TSRMLS_CC); @@ -196,9 +196,10 @@ ZEND_METHOD(exception, __construct) char *message = NULL; long code = 0; zval *object, *previous = NULL; - int argc = ZEND_NUM_ARGS(), message_len; + int argc = ZEND_NUM_ARGS(); + zend_str_size message_len; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|slO!", &message, &message_len, &code, &previous, default_exception_ce) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|SlO!", &message, &message_len, &code, &previous, default_exception_ce) == FAILURE) { zend_error(E_ERROR, "Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]])"); } @@ -225,9 +226,10 @@ ZEND_METHOD(error_exception, __construct) char *message = NULL, *filename = NULL; long code = 0, severity = E_ERROR, lineno; zval *object, *previous = NULL; - int argc = ZEND_NUM_ARGS(), message_len, filename_len; + int argc = ZEND_NUM_ARGS(); + zend_str_size message_len, filename_len; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|sllslO!", &message, &message_len, &code, &severity, &filename, &filename_len, &lineno, &previous, default_exception_ce) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|SllSlO!", &message, &message_len, &code, &severity, &filename, &filename_len, &lineno, &previous, default_exception_ce) == FAILURE) { zend_error(E_ERROR, "Wrong parameters for ErrorException([string $exception [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Exception $previous = NULL]]]]]])"); } @@ -262,7 +264,7 @@ ZEND_METHOD(error_exception, __construct) return; \ } -static void _default_exception_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC) /* {{{ */ +static void _default_exception_get_entry(zval *object, char *name, zend_str_size_int name_len, zval *return_value TSRMLS_DC) /* {{{ */ { zval *value; @@ -341,7 +343,7 @@ ZEND_METHOD(error_exception, getSeverity) #define TRACE_APPEND_STRL(val, vallen) \ { \ - int l = vallen; \ + zend_str_size l = vallen; \ *str = (char*)erealloc(*str, *len + l + 1); \ memcpy((*str) + *len, val, l); \ *len += l; \ @@ -365,10 +367,10 @@ ZEND_METHOD(error_exception, getSeverity) static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { char **str; - int *len; + zend_str_size *len; str = va_arg(args, char**); - len = va_arg(args, int*); + len = va_arg(args, zend_str_size*); /* the trivial way would be to do: * conver_to_string_ex(arg); @@ -381,7 +383,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z TRACE_APPEND_STR("NULL, "); break; case IS_STRING: { - int l_added; + zend_str_size l_added; TRACE_APPEND_CHR('\''); if (Z_STRSIZE_PP(arg) > 15) { TRACE_APPEND_STRL(Z_STRVAL_PP(arg), 15); @@ -413,7 +415,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z case IS_LONG: { long lval = Z_LVAL_PP(arg); char s_tmp[MAX_LENGTH_OF_LONG + 1]; - int l_tmp = zend_sprintf(s_tmp, "%ld", lval); /* SAFE */ + zend_str_size l_tmp = zend_sprintf(s_tmp, "%ld", lval); /* SAFE */ TRACE_APPEND_STRL(s_tmp, l_tmp); TRACE_APPEND_STR(", "); break; @@ -421,7 +423,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z case IS_DOUBLE: { double dval = Z_DVAL_PP(arg); char *s_tmp; - int l_tmp; + zend_str_size l_tmp; s_tmp = emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1); l_tmp = zend_sprintf(s_tmp, "%.*G", (int) EG(precision), dval); /* SAFE */ @@ -436,7 +438,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z break; case IS_OBJECT: { const char *class_name; - zend_uint class_name_len; + zend_str_size class_name_len; int dup; TRACE_APPEND_STR("Object("); @@ -461,7 +463,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { char *s_tmp, **str; - int *len, *num; + zend_str_size *len, *num; long line; HashTable *ht = Z_ARRVAL_PP(frame); zval **file, **tmp; @@ -472,8 +474,8 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg } str = va_arg(args, char**); - len = va_arg(args, int*); - num = va_arg(args, int*); + len = va_arg(args, zend_str_size*); + num = va_arg(args, zend_str_size*); s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 1 + 1); sprintf(s_tmp, "#%d ", (*num)++); @@ -528,7 +530,7 @@ ZEND_METHOD(exception, getTraceAsString) { zval *trace; char *res, **str, *s_tmp; - int res_len = 0, *len = &res_len, num = 0; + zend_str_size res_len = 0, *len = &res_len, num = 0; DEFAULT_0_PARAMS; @@ -560,10 +562,10 @@ ZEND_METHOD(exception, getPrevious) RETURN_ZVAL(previous, 1, 0); } -int zend_spprintf(char **message, int max_len, char *format, ...) /* {{{ */ +zend_str_size_int zend_spprintf(char **message, zend_str_size_int max_len, char *format, ...) /* {{{ */ { va_list arg; - int len; + zend_str_size len; va_start(arg, format); len = zend_vspprintf(message, max_len, format, arg); @@ -578,7 +580,7 @@ ZEND_METHOD(exception, __toString) { zval message, file, line, *trace, *exception; char *str, *prev_str; - int len = 0; + zend_str_size len = 0; zend_fcall_info fci; zval fname; @@ -783,7 +785,7 @@ ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, char } /* }}} */ -static void zend_error_va(int type, const char *file, uint lineno, const char *format, ...) /* {{{ */ +static void zend_error_va(int type, const char *file, zend_str_size_uint lineno, const char *format, ...) /* {{{ */ { va_list args; diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h index 82633530d61ad..e0c56053bd66d 100644 --- a/Zend/zend_exceptions.h +++ b/Zend/zend_exceptions.h @@ -53,7 +53,7 @@ extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC); ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC); /* do not export, in php it's available thru spprintf directly */ -int zend_spprintf(char **message, int max_len, char *format, ...); +zend_str_size_int zend_spprintf(char **message, zend_str_size_int max_len, char *format, ...); END_EXTERN_C() diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 0516d742e4412..7bc542724970d 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -226,14 +226,14 @@ static char **make_subpats_table(int num_subpats, pcre_cache_entry *pce TSRMLS_D /* {{{ pcre_get_compiled_regex_cache */ -PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_len TSRMLS_DC) +PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, zend_str_size_int regex_len TSRMLS_DC) { pcre *re = NULL; pcre_extra *extra; int coptions = 0; int soptions = 0; const char *error; - int erroffset; + zend_str_size erroffset; char delimiter; char start_delimiter; char end_delimiter; @@ -508,7 +508,7 @@ PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *pr /* }}} */ /* {{{ add_offset_pair */ -static inline void add_offset_pair(zval *result, char *str, int len, int offset, char *name) +static inline void add_offset_pair(zval *result, char *str, zend_str_size_int len, zend_str_size_int offset, char *name) { zval *match_pair; @@ -533,14 +533,14 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ * /* parameters */ char *regex; /* Regular expression */ char *subject; /* String to match against */ - int regex_len; - int subject_len; + zend_str_size regex_len; + zend_str_size subject_len; pcre_cache_entry *pce; /* Compiled regular expression */ zval *subpats = NULL; /* Array for subpatterns */ long flags = 0; /* Match control flags */ long start_offset = 0; /* Where the new search starts */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|zll", ®ex, ®ex_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|zll", ®ex, ®ex_len, &subject, &subject_len, &subpats, &flags, &start_offset) == FAILURE) { RETURN_FALSE; } @@ -556,7 +556,7 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ * /* }}} */ /* {{{ php_pcre_match_impl() */ -PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, +PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *return_value, zval *subpats, int global, int use_flags, long flags, long start_offset TSRMLS_DC) { zval *result_set, /* Holds a set of subpatterns after @@ -855,12 +855,12 @@ static int preg_get_backref(char **str, int *backref) /* {{{ preg_do_repl_func */ -static int preg_do_repl_func(zval *function, char *subject, int *offsets, char **subpat_names, int count, char **result TSRMLS_DC) +static int preg_do_repl_func(zval *function, char *subject, zend_str_size_int *offsets, char **subpat_names, int count, char **result TSRMLS_DC) { zval *retval_ptr; /* Function return value */ zval **args[1]; /* Argument to pass to function */ zval *subpats; /* Captured subpatterns */ - int result_len; /* Return value length */ + zend_str_size result_len; /* Return value length */ int i; MAKE_STD_ZVAL(subpats); @@ -894,8 +894,8 @@ static int preg_do_repl_func(zval *function, char *subject, int *offsets, char * /* {{{ preg_do_eval */ -static int preg_do_eval(char *eval_str, int eval_str_len, char *subject, - int *offsets, int count, char **result TSRMLS_DC) +static int preg_do_eval(char *eval_str, zend_str_size_int eval_str_len, char *subject, + zend_str_size_int *offsets, int count, char **result TSRMLS_DC) { zval retval; /* Return value from evaluation */ char *eval_str_end, /* End of eval string */ @@ -904,10 +904,10 @@ static int preg_do_eval(char *eval_str, int eval_str_len, char *subject, *walk, /* Used to walk the code string */ *segment, /* Start of segment to append while walking */ walk_last; /* Last walked character */ - int match_len; /* Length of the match */ - int esc_match_len; /* Length of the quote-escaped match */ - int result_len; /* Length of the result of the evaluation */ - int backref; /* Current backref */ + zend_str_size match_len; /* Length of the match */ + zend_str_size esc_match_len; /* Length of the quote-escaped match */ + zend_str_size result_len; /* Length of the result of the evaluation */ + zend_str_size backref; /* Current backref */ char *compiled_string_description; smart_str code = {0}; @@ -982,10 +982,10 @@ static int preg_do_eval(char *eval_str, int eval_str_len, char *subject, /* {{{ php_pcre_replace */ -PHPAPI char *php_pcre_replace(char *regex, int regex_len, - char *subject, int subject_len, +PHPAPI char *php_pcre_replace(char *regex, zend_str_size_int regex_len, + char *subject, zend_str_size_int subject_len, zval *replace_val, int is_callable_replace, - int *result_len, int limit, int *replace_count TSRMLS_DC) + zend_str_size_int *result_len, int limit, int *replace_count TSRMLS_DC) { pcre_cache_entry *pce; /* Compiled regular expression */ @@ -1000,8 +1000,8 @@ PHPAPI char *php_pcre_replace(char *regex, int regex_len, /* }}} */ /* {{{ php_pcre_replace_impl() */ -PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *replace_val, - int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC) +PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *replace_val, + int is_callable_replace, zend_str_size_int *result_len, int limit, int *replace_count TSRMLS_DC) { pcre_extra *extra = pce->extra;/* Holds results of studying */ pcre_extra extra_data; /* Used locally for exec options */ @@ -1011,16 +1011,16 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub char **subpat_names; /* Array for named subpatterns */ int num_subpats; /* Number of captured subpatterns */ int size_offsets; /* Size of the offsets array */ - int new_len; /* Length of needed storage */ - int alloc_len; /* Actual allocated length */ - int eval_result_len=0; /* Length of the eval'ed or + zend_str_size new_len; /* Length of needed storage */ + zend_str_size alloc_len; /* Actual allocated length */ + zend_str_size eval_result_len=0; /* Length of the eval'ed or function-returned string */ - int match_len; /* Length of the current match */ - int backref; /* Backreference number */ + zend_str_size match_len; /* Length of the current match */ + zend_str_size backref; /* Backreference number */ int eval; /* If the replacement string should be eval'ed */ - int start_offset; /* Where the new search starts */ + zend_str_size start_offset; /* Where the new search starts */ int g_notempty=0; /* If the match should not be empty */ - int replace_len=0; /* Length of replacement string */ + zend_str_size replace_len=0; /* Length of replacement string */ char *result, /* Result of replacement */ *replace=NULL, /* Replacement string */ *new_buf, /* Temporary buffer for re-allocation */ @@ -1243,7 +1243,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub /* {{{ php_replace_in_subject */ -static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, int *result_len, int limit, int is_callable_replace, int *replace_count TSRMLS_DC) +static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, zend_str_size_int *result_len, int limit, int is_callable_replace, int *replace_count TSRMLS_DC) { zval **regex_entry, **replace_entry = NULL, @@ -1251,7 +1251,7 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, empty_replace; char *subject_value, *result; - int subject_len; + zend_str_size subject_len; /* Make sure we're dealing with strings. */ convert_to_string_ex(subject); @@ -1339,7 +1339,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl **subject_entry, **zcount = NULL; char *result; - int result_len; + zend_str_size result_len; int limit_val = -1; long limit = -1; char *string_key; @@ -1459,14 +1459,14 @@ static PHP_FUNCTION(preg_split) { char *regex; /* Regular expression */ char *subject; /* String to match against */ - int regex_len; - int subject_len; + zend_str_size regex_len; + zend_str_size subject_len; long limit_val = -1;/* Integer value of limit */ long flags = 0; /* Match control flags */ pcre_cache_entry *pce; /* Compiled regular expression */ /* Get function parameters and do error checking */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ll", ®ex, ®ex_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ll", ®ex, ®ex_len, &subject, &subject_len, &limit_val, &flags) == FAILURE) { RETURN_FALSE; } @@ -1482,7 +1482,7 @@ static PHP_FUNCTION(preg_split) /* {{{ php_pcre_split */ -PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, +PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *return_value, long limit_val, long flags TSRMLS_DC) { pcre_extra *extra = NULL; /* Holds results of studying */ @@ -1653,10 +1653,10 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec Quote regular expression characters plus an optional character */ static PHP_FUNCTION(preg_quote) { - int in_str_len; + zend_str_size in_str_len; char *in_str; /* Input string argument */ char *in_str_end; /* End of the input string */ - int delim_len = 0; + zend_str_size delim_len = 0; char *delim = NULL; /* Additional delimiter argument */ char *out_str, /* Output string with quoted characters */ *p, /* Iterator for input string */ @@ -1666,7 +1666,7 @@ static PHP_FUNCTION(preg_quote) zend_bool quote_delim = 0; /* Whether to quote additional delim char */ /* Get the arguments and check for errors */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &in_str, &in_str_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &in_str, &in_str_len, &delim, &delim_len) == FAILURE) { return; } @@ -1741,13 +1741,13 @@ static PHP_FUNCTION(preg_quote) static PHP_FUNCTION(preg_grep) { char *regex; /* Regular expression */ - int regex_len; + zend_str_size regex_len; zval *input; /* Input array */ long flags = 0; /* Match control flags */ pcre_cache_entry *pce; /* Compiled regular expression */ /* Get arguments and do error checking */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa|l", ®ex, ®ex_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sa|l", ®ex, ®ex_len, &input, &flags) == FAILURE) { return; } diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h index db14ce38fc1db..4c3ec35193a72 100644 --- a/ext/pcre/php_pcre.h +++ b/ext/pcre/php_pcre.h @@ -33,7 +33,7 @@ #include #endif -PHPAPI char *php_pcre_replace(char *regex, int regex_len, char *subject, int subject_len, zval *replace_val, int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC); +PHPAPI char *php_pcre_replace(char *regex, zend_str_size_int regex_len, char *subject, zend_str_size_int subject_len, zval *replace_val, int is_callable_replace, zend_str_size_int *result_len, int limit, int *replace_count TSRMLS_DC); PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *options TSRMLS_DC); PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *preg_options, int *coptions TSRMLS_DC); @@ -52,15 +52,15 @@ typedef struct { int refcount; } pcre_cache_entry; -PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_len TSRMLS_DC); +PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, zend_str_size_int regex_len TSRMLS_DC); -PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, +PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *return_value, zval *subpats, int global, int use_flags, long flags, long start_offset TSRMLS_DC); -PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, - int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC); +PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *return_value, + int is_callable_replace, zend_str_size_int *result_len, int limit, int *replace_count TSRMLS_DC); -PHPAPI void php_pcre_split_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, +PHPAPI void php_pcre_split_impl( pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *return_value, long limit_val, long flags TSRMLS_DC); PHPAPI void php_pcre_grep_impl( pcre_cache_entry *pce, zval *input, zval *return_value, diff --git a/ext/standard/file.c b/ext/standard/file.c index cbf7dfcf950d5..482f364f0b064 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -618,7 +618,7 @@ PHP_FUNCTION(file_put_contents) switch (Z_TYPE_P(data)) { case IS_RESOURCE: { - size_t len; + zend_str_size len; if (php_stream_copy_to_stream_ex(srcstream, stream, PHP_STREAM_COPY_ALL, &len) != SUCCESS) { numbytes = -1; } else { diff --git a/ext/standard/link.c b/ext/standard/link.c index 8da63958a7ba2..80ca52b7fa7b2 100644 --- a/ext/standard/link.c +++ b/ext/standard/link.c @@ -55,11 +55,11 @@ PHP_FUNCTION(readlink) { char *link; - int link_len; + zend_str_size link_len; char buff[MAXPATHLEN]; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &link, &link_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &link, &link_len) == FAILURE) { return; } @@ -86,11 +86,11 @@ PHP_FUNCTION(linkinfo) { char *link; char *dirname; - int link_len, dir_len; + zend_str_size link_len, dir_len; struct stat sb; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &link, &link_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P", &link, &link_len) == FAILURE) { return; } @@ -119,14 +119,14 @@ PHP_FUNCTION(linkinfo) PHP_FUNCTION(symlink) { char *topath, *frompath; - int topath_len, frompath_len; + zend_str_size topath_len, frompath_len; int ret; char source_p[MAXPATHLEN]; char dest_p[MAXPATHLEN]; char dirname[MAXPATHLEN]; - size_t len; + zend_str_size len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &topath, &topath_len, &frompath, &frompath_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "PP", &topath, &topath_len, &frompath, &frompath_len) == FAILURE) { return; } @@ -177,12 +177,12 @@ PHP_FUNCTION(symlink) PHP_FUNCTION(link) { char *topath, *frompath; - int topath_len, frompath_len; + zend_str_size topath_len, frompath_len; int ret; char source_p[MAXPATHLEN]; char dest_p[MAXPATHLEN]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &topath, &topath_len, &frompath, &frompath_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "PP", &topath, &topath_len, &frompath, &frompath_len) == FAILURE) { return; } diff --git a/ext/standard/md5.c b/ext/standard/md5.c index 7fea069dbb350..69bc71d7a0f30 100644 --- a/ext/standard/md5.c +++ b/ext/standard/md5.c @@ -47,13 +47,13 @@ PHPAPI void make_digest_ex(char *md5str, const unsigned char *digest, int len) / PHP_NAMED_FUNCTION(php_if_md5) { char *arg; - int arg_len; + zend_str_size arg_len; zend_bool raw_output = 0; char md5str[33]; PHP_MD5_CTX context; unsigned char digest[16]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &arg, &arg_len, &raw_output) == FAILURE) { return; } @@ -76,7 +76,7 @@ PHP_NAMED_FUNCTION(php_if_md5) PHP_NAMED_FUNCTION(php_if_md5_file) { char *arg; - int arg_len; + zend_str_size arg_len; zend_bool raw_output = 0; char md5str[33]; unsigned char buf[1024]; @@ -85,7 +85,7 @@ PHP_NAMED_FUNCTION(php_if_md5_file) int n; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &arg, &arg_len, &raw_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|b", &arg, &arg_len, &raw_output) == FAILURE) { return; } diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index c4dbf86935f79..68e918c06c9fe 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -81,7 +81,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent char **ep; #endif char *p; - uint string_length, cnt, l, sizeenv=0, el_len; + zend_str_size string_length, cnt, l, sizeenv=0, el_len; ulong num_key; HashTable *target_hash; HashPosition pos; @@ -430,7 +430,7 @@ struct php_proc_open_descriptor_item { PHP_FUNCTION(proc_open) { char *command, *cwd=NULL; - int command_len, cwd_len = 0; + zend_str_size command_len, cwd_len = 0; zval *descriptorspec; zval *pipes; zval *environment = NULL; @@ -471,7 +471,7 @@ PHP_FUNCTION(proc_open) php_file_descriptor_t slave_pty = -1; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "saz|s!a!a!", &command, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Saz|S!a!a!", &command, &command_len, &descriptorspec, &pipes, &cwd, &cwd_len, &environment, &other_options) == FAILURE) { RETURN_FALSE; diff --git a/ext/standard/type.c b/ext/standard/type.c index 19e88866b843d..12fcd6494caf0 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -92,9 +92,9 @@ PHP_FUNCTION(settype) { zval **var; char *type; - int type_len = 0; + zend_str_size type_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zs", &var, &type, &type_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZS", &var, &type, &type_len) == FAILURE) { return; } diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c index eac389c26c459..993f42f4cf268 100644 --- a/ext/standard/uniqid.c +++ b/ext/standard/uniqid.c @@ -50,10 +50,11 @@ PHP_FUNCTION(uniqid) zend_bool more_entropy = 0; #endif char *uniqid; - int sec, usec, prefix_len = 0; + int sec, usec; + zend_str_size prefix_len = 0; struct timeval tv; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sb", &prefix, &prefix_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|Sb", &prefix, &prefix_len, &more_entropy)) { return; } diff --git a/main/output.c b/main/output.c index b80dc4b7927d5..4f9e76cdcdcd4 100644 --- a/main/output.c +++ b/main/output.c @@ -53,9 +53,9 @@ static HashTable php_output_handler_reverse_conflicts; /* {{{ forward declarations */ static inline int php_output_lock_error(int op TSRMLS_DC); -static inline void php_output_op(int op, const char *str, size_t len TSRMLS_DC); +static inline void php_output_op(int op, const char *str, zend_str_size_size_t len TSRMLS_DC); -static inline php_output_handler *php_output_handler_init(const char *name, size_t name_len, size_t chunk_size, int flags TSRMLS_DC); +static inline php_output_handler *php_output_handler_init(const char *name, zend_str_size_size_t name_len, zend_str_size_size_t chunk_size, int flags TSRMLS_DC); static inline php_output_handler_status_t php_output_handler_op(php_output_handler *handler, php_output_context *context); static inline int php_output_handler_append(php_output_handler *handler, const php_output_buffer *buf TSRMLS_DC); static inline zval *php_output_handler_status(php_output_handler *handler, zval *entry); @@ -86,12 +86,12 @@ static inline void php_output_init_globals(zend_output_globals *G) /* }}} */ /* {{{ stderr/stdout writer if not PHP_OUTPUT_ACTIVATED */ -static int php_output_stdout(const char *str, size_t str_len) +static zend_str_size_int php_output_stdout(const char *str, zend_str_size_size_t str_len) { fwrite(str, 1, str_len, stdout); return str_len; } -static int php_output_stderr(const char *str, size_t str_len) +static zend_str_size_int php_output_stderr(const char *str, zend_str_size_size_t str_len) { fwrite(str, 1, str_len, stderr); /* See http://support.microsoft.com/kb/190351 */ @@ -100,7 +100,7 @@ static int php_output_stderr(const char *str, size_t str_len) #endif return str_len; } -static int (*php_output_direct)(const char *str, size_t str_len) = php_output_stderr; +static zend_str_size_int (*php_output_direct)(const char *str, zend_str_size_size_t str_len) = php_output_stderr; /* }}} */ /* {{{ void php_output_header(TSRMLS_D) */ @@ -232,7 +232,7 @@ PHPAPI int php_output_get_status(TSRMLS_D) /* {{{ int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC) * Unbuffered write */ -PHPAPI int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC) +PHPAPI zend_str_size_int php_output_write_unbuffered(const char *str, zend_str_size_size_t len TSRMLS_DC) { if (OG(flags) & PHP_OUTPUT_DISABLED) { return 0; @@ -246,14 +246,14 @@ PHPAPI int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC) /* {{{ int php_output_write(const char *str, size_t len TSRMLS_DC) * Buffered write */ -PHPAPI int php_output_write(const char *str, size_t len TSRMLS_DC) +PHPAPI zend_str_size_int php_output_write(const char *str, zend_str_size_size_t len TSRMLS_DC) { if (OG(flags) & PHP_OUTPUT_DISABLED) { return 0; } if (OG(flags) & PHP_OUTPUT_ACTIVATED) { php_output_op(PHP_OUTPUT_HANDLER_WRITE, str, len TSRMLS_CC); - return (int) len; + return len; } return php_output_direct(str, len); } @@ -261,7 +261,7 @@ PHPAPI int php_output_write(const char *str, size_t len TSRMLS_DC) /* {{{ SUCCESS|FAILURE php_output_flush(TSRMLS_D) * Flush the most recent output handlers buffer */ -PHPAPI int php_output_flush(TSRMLS_D) +PHPAPI zend_str_size_int php_output_flush(TSRMLS_D) { php_output_context context; @@ -452,7 +452,7 @@ PHPAPI int php_output_start_user(zval *output_handler, size_t chunk_size, int fl /* {{{ SUCCESS|FAILURE php_output_start_internal(zval *name, php_output_handler_func_t handler, size_t chunk_size, int flags TSRMLS_DC) * Start an internal output handler that does not have to maintain a non-global state */ -PHPAPI int php_output_start_internal(const char *name, size_t name_len, php_output_handler_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC) +PHPAPI int php_output_start_internal(const char *name, zend_str_size_size_t name_len, php_output_handler_func_t output_handler, zend_str_size_size_t chunk_size, int flags TSRMLS_DC) { php_output_handler *handler; @@ -468,7 +468,7 @@ PHPAPI int php_output_start_internal(const char *name, size_t name_len, php_outp /* {{{ php_output_handler *php_output_handler_create_user(zval *handler, size_t chunk_size, int flags TSRMLS_DC) * Create a user level output handler */ -PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, size_t chunk_size, int flags TSRMLS_DC) +PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, zend_str_size_size_t chunk_size, int flags TSRMLS_DC) { char *handler_name = NULL, *error = NULL; php_output_handler *handler = NULL; @@ -509,7 +509,7 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, /* {{{ php_output_handler *php_output_handler_create_internal(zval *name, php_output_handler_context_func_t handler, size_t chunk_size, int flags TSRMLS_DC) * Create an internal output handler that can maintain a non-global state */ -PHPAPI php_output_handler *php_output_handler_create_internal(const char *name, size_t name_len, php_output_handler_context_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC) +PHPAPI php_output_handler *php_output_handler_create_internal(const char *name, zend_str_size_size_t name_len, php_output_handler_context_func_t output_handler, zend_str_size_size_t chunk_size, int flags TSRMLS_DC) { php_output_handler *handler; @@ -590,7 +590,7 @@ PHPAPI int php_output_handler_started(const char *name, size_t name_len TSRMLS_D /* {{{ int php_output_handler_conflict(zval *handler_new, zval *handler_old TSRMLS_DC) * Check whether a certain handler is in use and issue a warning that the new handler would conflict with the already used one */ -PHPAPI int php_output_handler_conflict(const char *handler_new, size_t handler_new_len, const char *handler_set, size_t handler_set_len TSRMLS_DC) +PHPAPI int php_output_handler_conflict(const char *handler_new, zend_str_size_size_t handler_new_len, const char *handler_set, zend_str_size_size_t handler_set_len TSRMLS_DC) { if (php_output_handler_started(handler_set, handler_set_len TSRMLS_CC)) { if (handler_new_len != handler_set_len || memcmp(handler_new, handler_set, handler_set_len)) { @@ -606,7 +606,7 @@ PHPAPI int php_output_handler_conflict(const char *handler_new, size_t handler_n /* {{{ SUCCESS|FAILURE php_output_handler_conflict_register(zval *name, php_output_handler_conflict_check_t check_func TSRMLS_DC) * Register a conflict checking function on MINIT */ -PHPAPI int php_output_handler_conflict_register(const char *name, size_t name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC) +PHPAPI int php_output_handler_conflict_register(const char *name, zend_str_size_size_t name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC) { if (!EG(current_module)) { zend_error(E_ERROR, "Cannot register an output handler conflict outside of MINIT"); @@ -618,7 +618,7 @@ PHPAPI int php_output_handler_conflict_register(const char *name, size_t name_le /* {{{ SUCCESS|FAILURE php_output_handler_reverse_conflict_register(zval *name, php_output_handler_conflict_check_t check_func TSRMLS_DC) * Register a reverse conflict checking function on MINIT */ -PHPAPI int php_output_handler_reverse_conflict_register(const char *name, size_t name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC) +PHPAPI int php_output_handler_reverse_conflict_register(const char *name, zend_str_size_size_t name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC) { HashTable rev, *rev_ptr = NULL; @@ -646,7 +646,7 @@ PHPAPI int php_output_handler_reverse_conflict_register(const char *name, size_t /* {{{ php_output_handler_alias_ctor_t php_output_handler_alias(zval *name TSRMLS_DC) * Get an internal output handler for a user handler if it exists */ -PHPAPI php_output_handler_alias_ctor_t *php_output_handler_alias(const char *name, size_t name_len TSRMLS_DC) +PHPAPI php_output_handler_alias_ctor_t *php_output_handler_alias(const char *name, zend_str_size_size_t name_len TSRMLS_DC) { php_output_handler_alias_ctor_t *func = NULL; @@ -657,7 +657,7 @@ PHPAPI php_output_handler_alias_ctor_t *php_output_handler_alias(const char *nam /* {{{ SUCCESS|FAILURE php_output_handler_alias_register(zval *name, php_output_handler_alias_ctor_t func TSRMLS_DC) * Registers an internal output handler as alias for a user handler */ -PHPAPI int php_output_handler_alias_register(const char *name, size_t name_len, php_output_handler_alias_ctor_t func TSRMLS_DC) +PHPAPI int php_output_handler_alias_register(const char *name, zend_str_size_size_t name_len, php_output_handler_alias_ctor_t func TSRMLS_DC) { if (!EG(current_module)) { zend_error(E_ERROR, "Cannot register an output handler alias outside of MINIT"); @@ -797,7 +797,7 @@ static inline void php_output_context_reset(php_output_context *context) /* {{{ static void php_output_context_feed(php_output_context *context, char *, size_t, size_t) * Feed output contexts input buffer */ -static inline void php_output_context_feed(php_output_context *context, char *data, size_t size, size_t used, zend_bool free) +static inline void php_output_context_feed(php_output_context *context, char *data, zend_str_size_size_t size, zend_str_size_size_t used, zend_bool free) { if (context->in.free && context->in.data) { efree(context->in.data); @@ -859,7 +859,7 @@ static inline void php_output_context_dtor(php_output_context *context) /* {{{ static php_output_handler *php_output_handler_init(zval *name, size_t chunk_size, int flags TSRMLS_DC) * Allocates and initializes a php_output_handler structure */ -static inline php_output_handler *php_output_handler_init(const char *name, size_t name_len, size_t chunk_size, int flags TSRMLS_DC) +static inline php_output_handler *php_output_handler_init(const char *name, zend_str_size_size_t name_len, zend_str_size_size_t chunk_size, int flags TSRMLS_DC) { php_output_handler *handler; @@ -883,9 +883,9 @@ static inline int php_output_handler_append(php_output_handler *handler, const p OG(flags) |= PHP_OUTPUT_WRITTEN; /* store it away */ if ((handler->buffer.size - handler->buffer.used) <= buf->used) { - size_t grow_int = PHP_OUTPUT_HANDLER_INITBUF_SIZE(handler->size); - size_t grow_buf = PHP_OUTPUT_HANDLER_INITBUF_SIZE(buf->used - (handler->buffer.size - handler->buffer.used)); - size_t grow_max = MAX(grow_int, grow_buf); + zend_str_size grow_int = PHP_OUTPUT_HANDLER_INITBUF_SIZE(handler->size); + zend_str_size grow_buf = PHP_OUTPUT_HANDLER_INITBUF_SIZE(buf->used - (handler->buffer.size - handler->buffer.used)); + zend_str_size grow_max = MAX(grow_int, grow_buf); handler->buffer.data = erealloc(handler->buffer.data, handler->buffer.size + grow_max); handler->buffer.size += grow_max; @@ -1260,7 +1260,7 @@ static int php_output_handler_compat_func(void **handler_context, php_output_con if (func) { char *out_str = NULL; - uint out_len = 0; + zend_str_size out_len = 0; func(output_context->in.data, output_context->in.used, &out_str, &out_len, output_context->op TSRMLS_CC); @@ -1554,9 +1554,9 @@ PHP_FUNCTION(output_reset_rewrite_vars) PHP_FUNCTION(output_add_rewrite_var) { char *name, *value; - int name_len, value_len; + zend_str_size name_len, value_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &value, &value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &name, &name_len, &value, &value_len) == FAILURE) { return; } diff --git a/main/php_output.h b/main/php_output.h index 833bddec389cf..488ce5d8320d7 100644 --- a/main/php_output.h +++ b/main/php_output.h @@ -92,8 +92,8 @@ typedef enum _php_output_handler_hook_t { typedef struct _php_output_buffer { char *data; - size_t size; - size_t used; + zend_str_size_size_t size; + zend_str_size_size_t used; uint free:1; uint _res:31; } php_output_buffer; @@ -110,15 +110,15 @@ typedef struct _php_output_context { #define PHP_OUTPUT_TSRMLS(ctx) TSRMLS_FETCH_FROM_CTX((ctx)->tsrm_ls) /* old-style, stateless callback */ -typedef void (*php_output_handler_func_t)(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC); +typedef void (*php_output_handler_func_t)(char *output, zend_str_size_uint output_len, char **handled_output, zend_str_size_uint *handled_output_len, int mode TSRMLS_DC); /* new-style, opaque context callback */ typedef int (*php_output_handler_context_func_t)(void **handler_context, php_output_context *output_context); /* output handler context dtor */ typedef void (*php_output_handler_context_dtor_t)(void *opaq TSRMLS_DC); /* conflict check callback */ -typedef int (*php_output_handler_conflict_check_t)(const char *handler_name, size_t handler_name_len TSRMLS_DC); +typedef int (*php_output_handler_conflict_check_t)(const char *handler_name, zend_str_size_size_t handler_name_len TSRMLS_DC); /* ctor for aliases */ -typedef struct _php_output_handler *(*php_output_handler_alias_ctor_t)(const char *handler_name, size_t handler_name_len, size_t chunk_size, int flags TSRMLS_DC); +typedef struct _php_output_handler *(*php_output_handler_alias_ctor_t)(const char *handler_name, zend_str_size_size_t handler_name_len, zend_str_size_size_t chunk_size, int flags TSRMLS_DC); typedef struct _php_output_handler_user_func_t { zend_fcall_info fci; @@ -128,10 +128,10 @@ typedef struct _php_output_handler_user_func_t { typedef struct _php_output_handler { char *name; - size_t name_len; + zend_str_size_size_t name_len; int flags; int level; - size_t size; + zend_str_size_size_t size; php_output_buffer buffer; void *opaq; @@ -149,7 +149,7 @@ ZEND_BEGIN_MODULE_GLOBALS(output) php_output_handler *active; php_output_handler *running; const char *output_start_filename; - int output_start_lineno; + zend_str_size_int output_start_lineno; ZEND_END_MODULE_GLOBALS(output) /* there should not be a need to use OG() from outside of output.c */ @@ -207,10 +207,10 @@ PHPAPI void php_output_set_implicit_flush(int flush TSRMLS_DC); PHPAPI const char *php_output_get_start_filename(TSRMLS_D); PHPAPI int php_output_get_start_lineno(TSRMLS_D); -PHPAPI int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC); -PHPAPI int php_output_write(const char *str, size_t len TSRMLS_DC); +PHPAPI zend_str_size_int php_output_write_unbuffered(const char *str, zend_str_size_size_t len TSRMLS_DC); +PHPAPI zend_str_size_int php_output_write(const char *str, zend_str_size_size_t len TSRMLS_DC); -PHPAPI int php_output_flush(TSRMLS_D); +PHPAPI zend_str_size_int php_output_flush(TSRMLS_D); PHPAPI void php_output_flush_all(TSRMLS_D); PHPAPI int php_output_clean(TSRMLS_D); PHPAPI void php_output_clean_all(TSRMLS_D); @@ -227,25 +227,25 @@ PHPAPI php_output_handler* php_output_get_active_handler(TSRMLS_D); PHPAPI int php_output_start_default(TSRMLS_D); PHPAPI int php_output_start_devnull(TSRMLS_D); -PHPAPI int php_output_start_user(zval *output_handler, size_t chunk_size, int flags TSRMLS_DC); -PHPAPI int php_output_start_internal(const char *name, size_t name_len, php_output_handler_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC); +PHPAPI int php_output_start_user(zval *output_handler, zend_str_size_size_t chunk_size, int flags TSRMLS_DC); +PHPAPI int php_output_start_internal(const char *name, zend_str_size_size_t name_len, php_output_handler_func_t output_handler, zend_str_size_size_t chunk_size, int flags TSRMLS_DC); -PHPAPI php_output_handler *php_output_handler_create_user(zval *handler, size_t chunk_size, int flags TSRMLS_DC); -PHPAPI php_output_handler *php_output_handler_create_internal(const char *name, size_t name_len, php_output_handler_context_func_t handler, size_t chunk_size, int flags TSRMLS_DC); +PHPAPI php_output_handler *php_output_handler_create_user(zval *handler, zend_str_size_size_t chunk_size, int flags TSRMLS_DC); +PHPAPI php_output_handler *php_output_handler_create_internal(const char *name, zend_str_size_size_t name_len, php_output_handler_context_func_t handler, zend_str_size_size_t chunk_size, int flags TSRMLS_DC); PHPAPI void php_output_handler_set_context(php_output_handler *handler, void *opaq, void (*dtor)(void* TSRMLS_DC) TSRMLS_DC); PHPAPI int php_output_handler_start(php_output_handler *handler TSRMLS_DC); -PHPAPI int php_output_handler_started(const char *name, size_t name_len TSRMLS_DC); +PHPAPI int php_output_handler_started(const char *name, zend_str_size_size_t name_len TSRMLS_DC); PHPAPI int php_output_handler_hook(php_output_handler_hook_t type, void *arg TSRMLS_DC); PHPAPI void php_output_handler_dtor(php_output_handler *handler TSRMLS_DC); PHPAPI void php_output_handler_free(php_output_handler **handler TSRMLS_DC); -PHPAPI int php_output_handler_conflict(const char *handler_new, size_t handler_new_len, const char *handler_set, size_t handler_set_len TSRMLS_DC); -PHPAPI int php_output_handler_conflict_register(const char *handler_name, size_t handler_name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC); -PHPAPI int php_output_handler_reverse_conflict_register(const char *handler_name, size_t handler_name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC); +PHPAPI int php_output_handler_conflict(const char *handler_new, zend_str_size_size_t handler_new_len, const char *handler_set, zend_str_size_size_t handler_set_len TSRMLS_DC); +PHPAPI int php_output_handler_conflict_register(const char *handler_name, zend_str_size_size_t handler_name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC); +PHPAPI int php_output_handler_reverse_conflict_register(const char *handler_name, zend_str_size_size_t handler_name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC); -PHPAPI php_output_handler_alias_ctor_t *php_output_handler_alias(const char *handler_name, size_t handler_name_len TSRMLS_DC); -PHPAPI int php_output_handler_alias_register(const char *handler_name, size_t handler_name_len, php_output_handler_alias_ctor_t func TSRMLS_DC); +PHPAPI php_output_handler_alias_ctor_t *php_output_handler_alias(const char *handler_name, zend_str_size_size_t handler_name_len TSRMLS_DC); +PHPAPI int php_output_handler_alias_register(const char *handler_name, zend_str_size_size_t handler_name_len, php_output_handler_alias_ctor_t func TSRMLS_DC); END_EXTERN_C() From 3db6b5112fcc3e3e097fc0b457bfebbd8ec77140 Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Tue, 2 Jul 2013 11:27:48 -0400 Subject: [PATCH 06/31] Get basic language tests to all pass (minus xfails) --- Zend/zend_API.h | 4 +- Zend/zend_types.h | 2 + ext/pcre/php_pcre.c | 76 ++++++++++---------- ext/pcre/php_pcre.h | 12 ++-- ext/reflection/php_reflection.c | 105 ++++++++++++++-------------- ext/standard/html.c | 84 +++++++++++----------- ext/standard/streamsfuncs.c | 50 ++++++------- ext/standard/user_filters.c | 16 ++--- main/network.c | 12 ++-- main/php_network.h | 14 ++-- main/streams/php_stream_transport.h | 26 +++---- main/streams/transports.c | 18 ++--- main/streams/userspace.c | 24 +++---- main/streams/xp_socket.c | 16 ++--- 14 files changed, 231 insertions(+), 228 deletions(-) diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 1ac2d33c756d0..a7c21fb7e3041 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -574,13 +574,13 @@ END_EXTERN_C() #define ZVAL_STRING(z, s, duplicate) do { \ const char *__s=(s); \ zval *__z = (z); \ - Z_STRSIZE_P(__z) = strlen(__s); \ + Z_STRSIZE_P(__z) = (zend_str_size) strlen(__s); \ Z_STRVAL_P(__z) = (duplicate?estrndup(__s, Z_STRSIZE_P(__z)):(char*)__s);\ Z_TYPE_P(__z) = IS_STRING; \ } while (0) #define ZVAL_STRINGL(z, s, l, duplicate) do { \ - const char *__s=(s); zend_str_size __l=l; \ + const char *__s=(s); zend_str_size __l= (zend_str_size) (l); \ zval *__z = (z); \ Z_STRSIZE_P(__z) = __l; \ Z_STRVAL_P(__z) = (duplicate?estrndup(__s, __l):(char*)__s);\ diff --git a/Zend/zend_types.h b/Zend/zend_types.h index d5fb76fc4fc8e..8ae0e683273b8 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -33,11 +33,13 @@ typedef unsigned short zend_ushort; #define zend_str_size_int int #define zend_str_size_uint unsigned int #define zend_str_size_size_t size_t +#define zend_str_size_long long typedef int zend_str_size; #else #define zend_str_size_int zend_str_size #define zend_str_size_uint zend_str_size #define zend_str_size_size_t zend_str_size +#define zend_str_size_long zend_str_size typedef size_t zend_str_size; #endif diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 7bc542724970d..cf296fc434c9f 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -226,14 +226,14 @@ static char **make_subpats_table(int num_subpats, pcre_cache_entry *pce TSRMLS_D /* {{{ pcre_get_compiled_regex_cache */ -PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, zend_str_size_int regex_len TSRMLS_DC) +PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_len TSRMLS_DC) { pcre *re = NULL; pcre_extra *extra; int coptions = 0; int soptions = 0; const char *error; - zend_str_size erroffset; + int erroffset; char delimiter; char start_delimiter; char end_delimiter; @@ -399,7 +399,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, zend_str_siz re = pcre_compile(pattern, coptions, &error, - &erroffset, + (int *) &erroffset, tables); if (re == NULL) { @@ -508,7 +508,7 @@ PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *pr /* }}} */ /* {{{ add_offset_pair */ -static inline void add_offset_pair(zval *result, char *str, zend_str_size_int len, zend_str_size_int offset, char *name) +static inline void add_offset_pair(zval *result, char *str, zend_str_size_int len, long offset, char *name) { zval *match_pair; @@ -546,17 +546,17 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ * } /* Compile regex or get it from cache. */ - if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) { + if ((pce = pcre_get_compiled_regex_cache(regex, (int) regex_len TSRMLS_CC)) == NULL) { RETURN_FALSE; } - php_pcre_match_impl(pce, subject, subject_len, return_value, subpats, + php_pcre_match_impl(pce, subject, (int) subject_len, return_value, subpats, global, ZEND_NUM_ARGS() >= 4, flags, start_offset TSRMLS_CC); } /* }}} */ /* {{{ php_pcre_match_impl() */ -PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *return_value, +PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, zval *subpats, int global, int use_flags, long flags, long start_offset TSRMLS_DC) { zval *result_set, /* Holds a set of subpatterns after @@ -855,12 +855,12 @@ static int preg_get_backref(char **str, int *backref) /* {{{ preg_do_repl_func */ -static int preg_do_repl_func(zval *function, char *subject, zend_str_size_int *offsets, char **subpat_names, int count, char **result TSRMLS_DC) +static int preg_do_repl_func(zval *function, char *subject, int *offsets, char **subpat_names, int count, char **result TSRMLS_DC) { zval *retval_ptr; /* Function return value */ zval **args[1]; /* Argument to pass to function */ zval *subpats; /* Captured subpatterns */ - zend_str_size result_len; /* Return value length */ + int result_len; /* Return value length */ int i; MAKE_STD_ZVAL(subpats); @@ -894,8 +894,8 @@ static int preg_do_repl_func(zval *function, char *subject, zend_str_size_int *o /* {{{ preg_do_eval */ -static int preg_do_eval(char *eval_str, zend_str_size_int eval_str_len, char *subject, - zend_str_size_int *offsets, int count, char **result TSRMLS_DC) +static int preg_do_eval(char *eval_str, int eval_str_len, char *subject, + int *offsets, int count, char **result TSRMLS_DC) { zval retval; /* Return value from evaluation */ char *eval_str_end, /* End of eval string */ @@ -904,10 +904,10 @@ static int preg_do_eval(char *eval_str, zend_str_size_int eval_str_len, char *su *walk, /* Used to walk the code string */ *segment, /* Start of segment to append while walking */ walk_last; /* Last walked character */ - zend_str_size match_len; /* Length of the match */ - zend_str_size esc_match_len; /* Length of the quote-escaped match */ - zend_str_size result_len; /* Length of the result of the evaluation */ - zend_str_size backref; /* Current backref */ + zend_str_size match_len; /* Length of the match */ + zend_str_size esc_match_len; /* Length of the quote-escaped match */ + zend_str_size result_len; /* Length of the result of the evaluation */ + int backref; /* Current backref */ char *compiled_string_description; smart_str code = {0}; @@ -982,10 +982,10 @@ static int preg_do_eval(char *eval_str, zend_str_size_int eval_str_len, char *su /* {{{ php_pcre_replace */ -PHPAPI char *php_pcre_replace(char *regex, zend_str_size_int regex_len, - char *subject, zend_str_size_int subject_len, +PHPAPI char *php_pcre_replace(char *regex, int regex_len, + char *subject, int subject_len, zval *replace_val, int is_callable_replace, - zend_str_size_int *result_len, int limit, int *replace_count TSRMLS_DC) + int *result_len, int limit, int *replace_count TSRMLS_DC) { pcre_cache_entry *pce; /* Compiled regular expression */ @@ -1000,27 +1000,27 @@ PHPAPI char *php_pcre_replace(char *regex, zend_str_size_int regex_len, /* }}} */ /* {{{ php_pcre_replace_impl() */ -PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *replace_val, - int is_callable_replace, zend_str_size_int *result_len, int limit, int *replace_count TSRMLS_DC) +PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *replace_val, + int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC) { pcre_extra *extra = pce->extra;/* Holds results of studying */ pcre_extra extra_data; /* Used locally for exec options */ int exoptions = 0; /* Execution options */ int count = 0; /* Count of matched subpatterns */ - int *offsets; /* Array of subpattern offsets */ + int *offsets; /* Array of subpattern offsets */ char **subpat_names; /* Array for named subpatterns */ int num_subpats; /* Number of captured subpatterns */ int size_offsets; /* Size of the offsets array */ - zend_str_size new_len; /* Length of needed storage */ - zend_str_size alloc_len; /* Actual allocated length */ - zend_str_size eval_result_len=0; /* Length of the eval'ed or + int new_len; /* Length of needed storage */ + int alloc_len; /* Actual allocated length */ + int eval_result_len=0; /* Length of the eval'ed or function-returned string */ - zend_str_size match_len; /* Length of the current match */ - zend_str_size backref; /* Backreference number */ + int match_len; /* Length of the current match */ + int backref; /* Backreference number */ int eval; /* If the replacement string should be eval'ed */ - zend_str_size start_offset; /* Where the new search starts */ + int start_offset; /* Where the new search starts */ int g_notempty=0; /* If the match should not be empty */ - zend_str_size replace_len=0; /* Length of replacement string */ + int replace_len=0; /* Length of replacement string */ char *result, /* Result of replacement */ *replace=NULL, /* Replacement string */ *new_buf, /* Temporary buffer for re-allocation */ @@ -1243,7 +1243,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, zend_st /* {{{ php_replace_in_subject */ -static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, zend_str_size_int *result_len, int limit, int is_callable_replace, int *replace_count TSRMLS_DC) +static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, int *result_len, int limit, int is_callable_replace, int *replace_count TSRMLS_DC) { zval **regex_entry, **replace_entry = NULL, @@ -1251,7 +1251,7 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, empty_replace; char *subject_value, *result; - zend_str_size subject_len; + int subject_len; /* Make sure we're dealing with strings. */ convert_to_string_ex(subject); @@ -1339,7 +1339,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl **subject_entry, **zcount = NULL; char *result; - zend_str_size result_len; + int result_len; int limit_val = -1; long limit = -1; char *string_key; @@ -1397,11 +1397,11 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl switch(zend_hash_get_current_key(Z_ARRVAL_PP(subject), &string_key, &num_key, 0)) { case HASH_KEY_IS_STRING: - add_assoc_stringl(return_value, string_key, result, result_len, 0); + add_assoc_stringl(return_value, string_key, result, (zend_str_size) result_len, 0); break; case HASH_KEY_IS_LONG: - add_index_stringl(return_value, num_key, result, result_len, 0); + add_index_stringl(return_value, num_key, result, (zend_str_size) result_len, 0); break; } } else { @@ -1415,7 +1415,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl old_replace_count = replace_count; if ((result = php_replace_in_subject(*regex, *replace, subject, &result_len, limit_val, is_callable_replace, &replace_count TSRMLS_CC)) != NULL) { if (!is_filter || replace_count > old_replace_count) { - RETVAL_STRINGL(result, result_len, 0); + RETVAL_STRINGL(result, (zend_str_size) result_len, 0); } else { efree(result); } @@ -1472,17 +1472,17 @@ static PHP_FUNCTION(preg_split) } /* Compile regex or get it from cache. */ - if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) { + if ((pce = pcre_get_compiled_regex_cache(regex, (int) regex_len TSRMLS_CC)) == NULL) { RETURN_FALSE; } - php_pcre_split_impl(pce, subject, subject_len, return_value, limit_val, flags TSRMLS_CC); + php_pcre_split_impl(pce, subject, (int) subject_len, return_value, limit_val, flags TSRMLS_CC); } /* }}} */ /* {{{ php_pcre_split */ -PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *return_value, +PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, long limit_val, long flags TSRMLS_DC) { pcre_extra *extra = NULL; /* Holds results of studying */ @@ -1753,7 +1753,7 @@ static PHP_FUNCTION(preg_grep) } /* Compile regex or get it from cache. */ - if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) { + if ((pce = pcre_get_compiled_regex_cache(regex, (int) regex_len TSRMLS_CC)) == NULL) { RETURN_FALSE; } diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h index 4c3ec35193a72..db14ce38fc1db 100644 --- a/ext/pcre/php_pcre.h +++ b/ext/pcre/php_pcre.h @@ -33,7 +33,7 @@ #include #endif -PHPAPI char *php_pcre_replace(char *regex, zend_str_size_int regex_len, char *subject, zend_str_size_int subject_len, zval *replace_val, int is_callable_replace, zend_str_size_int *result_len, int limit, int *replace_count TSRMLS_DC); +PHPAPI char *php_pcre_replace(char *regex, int regex_len, char *subject, int subject_len, zval *replace_val, int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC); PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *options TSRMLS_DC); PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *preg_options, int *coptions TSRMLS_DC); @@ -52,15 +52,15 @@ typedef struct { int refcount; } pcre_cache_entry; -PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, zend_str_size_int regex_len TSRMLS_DC); +PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_len TSRMLS_DC); -PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *return_value, +PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, zval *subpats, int global, int use_flags, long flags, long start_offset TSRMLS_DC); -PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *return_value, - int is_callable_replace, zend_str_size_int *result_len, int limit, int *replace_count TSRMLS_DC); +PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, + int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC); -PHPAPI void php_pcre_split_impl( pcre_cache_entry *pce, char *subject, zend_str_size_int subject_len, zval *return_value, +PHPAPI void php_pcre_split_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, long limit_val, long flags TSRMLS_DC); PHPAPI void php_pcre_grep_impl( pcre_cache_entry *pce, zval *input, zval *return_value, diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index caeceaeb3e7cf..8b0a824752f72 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -114,8 +114,8 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection) /* {{{ Smart string functions */ typedef struct _string { char *string; - int len; - int alloced; + zend_str_size_int len; + zend_str_size_int alloced; } string; static void string_init(string *str) @@ -128,14 +128,14 @@ static void string_init(string *str) static string *string_printf(string *str, const char *format, ...) { - int len; + zend_str_size len; va_list arg; char *s_tmp; va_start(arg, format); len = zend_vspprintf(&s_tmp, 0, format, arg); if (len) { - register int nlen = (str->len + len + (1024 - 1)) & ~(1024 - 1); + register zend_str_size nlen = (str->len + len + (1024 - 1)) & ~(1024 - 1); if (str->alloced < nlen) { str->alloced = nlen; str->string = erealloc(str->string, str->alloced); @@ -148,9 +148,9 @@ static string *string_printf(string *str, const char *format, ...) return str; } -static string *string_write(string *str, char *buf, int len) +static string *string_write(string *str, char *buf, zend_str_size_int len) { - register int nlen = (str->len + len + (1024 - 1)) & ~(1024 - 1); + register zend_str_size nlen = (str->len + len + (1024 - 1)) & ~(1024 - 1); if (str->alloced < nlen) { str->alloced = nlen; str->string = erealloc(str->string, str->alloced); @@ -188,8 +188,8 @@ typedef struct _property_reference { /* Struct for parameters */ typedef struct _parameter_reference { - zend_uint offset; - zend_uint required; + zend_str_size_uint offset; + zend_str_size_uint required; struct _zend_arg_info *arg_info; zend_function *fptr; } parameter_reference; @@ -216,7 +216,7 @@ typedef struct { static zend_object_handlers reflection_object_handlers; -static void _default_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC) /* {{{ */ +static void _default_get_entry(zval *object, char *name, zend_str_size_int name_len, zval *return_value TSRMLS_DC) /* {{{ */ { zval **value; @@ -229,7 +229,7 @@ static void _default_get_entry(zval *object, char *name, int name_len, zval *ret /* }}} */ #ifdef ilia_0 -static void _default_lookup_entry(zval *object, char *name, int name_len, zval **return_value TSRMLS_DC) /* {{{ */ +static void _default_lookup_entry(zval *object, char *name, zend_str_size_int name_len, zval **return_value TSRMLS_DC) /* {{{ */ { zval **value; @@ -435,7 +435,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in HashPosition pos; zval **value; char *key; - uint key_len; + zend_str_size key_len; ulong num_index; zend_hash_internal_pointer_reset_ex(&ce->constants_table, &pos); @@ -566,7 +566,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) { char *prop_name; - uint prop_name_size; + zend_str_size prop_name_size; ulong index; if (zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 1, &pos) == HASH_KEY_IS_STRING) { @@ -605,9 +605,9 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) { char *key; - uint key_len; + zend_str_size key_len; ulong num_index; - uint len = strlen(mptr->common.function_name); + zend_str_size len = strlen(mptr->common.function_name); /* Do not display old-style inherited constructors */ if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 @@ -790,7 +790,7 @@ static void _function_closure_string(string *str, zend_function *fptr, char* ind zend_uint i, count; ulong num_index; char *key; - uint key_len; + zend_str_size key_len; HashTable *static_variables; HashPosition pos; @@ -824,7 +824,7 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry string param_indent; zend_function *overwrites; char *lc_name; - unsigned int lc_name_len; + zend_str_size lc_name_len; /* TBD: Repair indenting of doc comment (or is this to be done in the parser?) * What's "wrong" is that any whitespace before the doc comment start is @@ -1113,7 +1113,7 @@ static void _extension_string(string *str, zend_module_entry *module, char *inde /* Is there a better way of doing this? */ while (func->fname) { - int fname_len = strlen(func->fname); + zend_str_size fname_len = strlen(func->fname); char *lc_name = zend_str_tolower_dup(func->fname, fname_len); if (zend_hash_find(EG(function_table), lc_name, fname_len + 1, (void**) &fptr) == FAILURE) { @@ -1209,7 +1209,7 @@ static void reflection_extension_factory(zval *object, const char *name_str TSRM { reflection_object *intern; zval *name; - int name_len = strlen(name_str); + zend_str_size name_len = strlen(name_str); char *lcname; struct _zend_module_entry *module; ALLOCA_FLAG(use_heap) @@ -1607,7 +1607,7 @@ ZEND_METHOD(reflection_function, __construct) reflection_object *intern; zend_function *fptr; char *name_str; - int name_len; + zend_str_size name_len; object = getThis(); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); @@ -1618,7 +1618,7 @@ ZEND_METHOD(reflection_function, __construct) if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "O", &closure, zend_ce_closure) == SUCCESS) { fptr = (zend_function*)zend_get_closure_method_def(closure TSRMLS_CC); Z_ADDREF_P(closure); - } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == SUCCESS) { + } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name_str, &name_len) == SUCCESS) { char *nsname; lcname = zend_str_tolower_dup(name_str, name_len); @@ -2162,7 +2162,7 @@ ZEND_METHOD(reflection_parameter, __construct) /* First, find the function */ switch (Z_TYPE_P(reference)) { case IS_STRING: { - unsigned int lcname_len; + zend_str_size lcname_len; char *lcname; lcname_len = Z_STRSIZE_P(reference); @@ -2182,7 +2182,7 @@ ZEND_METHOD(reflection_parameter, __construct) zval **classref; zval **method; zend_class_entry **pce; - unsigned int lcname_len; + zend_str_size lcname_len; char *lcname; if ((zend_hash_index_find(Z_ARRVAL_P(reference), 0, (void **) &classref) == FAILURE) @@ -2672,11 +2672,11 @@ ZEND_METHOD(reflection_method, __construct) zend_class_entry *ce; zend_function *mptr; char *name_str, *tmp; - int name_len, tmp_len; + zend_str_size name_len, tmp_len; zval ztmp; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "zs", &classname, &name_str, &name_len) == FAILURE) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "zS", &classname, &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name_str, &name_len) == FAILURE) { return; } if ((tmp = strstr(name_str, "::")) == NULL) { @@ -3352,7 +3352,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value zend_property_info *prop_info; zval *prop, *prop_copy; char *key; - uint key_len; + zend_str_size key_len; ulong num_index; zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos); @@ -3423,10 +3423,10 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue) reflection_object *intern; zend_class_entry *ce; char *name; - int name_len; + zend_str_size name_len; zval **prop, *def_value = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &name, &name_len, &def_value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|z", &name, &name_len, &def_value) == FAILURE) { return; } @@ -3455,12 +3455,12 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue) reflection_object *intern; zend_class_entry *ce; char *name; - int name_len; + zend_str_size name_len; zval **variable_ptr, *value; int refcount; zend_uchar is_ref; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name, &name_len, &value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &name, &name_len, &value) == FAILURE) { return; } @@ -3660,10 +3660,10 @@ ZEND_METHOD(reflection_class, hasMethod) reflection_object *intern; zend_class_entry *ce; char *name, *lc_name; - int name_len; + zend_str_size name_len; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { return; } @@ -3690,10 +3690,10 @@ ZEND_METHOD(reflection_class, getMethod) zend_function *mptr; zval obj_tmp; char *name, *lc_name; - int name_len; + zend_str_size name_len; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { return; } @@ -3731,7 +3731,7 @@ ZEND_METHOD(reflection_class, getMethod) static void _addmethod(zend_function *mptr, zend_class_entry *ce, zval *retval, long filter, zval *obj TSRMLS_DC) { zval *method; - uint len = strlen(mptr->common.function_name); + zend_str_size len = strlen(mptr->common.function_name); zend_function *closure; if (mptr->common.fn_flags & filter) { @@ -3805,11 +3805,11 @@ ZEND_METHOD(reflection_class, hasProperty) zend_property_info *property_info; zend_class_entry *ce; char *name; - int name_len; + zend_str_size name_len; zval *property; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { return; } @@ -3842,10 +3842,10 @@ ZEND_METHOD(reflection_class, getProperty) zend_class_entry *ce, **pce; zend_property_info *property_info; char *name, *tmp, *classname; - int name_len, classname_len; + zend_str_size name_len, classname_len; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { return; } @@ -3992,10 +3992,10 @@ ZEND_METHOD(reflection_class, hasConstant) reflection_object *intern; zend_class_entry *ce; char *name; - int name_len; + zend_str_size name_len; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { return; } @@ -4034,10 +4034,10 @@ ZEND_METHOD(reflection_class, getConstant) zend_class_entry *ce; zval **value; char *name; - int name_len; + zend_str_size name_len; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { return; } @@ -4772,7 +4772,8 @@ ZEND_METHOD(reflection_property, __construct) zval *propname, *classname; char *name_str; const char *class_name, *prop_name; - int name_len, dynam_prop = 0; + zend_str_size name_len; + int dynam_prop = 0; zval *object; reflection_object *intern; zend_class_entry **pce; @@ -4780,7 +4781,7 @@ ZEND_METHOD(reflection_property, __construct) zend_property_info *property_info = NULL; property_reference *reference; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &classname, &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &classname, &name_str, &name_len) == FAILURE) { return; } @@ -5091,7 +5092,7 @@ ZEND_METHOD(reflection_property, getDeclaringClass) zend_class_entry *tmp_ce, *ce; zend_property_info *tmp_info; const char *prop_name, *class_name; - int prop_name_len; + zend_str_size prop_name_len; if (zend_parse_parameters_none() == FAILURE) { return; @@ -5178,10 +5179,10 @@ ZEND_METHOD(reflection_extension, __construct) reflection_object *intern; zend_module_entry *module; char *name_str; - int name_len; + zend_str_size name_len; ALLOCA_FLAG(use_heap) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name_str, &name_len) == FAILURE) { return; } @@ -5278,7 +5279,7 @@ ZEND_METHOD(reflection_extension, getFunctions) /* Is there a better way of doing this? */ while (func->fname) { - int fname_len = strlen(func->fname); + zend_str_size fname_len = strlen(func->fname); char *lc_name = zend_str_tolower_dup(func->fname, fname_len); if (zend_hash_find(EG(function_table), lc_name, fname_len + 1, (void**) &fptr) == FAILURE) { @@ -5445,7 +5446,7 @@ ZEND_METHOD(reflection_extension, getDependencies) while(dep->name) { char *relation; char *rel_type; - int len; + zend_str_size len; switch(dep->type) { case MODULE_DEP_REQUIRED: @@ -5539,9 +5540,9 @@ ZEND_METHOD(reflection_zend_extension, __construct) reflection_object *intern; zend_extension *extension; char *name_str; - int name_len; + zend_str_size name_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name_str, &name_len) == FAILURE) { return; } diff --git a/ext/standard/html.c b/ext/standard/html.c index 414fa65c91d3b..f24bde58fa013 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -89,11 +89,11 @@ static inline unsigned int get_next_char( enum entity_charset charset, const unsigned char *str, - size_t str_len, - size_t *cursor, + zend_str_size_size_t str_len, + zend_str_size_size_t *cursor, int *status) { - size_t pos = *cursor; + zend_str_size pos = *cursor; unsigned int this_char = 0; *status = SUCCESS; @@ -350,8 +350,8 @@ static inline unsigned int get_next_char( * Public interface for get_next_char used with UTF-8 */ PHPAPI unsigned int php_next_utf8_char( const unsigned char *str, - size_t str_len, - size_t *cursor, + zend_str_size_size_t str_len, + zend_str_size_size_t *cursor, int *status) { return get_next_char(cs_utf_8, str, str_len, cursor, status); @@ -365,7 +365,7 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC) { int i; enum entity_charset charset = cs_utf_8; - int len = 0; + zend_str_size len = 0; const zend_encoding *zenc; /* Default is now UTF-8 */ @@ -456,9 +456,9 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC) /* }}} */ /* {{{ php_utf32_utf8 */ -static inline size_t php_utf32_utf8(unsigned char *buf, unsigned k) +static inline zend_str_size_size_t php_utf32_utf8(unsigned char *buf, unsigned k) { - size_t retval = 0; + zend_str_size retval = 0; /* assert(0x0 <= k <= 0x10FFFF); */ @@ -533,7 +533,7 @@ static inline size_t php_mb3_int_to_char(unsigned char *buf, unsigned k) * Returns the code point in the target charset (whose mapping table was given) or 0 if * the unicode code point is not in the table. */ -static inline unsigned char unimap_bsearch(const uni_to_enc *table, unsigned code_key_a, size_t num) +static inline unsigned char unimap_bsearch(const uni_to_enc *table, unsigned code_key_a, zend_str_size_size_t num) { const uni_to_enc *l = table, *h = &table[num-1], @@ -812,7 +812,7 @@ static inline int process_numeric_entity(const char **buf, unsigned *code_point) /* }}} */ /* {{{ process_named_entity */ -static inline int process_named_entity_html(const char **buf, const char **start, size_t *length) +static inline int process_named_entity_html(const char **buf, const char **start, zend_str_size_size_t *length) { *start = *buf; @@ -841,7 +841,7 @@ static inline int process_named_entity_html(const char **buf, const char **start /* }}} */ /* {{{ resolve_named_entity_html */ -static inline int resolve_named_entity_html(const char *start, size_t length, const entity_ht *ht, unsigned *uni_cp1, unsigned *uni_cp2) +static inline int resolve_named_entity_html(const char *start, zend_str_size_size_t length, const entity_ht *ht, unsigned *uni_cp1, unsigned *uni_cp2) { const entity_cp_map *s; ulong hash = zend_inline_hash_func(start, length); @@ -923,9 +923,9 @@ static inline size_t write_octet_sequence(unsigned char *buf, enum entity_charse #define TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(oldlen) ((oldlen) + (oldlen) / 5 + 2) static void traverse_for_entities( const char *old, - size_t oldlen, + zend_str_size_size_t oldlen, char *ret, /* should have allocated TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(olden) */ - size_t *retlen, + zend_str_size_size_t *retlen, int all, int flags, const entity_ht *inv_map, @@ -977,7 +977,7 @@ static void traverse_for_entities( goto invalid_code; } else { const char *start; - size_t ent_len; + zend_str_size ent_len; next = &p[1]; start = next; @@ -1083,13 +1083,13 @@ static entity_table_opt determine_entity_table(int all, int doctype) * only the basic ones, i.e., those in basic_entities_ex + the numeric entities * that correspond to quotes. */ -PHPAPI char *php_unescape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC) +PHPAPI char *php_unescape_html_entities(unsigned char *old, zend_str_size_size_t oldlen, zend_str_size_size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC) { - size_t retlen; + zend_str_size retlen; char *ret; enum entity_charset charset; const entity_ht *inverse_map = NULL; - size_t new_size = TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(oldlen); + zend_str_size new_size = TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(oldlen); if (all) { charset = determine_charset(hint_charset TSRMLS_CC); @@ -1123,7 +1123,7 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, size_t oldlen, size_ } /* }}} */ -PHPAPI char *php_escape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC) +PHPAPI char *php_escape_html_entities(unsigned char *old, zend_str_size_size_t oldlen, zend_str_size_size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC) { return php_escape_html_entities_ex(old, oldlen, newlen, all, flags, hint_charset, 1 TSRMLS_CC); } @@ -1134,10 +1134,10 @@ static inline void find_entity_for_char( enum entity_charset charset, const entity_stage1_row *table, const unsigned char **entity, - size_t *entity_len, + zend_str_size_size_t *entity_len, unsigned char *old, - size_t oldlen, - size_t *cursor) + zend_str_size_size_t oldlen, + zend_str_size_size_t *cursor) { unsigned stage1_idx = ENT_STAGE1_INDEX(k); const entity_stage3_row *c; @@ -1155,7 +1155,7 @@ static inline void find_entity_for_char( *entity_len = c->data.ent.entity_len; } else { /* peek at next char */ - size_t cursor_before = *cursor; + zend_str_size cursor_before = *cursor; int status = SUCCESS; unsigned next_char; @@ -1196,7 +1196,7 @@ static inline void find_entity_for_char_basic( unsigned int k, const entity_stage3_row *table, const unsigned char **entity, - size_t *entity_len) + zend_str_size_size_t *entity_len) { if (k >= 64U) { *entity = NULL; @@ -1211,9 +1211,9 @@ static inline void find_entity_for_char_basic( /* {{{ php_escape_html_entities */ -PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset, zend_bool double_encode TSRMLS_DC) +PHPAPI char *php_escape_html_entities_ex(unsigned char *old, zend_str_size_size_t oldlen, zend_str_size_size_t *newlen, int all, int flags, char *hint_charset, zend_bool double_encode TSRMLS_DC) { - size_t cursor, maxlen, len; + zend_str_size cursor, maxlen, len; char *replaced; enum entity_charset charset = determine_charset(hint_charset TSRMLS_CC); int doctype = flags & ENT_HTML_DOC_TYPE_MASK; @@ -1269,7 +1269,7 @@ PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size cursor = 0; while (cursor < oldlen) { const unsigned char *mbsequence = NULL; - size_t mbseqlen = 0, + zend_str_size mbseqlen = 0, cursor_before = cursor; int status = SUCCESS; unsigned int this_char = get_next_char(charset, old, oldlen, &cursor, &status); @@ -1374,7 +1374,7 @@ PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size len += sizeof("&") - 1; } else { /* no double encode */ /* check if entity is valid */ - size_t ent_len; /* not counting & or ; */ + zend_str_size ent_len; /* not counting & or ; */ /* peek at next char */ if (old[cursor] == '#') { /* numeric entity */ unsigned code_point; @@ -1433,13 +1433,13 @@ PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) { char *str, *hint_charset = NULL; - int str_len, hint_charset_len = 0; + zend_str_size str_len, hint_charset_len = 0; size_t new_len; long flags = ENT_COMPAT; char *replaced; zend_bool double_encode = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!b", &str, &str_len, &flags, &hint_charset, &hint_charset_len, &double_encode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lS!b", &str, &str_len, &flags, &hint_charset, &hint_charset_len, &double_encode) == FAILURE) { return; } @@ -1483,18 +1483,18 @@ PHP_FUNCTION(htmlspecialchars) PHP_FUNCTION(htmlspecialchars_decode) { char *str; - int str_len; - size_t new_len = 0; + zend_str_size str_len; + zend_str_size new_len = 0; long quote_style = ENT_COMPAT; char *replaced; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, "e_style) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &str_len, "e_style) == FAILURE) { return; } replaced = php_unescape_html_entities(str, str_len, &new_len, 0 /*!all*/, quote_style, NULL TSRMLS_CC); if (replaced) { - RETURN_STRINGL(replaced, (int)new_len, 0); + RETURN_STRINGL(replaced, new_len, 0); } RETURN_FALSE; } @@ -1505,19 +1505,19 @@ PHP_FUNCTION(htmlspecialchars_decode) PHP_FUNCTION(html_entity_decode) { char *str, *hint_charset = NULL; - int str_len, hint_charset_len = 0; - size_t new_len = 0; + zend_str_size str_len, hint_charset_len = 0; + zend_str_size new_len = 0; long quote_style = ENT_COMPAT; char *replaced; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lS", &str, &str_len, "e_style, &hint_charset, &hint_charset_len) == FAILURE) { return; } replaced = php_unescape_html_entities(str, str_len, &new_len, 1 /*all*/, quote_style, hint_charset TSRMLS_CC); if (replaced) { - RETURN_STRINGL(replaced, (int)new_len, 0); + RETURN_STRINGL(replaced, new_len, 0); } RETURN_FALSE; } @@ -1541,12 +1541,12 @@ static inline void write_s3row_data( { char key[9] = ""; /* two unicode code points in UTF-8 */ char entity[LONGEST_ENTITY_LENGTH + 2] = {'&'}; - size_t written_k1; + zend_str_size written_k1; written_k1 = write_octet_sequence(key, charset, orig_cp); if (!r->ambiguous) { - size_t l = r->data.ent.entity_len; + zend_str_size l = r->data.ent.entity_len; memcpy(&entity[1], r->data.ent.entity, l); entity[l + 1] = ';'; add_assoc_stringl_ex(arr, key, written_k1 + 1, entity, l + 2, 1); @@ -1563,7 +1563,7 @@ static inline void write_s3row_data( } num_entries = mcpr[0].leading_entry.size; for (i = 1; i <= num_entries; i++) { - size_t l, + zend_str_size l, written_k2; unsigned uni_cp, spe_cp; @@ -1598,14 +1598,14 @@ PHP_FUNCTION(get_html_translation_table) entity_table_opt entity_table; const enc_to_uni *to_uni_table; char *charset_hint = NULL; - int charset_hint_len; + zend_str_size charset_hint_len; enum entity_charset charset; /* in this function we have to jump through some loops because we're * getting the translated table from data structures that are optimized for * random access, not traversal */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lls", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|llS", &all, &flags, &charset_hint, &charset_hint_len) == FAILURE) { return; } diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index f487763b9e02b..69bc913be47cb 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -86,7 +86,7 @@ PHP_FUNCTION(stream_socket_pair) PHP_FUNCTION(stream_socket_client) { char *host; - int host_len; + zend_str_size host_len; zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL; double timeout = FG(default_socket_timeout); php_timeout_ull conv; @@ -100,7 +100,7 @@ PHP_FUNCTION(stream_socket_client) RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zzdlr", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|zzdlr", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -175,7 +175,7 @@ PHP_FUNCTION(stream_socket_client) PHP_FUNCTION(stream_socket_server) { char *host; - int host_len; + zend_str_size host_len; zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL; php_stream *stream = NULL; int err = 0; @@ -185,7 +185,7 @@ PHP_FUNCTION(stream_socket_server) RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zzlr", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|zzlr", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -242,7 +242,7 @@ PHP_FUNCTION(stream_socket_accept) double timeout = FG(default_socket_timeout); zval *zpeername = NULL; char *peername = NULL; - int peername_len; + zend_str_size peername_len; php_timeout_ull conv; struct timeval tv; php_stream *stream = NULL, *clistream = NULL; @@ -300,7 +300,7 @@ PHP_FUNCTION(stream_socket_get_name) zval *zstream; zend_bool want_peer; char *name = NULL; - int name_len; + zend_str_size name_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb", &zstream, &want_peer) == FAILURE) { RETURN_FALSE; @@ -328,11 +328,11 @@ PHP_FUNCTION(stream_socket_sendto) zval *zstream; long flags = 0; char *data, *target_addr = NULL; - int datalen, target_addr_len = 0; + zend_str_size datalen, target_addr_len = 0; php_sockaddr_storage sa; socklen_t sl = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ls", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS|lS", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) { RETURN_FALSE; } php_stream_from_zval(stream, &zstream); @@ -356,7 +356,7 @@ PHP_FUNCTION(stream_socket_recvfrom) php_stream *stream; zval *zstream, *zremote = NULL; char *remote_addr = NULL; - int remote_addr_len; + zend_str_size remote_addr_len; long to_read = 0; char *read_buf; long flags = 0; @@ -407,7 +407,7 @@ PHP_FUNCTION(stream_get_contents) zval *zsrc; long maxlen = PHP_STREAM_COPY_ALL, desiredpos = -1L; - int len; + zend_str_size len; char *contents = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zsrc, &maxlen, &desiredpos) == FAILURE) { @@ -417,7 +417,7 @@ PHP_FUNCTION(stream_get_contents) php_stream_from_zval(stream, &zsrc); if (desiredpos >= 0) { - int seek_res = 0; + zend_str_size seek_res = 0; off_t position; position = php_stream_tell(stream); @@ -453,7 +453,7 @@ PHP_FUNCTION(stream_copy_to_stream) php_stream *src, *dest; zval *zsrc, *zdest; long maxlen = PHP_STREAM_COPY_ALL, pos = 0; - size_t len; + zend_str_size len; int ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|ll", &zsrc, &zdest, &maxlen, &pos) == FAILURE) { @@ -542,7 +542,7 @@ PHP_FUNCTION(stream_get_transports) { HashTable *stream_xport_hash; char *stream_xport; - uint stream_xport_len; + zend_str_size stream_xport_len; ulong num_key; if (zend_parse_parameters_none() == FAILURE) { @@ -572,7 +572,7 @@ PHP_FUNCTION(stream_get_wrappers) HashTable *url_stream_wrappers_hash; char *stream_protocol; int key_flags; - uint stream_protocol_len = 0; + zend_str_size stream_protocol_len = 0; ulong num_key; if (zend_parse_parameters_none() == FAILURE) { @@ -658,7 +658,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC) int type; char *key; - uint key_len; + zend_str_size key_len; ulong num_ind; /* Temporary int fd is needed for the STREAM data type on windows, passing this_fd directly to php_stream_cast() would eventually bring a wrong result on x64. php_stream_cast() casts to int internally, and this will leave @@ -872,7 +872,7 @@ PHP_FUNCTION(stream_select) /* {{{ stream_context related functions */ static void user_space_stream_notifier(php_stream_context *context, int notifycode, int severity, - char *xmsg, int xcode, size_t bytes_sofar, size_t bytes_max, void * ptr TSRMLS_DC) + char *xmsg, int xcode, zend_str_size_size_t bytes_sofar, zend_str_size_size_t bytes_max, void * ptr TSRMLS_DC) { zval *callback = (zval*)context->notifier->ptr; zval *retval = NULL; @@ -923,7 +923,7 @@ static int parse_context_options(php_stream_context *context, zval *options TSRM HashPosition pos, opos; zval **wval, **oval; char *wkey, *okey; - uint wkey_len, okey_len; + zend_str_size wkey_len, okey_len; int ret = SUCCESS; ulong num_key; @@ -1035,10 +1035,10 @@ PHP_FUNCTION(stream_context_set_option) zval *options = NULL, *zcontext = NULL, *zvalue = NULL; php_stream_context *context; char *wrappername, *optionname; - int wrapperlen, optionlen; + zend_str_size wrapperlen, optionlen; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, - "rssz", &zcontext, &wrappername, &wrapperlen, + "rSSz", &zcontext, &wrappername, &wrapperlen, &optionname, &optionlen, &zvalue) == FAILURE) { if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ra", &zcontext, &options) == FAILURE) { @@ -1190,13 +1190,13 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS) zval *zstream; php_stream *stream; char *filtername; - int filternamelen; + zend_str_size filternamelen; long read_write = 0; zval *filterparams = NULL; php_stream_filter *filter = NULL; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lz", &zstream, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS|lz", &zstream, &filtername, &filternamelen, &read_write, &filterparams) == FAILURE) { RETURN_FALSE; } @@ -1312,14 +1312,14 @@ PHP_FUNCTION(stream_filter_remove) PHP_FUNCTION(stream_get_line) { char *str = NULL; - int str_len = 0; + zend_str_size str_len = 0; long max_length; zval *zstream; char *buf; size_t buf_size; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|s", &zstream, &max_length, &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|S", &zstream, &max_length, &str, &str_len) == FAILURE) { RETURN_FALSE; } @@ -1543,9 +1543,9 @@ Determine what file will be opened by calls to fopen() with a relative path */ PHP_FUNCTION(stream_resolve_include_path) { char *filename, *resolved_path; - int filename_len; + zend_str_size filename_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &filename, &filename_len) == FAILURE) { return; } diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 5592ff11d01e4..fe2ad8179a5a5 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -167,7 +167,7 @@ php_stream_filter_status_t userfilter_filter( php_stream_filter *thisfilter, php_stream_bucket_brigade *buckets_in, php_stream_bucket_brigade *buckets_out, - size_t *bytes_consumed, + zend_str_size_size_t *bytes_consumed, int flags TSRMLS_DC) { @@ -283,7 +283,7 @@ static php_stream_filter *user_filter_factory_create(const char *filtername, zval *obj, *zfilter; zval func_name; zval *retval = NULL; - int len; + zend_str_size len; /* some sanity checks */ if (persistent) { @@ -462,7 +462,7 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS) if (!bucket->own_buf) { bucket = php_stream_bucket_make_writeable(bucket TSRMLS_CC); } - if ((int)bucket->buflen != Z_STRSIZE_PP(pzdata)) { + if (bucket->buflen != Z_STRSIZE_PP(pzdata)) { bucket->buf = perealloc(bucket->buf, Z_STRSIZE_PP(pzdata), bucket->is_persistent); bucket->buflen = Z_STRSIZE_PP(pzdata); } @@ -507,10 +507,10 @@ PHP_FUNCTION(stream_bucket_new) php_stream *stream; char *buffer; char *pbuffer; - int buffer_len; + zend_str_size buffer_len; php_stream_bucket *bucket; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &zstream, &buffer, &buffer_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &zstream, &buffer, &buffer_len) == FAILURE) { RETURN_FALSE; } @@ -545,7 +545,7 @@ PHP_FUNCTION(stream_get_filters) { char *filter_name; int key_flags; - uint filter_name_len = 0; + zend_str_size filter_name_len = 0; HashTable *filters_hash; ulong num_key; @@ -574,10 +574,10 @@ PHP_FUNCTION(stream_get_filters) PHP_FUNCTION(stream_filter_register) { char *filtername, *classname; - int filtername_len, classname_len; + zend_str_size filtername_len, classname_len; struct php_user_filter_data *fdat; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &filtername, &filtername_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &filtername, &filtername_len, &classname, &classname_len) == FAILURE) { RETURN_FALSE; } diff --git a/main/network.c b/main/network.c index 5c0404b239aae..99e927ee3f69a 100644 --- a/main/network.c +++ b/main/network.c @@ -499,7 +499,7 @@ php_socket_t php_network_bind_socket_to_local_addr(const char *host, unsigned po } /* }}} */ -PHPAPI int php_network_parse_network_address_with_port(const char *addr, long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC) +PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_str_size_long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC) { char *colon; char *tmp; @@ -590,7 +590,7 @@ PHPAPI void php_network_populate_name_from_sockaddr( /* input address */ struct sockaddr *sa, socklen_t sl, /* output readable address */ - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, /* output address */ struct sockaddr **addr, socklen_t *addrlen @@ -655,7 +655,7 @@ PHPAPI void php_network_populate_name_from_sockaddr( } PHPAPI int php_network_get_peer_name(php_socket_t sock, - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC) @@ -675,7 +675,7 @@ PHPAPI int php_network_get_peer_name(php_socket_t sock, } PHPAPI int php_network_get_sock_name(php_socket_t sock, - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC) @@ -706,7 +706,7 @@ PHPAPI int php_network_get_sock_name(php_socket_t sock, /* {{{ php_network_accept_incoming */ PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock, - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen, struct timeval *timeout, @@ -833,7 +833,7 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short if (bindto) { struct sockaddr *local_address = NULL; - int local_address_len = 0; + zend_str_size local_address_len = 0; if (sa->sa_family == AF_INET) { struct sockaddr_in *in4 = emalloc(sizeof(struct sockaddr_in)); diff --git a/main/php_network.h b/main/php_network.h index c1535ee040b64..cef1ad6580876 100644 --- a/main/php_network.h +++ b/main/php_network.h @@ -62,7 +62,7 @@ * unless buf is not NULL. * Also works sensibly for win32 */ BEGIN_EXTERN_C() -PHPAPI char *php_socket_strerror(long err, char *buf, size_t bufsize); +PHPAPI char *php_socket_strerror(long err, char *buf, zend_str_size_size_t bufsize); END_EXTERN_C() #ifdef HAVE_NETINET_IN_H @@ -248,7 +248,7 @@ PHPAPI php_socket_t php_network_bind_socket_to_local_addr(const char *host, unsi TSRMLS_DC); PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock, - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen, struct timeval *timeout, @@ -257,13 +257,13 @@ PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock, TSRMLS_DC); PHPAPI int php_network_get_sock_name(php_socket_t sock, - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC); PHPAPI int php_network_get_peer_name(php_socket_t sock, - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC); @@ -277,7 +277,7 @@ struct _php_netstream_data_t { char is_blocked; struct timeval timeout; char timeout_event; - size_t ownsize; + zend_str_size_size_t ownsize; }; typedef struct _php_netstream_data_t php_netstream_data_t; PHPAPI extern php_stream_ops php_stream_socket_ops; @@ -293,14 +293,14 @@ PHPAPI void php_network_populate_name_from_sockaddr( /* input address */ struct sockaddr *sa, socklen_t sl, /* output readable address */ - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, /* output address */ struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC); PHPAPI int php_network_parse_network_address_with_port(const char *addr, - long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC); + zend_str_size_long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC); END_EXTERN_C() #define php_stream_sock_open_from_socket(socket, persistent) _php_stream_sock_open_from_socket((socket), (persistent) STREAMS_CC TSRMLS_CC) diff --git a/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h index c2d911032ef8a..70d0323ce0fc0 100644 --- a/main/streams/php_stream_transport.h +++ b/main/streams/php_stream_transport.h @@ -26,8 +26,8 @@ # include #endif -typedef php_stream *(php_stream_transport_factory_func)(const char *proto, long protolen, - char *resourcename, long resourcenamelen, +typedef php_stream *(php_stream_transport_factory_func)(const char *proto, zend_str_size_long protolen, + char *resourcename, zend_str_size_long resourcenamelen, const char *persistent_id, int options, int flags, struct timeval *timeout, php_stream_context *context STREAMS_DC TSRMLS_DC); @@ -46,7 +46,7 @@ PHPAPI int php_stream_xport_unregister(char *protocol TSRMLS_DC); #define STREAM_XPORT_CONNECT_ASYNC 16 /* Open a client or server socket connection */ -PHPAPI php_stream *_php_stream_xport_create(const char *name, long namelen, int options, +PHPAPI php_stream *_php_stream_xport_create(const char *name, zend_str_size_long namelen, int options, int flags, const char *persistent_id, struct timeval *timeout, php_stream_context *context, @@ -59,13 +59,13 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, long namelen, int /* Bind the stream to a local address */ PHPAPI int php_stream_xport_bind(php_stream *stream, - const char *name, long namelen, + const char *name, zend_str_size_long namelen, char **error_text TSRMLS_DC); /* Connect to a remote address */ PHPAPI int php_stream_xport_connect(php_stream *stream, - const char *name, long namelen, + const char *name, zend_str_size_long namelen, int asynchronous, struct timeval *timeout, char **error_text, @@ -81,7 +81,7 @@ PHPAPI int php_stream_xport_listen(php_stream *stream, /* Get the next client and their address as a string, or the underlying address * structure. You must efree either of these if you request them */ PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client, - char **textaddr, int *textaddrlen, + char **textaddr, zend_str_size_int *textaddrlen, void **addr, socklen_t *addrlen, struct timeval *timeout, char **error_text @@ -89,7 +89,7 @@ PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client, /* Get the name of either the socket or it's peer */ PHPAPI int php_stream_xport_get_name(php_stream *stream, int want_peer, - char **textaddr, int *textaddrlen, + char **textaddr, zend_str_size_int *textaddrlen, void **addr, socklen_t *addrlen TSRMLS_DC); @@ -100,13 +100,13 @@ enum php_stream_xport_send_recv_flags { /* Similar to recv() system call; read data from the stream, optionally * peeking, optionally retrieving OOB data */ -PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t buflen, +PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, zend_str_size_size_t buflen, long flags, void **addr, socklen_t *addrlen, - char **textaddr, int *textaddrlen TSRMLS_DC); + char **textaddr, zend_str_size_int *textaddrlen TSRMLS_DC); /* Similar to send() system call; send data to the stream, optionally * sending it as OOB data */ -PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, size_t buflen, +PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, zend_str_size_size_t buflen, long flags, void *addr, socklen_t addrlen TSRMLS_DC); typedef enum { @@ -141,13 +141,13 @@ typedef struct _php_stream_xport_param { struct { char *name; - long namelen; + zend_str_size_long namelen; int backlog; struct timeval *timeout; struct sockaddr *addr; socklen_t addrlen; char *buf; - size_t buflen; + zend_str_size_size_t buflen; long flags; } inputs; struct { @@ -156,7 +156,7 @@ typedef struct _php_stream_xport_param { struct sockaddr *addr; socklen_t addrlen; char *textaddr; - long textaddrlen; + zend_str_size_long textaddrlen; char *error_text; int error_code; diff --git a/main/streams/transports.c b/main/streams/transports.c index c24bf97ce6e9e..d22708f1e545f 100644 --- a/main/streams/transports.c +++ b/main/streams/transports.c @@ -49,7 +49,7 @@ PHPAPI int php_stream_xport_unregister(char *protocol TSRMLS_DC) if (local_err) { efree(local_err); local_err = NULL; } \ } -PHPAPI php_stream *_php_stream_xport_create(const char *name, long namelen, int options, +PHPAPI php_stream *_php_stream_xport_create(const char *name, zend_str_size_long namelen, int options, int flags, const char *persistent_id, struct timeval *timeout, php_stream_context *context, @@ -194,7 +194,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, long namelen, int /* Bind the stream to a local address */ PHPAPI int php_stream_xport_bind(php_stream *stream, - const char *name, long namelen, + const char *name, zend_str_size_long namelen, char **error_text TSRMLS_DC) { @@ -222,7 +222,7 @@ PHPAPI int php_stream_xport_bind(php_stream *stream, /* Connect to a remote address */ PHPAPI int php_stream_xport_connect(php_stream *stream, - const char *name, long namelen, + const char *name, zend_str_size_long namelen, int asynchronous, struct timeval *timeout, char **error_text, @@ -282,7 +282,7 @@ PHPAPI int php_stream_xport_listen(php_stream *stream, int backlog, char **error /* Get the next client and their address (as a string) */ PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client, - char **textaddr, int *textaddrlen, + char **textaddr, zend_str_size_int *textaddrlen, void **addr, socklen_t *addrlen, struct timeval *timeout, char **error_text @@ -321,7 +321,7 @@ PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client, } PHPAPI int php_stream_xport_get_name(php_stream *stream, int want_peer, - char **textaddr, int *textaddrlen, + char **textaddr, zend_str_size_int *textaddrlen, void **addr, socklen_t *addrlen TSRMLS_DC) { @@ -394,13 +394,13 @@ PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate TSRML /* Similar to recv() system call; read data from the stream, optionally * peeking, optionally retrieving OOB data */ -PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t buflen, - long flags, void **addr, socklen_t *addrlen, char **textaddr, int *textaddrlen +PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, zend_str_size_size_t buflen, + long flags, void **addr, socklen_t *addrlen, char **textaddr, zend_str_size_int *textaddrlen TSRMLS_DC) { php_stream_xport_param param; int ret = 0; - int recvd_len = 0; + zend_str_size recvd_len = 0; #if 0 int oob; @@ -464,7 +464,7 @@ PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t bufle /* Similar to send() system call; send data to the stream, optionally * sending it as OOB data */ -PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, size_t buflen, +PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, zend_str_size_size_t buflen, long flags, void *addr, socklen_t addrlen TSRMLS_DC) { php_stream_xport_param param; diff --git a/main/streams/userspace.c b/main/streams/userspace.c index 635c0cc4b1632..3ad81a48bc5e3 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -518,12 +518,12 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, char *filen PHP_FUNCTION(stream_wrapper_register) { char *protocol, *classname; - int protocol_len, classname_len; + zend_str_size protocol_len, classname_len; struct php_user_stream_wrapper * uwrap; int rsrc_id; long flags = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &protocol, &protocol_len, &classname, &classname_len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|l", &protocol, &protocol_len, &classname, &classname_len, &flags) == FAILURE) { RETURN_FALSE; } @@ -563,9 +563,9 @@ PHP_FUNCTION(stream_wrapper_register) PHP_FUNCTION(stream_wrapper_unregister) { char *protocol; - int protocol_len; + zend_str_size protocol_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &protocol, &protocol_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &protocol, &protocol_len) == FAILURE) { RETURN_FALSE; } @@ -584,11 +584,11 @@ PHP_FUNCTION(stream_wrapper_unregister) PHP_FUNCTION(stream_wrapper_restore) { char *protocol; - int protocol_len; + zend_str_size protocol_len; php_stream_wrapper **wrapperpp = NULL, *wrapper; HashTable *global_wrapper_hash; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &protocol, &protocol_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &protocol, &protocol_len) == FAILURE) { RETURN_FALSE; } @@ -618,7 +618,7 @@ PHP_FUNCTION(stream_wrapper_restore) } /* }}} */ -static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) +static zend_str_size_size_t php_userstreamop_write(php_stream *stream, const char *buf, zend_str_size_size_t count TSRMLS_DC) { zval func_name; zval *retval = NULL; @@ -626,7 +626,7 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract; zval **args[1]; zval *zbufptr; - size_t didwrite = 0; + zend_str_size didwrite = 0; assert(us != NULL); @@ -667,13 +667,13 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t return didwrite; } -static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) +static zend_str_size_size_t php_userstreamop_read(php_stream *stream, char *buf, zend_str_size_size_t count TSRMLS_DC) { zval func_name; zval *retval = NULL; zval **args[1]; int call_result; - size_t didread = 0; + zend_str_size didread = 0; php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract; zval *zcount; @@ -1502,12 +1502,12 @@ static int user_wrapper_stat_url(php_stream_wrapper *wrapper, char *url, int fla } -static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t count TSRMLS_DC) +static zend_str_size_size_t php_userstreamop_readdir(php_stream *stream, char *buf, zend_str_size_size_t count TSRMLS_DC) { zval func_name; zval *retval = NULL; int call_result; - size_t didread = 0; + zend_str_size didread = 0; php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract; php_stream_dirent *ent = (php_stream_dirent*)buf; diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index eaec034992249..6745edf7140f2 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -51,10 +51,10 @@ php_stream_ops php_stream_unixdg_socket_ops; static int php_tcp_sockop_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC); /* {{{ Generic socket stream operations */ -static size_t php_sockop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) +static zend_str_size_size_t php_sockop_write(php_stream *stream, const char *buf, zend_str_size_size_t count TSRMLS_DC) { php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; - int didwrite; + zend_str_size didwrite; struct timeval *ptimeout; if (sock->socket == -1) { @@ -141,10 +141,10 @@ static void php_sock_stream_wait_for_data(php_stream *stream, php_netstream_data } } -static size_t php_sockop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) +static zend_str_size_size_t php_sockop_read(php_stream *stream, char *buf, zend_str_size_size_t count TSRMLS_DC) { php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; - int nr_bytes = 0; + zend_str_size nr_bytes = 0; if (sock->socket == -1) { return 0; @@ -230,7 +230,7 @@ static int php_sockop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC #endif } -static inline int sock_sendto(php_netstream_data_t *sock, char *buf, size_t buflen, int flags, +static inline int sock_sendto(php_netstream_data_t *sock, char *buf, zend_str_size_size_t buflen, int flags, struct sockaddr *addr, socklen_t addrlen TSRMLS_DC) { @@ -521,7 +521,7 @@ static inline int parse_unix_address(php_stream_xport_param *xparam, struct sock } #endif -static inline char *parse_ip_address_ex(const char *str, int str_len, int *portno, int get_err, char **err TSRMLS_DC) +static inline char *parse_ip_address_ex(const char *str, zend_str_size_int str_len, int *portno, int get_err, char **err TSRMLS_DC) { char *colon; char *host = NULL; @@ -774,8 +774,8 @@ static int php_tcp_sockop_set_option(php_stream *stream, int option, int value, } -PHPAPI php_stream *php_stream_generic_socket_factory(const char *proto, long protolen, - char *resourcename, long resourcenamelen, +PHPAPI php_stream *php_stream_generic_socket_factory(const char *proto, zend_str_size_long protolen, + char *resourcename, zend_str_size_long resourcenamelen, const char *persistent_id, int options, int flags, struct timeval *timeout, php_stream_context *context STREAMS_DC TSRMLS_DC) From f4c4fe417a051b7376e4b5277ba0fe2c19403bf3 Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Tue, 2 Jul 2013 11:51:45 -0400 Subject: [PATCH 07/31] Get core test suite to really pass, fully. Woot --- Zend/zend.h | 4 ++-- Zend/zend_interfaces.c | 10 +++++----- Zend/zend_interfaces.h | 10 +++++----- ext/standard/php_smart_str.h | 9 +++++++-- ext/standard/php_smart_str_public.h | 4 ++-- ext/standard/string.c | 2 +- ext/standard/var.c | 8 ++++---- 7 files changed, 26 insertions(+), 21 deletions(-) diff --git a/Zend/zend.h b/Zend/zend.h index d40500caf7b50..e0a71e0f569b3 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -512,8 +512,8 @@ struct _zend_class_entry { union _zend_function *(*get_static_method)(zend_class_entry *ce, char* method, zend_str_size_int method_len TSRMLS_DC); /* serializer callbacks */ - zend_str_size_int (*serialize)(zval *object, unsigned char **buffer, zend_str_size_uint *buf_len, zend_serialize_data *data TSRMLS_DC); - zend_str_size_int (*unserialize)(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_str_size_uint buf_len, zend_unserialize_data *data TSRMLS_DC); + int (*serialize)(zval *object, unsigned char **buffer, zend_str_size_uint *buf_len, zend_serialize_data *data TSRMLS_DC); + int (*unserialize)(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_str_size_uint buf_len, zend_unserialize_data *data TSRMLS_DC); zend_class_entry **interfaces; zend_uint num_interfaces; diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 31cd261bc7af6..129c6851eac48 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -31,7 +31,7 @@ ZEND_API zend_class_entry *zend_ce_serializable; /* {{{ zend_call_method Only returns the returned zval if retval_ptr != NULL */ -ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC) +ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, zend_str_size_int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC) { int result; zend_fcall_info fci; @@ -397,7 +397,7 @@ static int zend_implement_arrayaccess(zend_class_entry *interface, zend_class_en /* }}}*/ /* {{{ zend_user_serialize */ -ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) +ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_str_size_uint *buf_len, zend_serialize_data *data TSRMLS_DC) { zend_class_entry * ce = Z_OBJCE_P(object); zval *retval; @@ -434,7 +434,7 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint /* }}} */ /* {{{ zend_user_unserialize */ -ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) +ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_str_size_uint buf_len, zend_unserialize_data *data TSRMLS_DC) { zval * zdata; @@ -455,7 +455,7 @@ ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const un } /* }}} */ -ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */ +ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_str_size_uint *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(object); zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Serialization of '%s' is not allowed", ce->name); @@ -463,7 +463,7 @@ ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zen } /* }}} */ -ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */ +ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_str_size_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */ { zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Unserialization of '%s' is not allowed", ce->name); return FAILURE; diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h index ba4bc6ccb6d98..ec6dd515abda5 100644 --- a/Zend/zend_interfaces.h +++ b/Zend/zend_interfaces.h @@ -38,7 +38,7 @@ typedef struct _zend_user_iterator { zval *value; } zend_user_iterator; -ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC); +ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, zend_str_size_int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC); #define zend_call_method_with_0_params(obj, obj_ce, fn_proxy, function_name, retval) \ zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 0, NULL, NULL TSRMLS_CC) @@ -61,11 +61,11 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c ZEND_API void zend_register_interfaces(TSRMLS_D); -ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC); -ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC); +ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_str_size_uint *buf_len, zend_serialize_data *data TSRMLS_DC); +ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_str_size_uint buf_len, zend_unserialize_data *data TSRMLS_DC); -ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC); -ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC); +ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_str_size_uint *buf_len, zend_serialize_data *data TSRMLS_DC); +ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_str_size_uint buf_len, zend_unserialize_data *data TSRMLS_DC); END_EXTERN_C() diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h index 2fef1d0bd0071..7e8c4915fe43a 100644 --- a/ext/standard/php_smart_str.h +++ b/ext/standard/php_smart_str.h @@ -88,13 +88,15 @@ smart_str_append_ex((dest), (src), 0) #define smart_str_append_long(dest, val) \ smart_str_append_long_ex((dest), (val), 0) +#define smart_str_append_str_size(dest, val) \ + smart_str_append_str_size_ex((dest), (val), 0) #define smart_str_append_off_t(dest, val) \ smart_str_append_off_t_ex((dest), (val), 0) #define smart_str_append_unsigned(dest, val) \ smart_str_append_unsigned_ex((dest), (val), 0) #define smart_str_appendc_ex(dest, ch, what) do { \ - register size_t __nl; \ + register zend_str_size __nl; \ smart_str_alloc4((dest), 1, (what), __nl); \ (dest)->len = __nl; \ ((unsigned char *) (dest)->c)[(dest)->len - 1] = (ch); \ @@ -110,7 +112,7 @@ } while (0) #define smart_str_appendl_ex(dest, src, nlen, what) do { \ - register size_t __nl; \ + register zend_str_size __nl; \ smart_str *__dest = (smart_str *) (dest); \ \ smart_str_alloc4(__dest, (nlen), (what), __nl); \ @@ -175,6 +177,9 @@ static inline char *smart_str_print_unsigned(char *buf, long num) { #define smart_str_append_long_ex(dest, num, type) \ smart_str_append_generic_ex((dest), (num), (type), unsigned long, _long) +#define smart_str_append_str_size_ex(dest, num, type) \ + smart_str_append_generic_ex((dest), (num), (type), zend_str_size, _long) + #define smart_str_append_off_t_ex(dest, num, type) \ smart_str_append_generic_ex((dest), (num), (type), off_t, _long) diff --git a/ext/standard/php_smart_str_public.h b/ext/standard/php_smart_str_public.h index ed36a7a6feb68..fdcb8b924e3e8 100644 --- a/ext/standard/php_smart_str_public.h +++ b/ext/standard/php_smart_str_public.h @@ -25,8 +25,8 @@ typedef struct { char *c; - size_t len; - size_t a; + zend_str_size len; + zend_str_size a; } smart_str; #endif diff --git a/ext/standard/string.c b/ext/standard/string.c index a8c65fb01bac0..71f43f2fe02aa 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2237,7 +2237,7 @@ PHP_FUNCTION(substr) l = str_len; } - if (f > str_len) { + if (f > 0 && f > str_len) { RETURN_FALSE; } else if (f < 0 && -f > str_len) { f = 0; diff --git a/ext/standard/var.c b/ext/standard/var.c index abeb35dfd9e48..9e6be7d6a93ce 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -595,7 +595,7 @@ static inline void php_var_serialize_long(smart_str *buf, long val) /* {{{ */ static inline void php_var_serialize_string(smart_str *buf, char *str, zend_str_size_int len) /* {{{ */ { smart_str_appendl(buf, "s:", 2); - smart_str_append_long(buf, len); + smart_str_append_str_size(buf, len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, str, len); smart_str_appendl(buf, "\";", 2); @@ -608,7 +608,7 @@ static inline zend_bool php_var_serialize_class_name(smart_str *buf, zval *struc PHP_SET_CLASS_ATTRIBUTES(struc); smart_str_appendl(buf, "O:", 2); - smart_str_append_long(buf, (long)name_len); + smart_str_append_str_size(buf, name_len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, class_name, name_len); smart_str_appendl(buf, "\":", 2); @@ -780,12 +780,12 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var if (ce->serialize(struc, &serialized_data, &serialized_length, (zend_serialize_data *)var_hash TSRMLS_CC) == SUCCESS) { smart_str_appendl(buf, "C:", 2); - smart_str_append_long(buf, (int)Z_OBJCE_P(struc)->name_length); + smart_str_append_str_size(buf, Z_OBJCE_P(struc)->name_length); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, Z_OBJCE_P(struc)->name, Z_OBJCE_P(struc)->name_length); smart_str_appendl(buf, "\":", 2); - smart_str_append_long(buf, (int)serialized_length); + smart_str_append_str_size(buf, serialized_length); smart_str_appendl(buf, ":{", 2); smart_str_appendl(buf, serialized_data, serialized_length); smart_str_appendc(buf, '}'); From ca0e018c9567b1e6eb483710ca025c73a2bd41e5 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 4 Jul 2013 04:27:40 -0700 Subject: [PATCH 08/31] windows fixes --- ext/standard/string.c | 2 +- win32/build/config.w32 | 6 ++++++ win32/registry.c | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ext/standard/string.c b/ext/standard/string.c index 71f43f2fe02aa..a8931d3370857 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1413,7 +1413,7 @@ PHP_FUNCTION(strtolower) PHPAPI void php_basename(const char *s, zend_str_size_size_t len, char *suffix, zend_str_size_size_t sufflen, char **p_ret, zend_str_size_size_t *p_len TSRMLS_DC) { char *ret = NULL, *c, *comp, *cend; - zend_str_size inc_len, cnt; + zend_str_size_size_t inc_len, cnt; int state; c = comp = cend = (char*)s; diff --git a/win32/build/config.w32 b/win32/build/config.w32 index 3face08a8c2b5..ada6eba86cae4 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -449,3 +449,9 @@ if (PHP_STATIC_ANALYZE == "yes") { ADD_FLAG("CFLAGS", " /analyze "); ADD_FLAG("CFLAGS", " /wd6308 "); } + +ARG_ENABLE("zstrlen", "Include Z_STRLEN macros enabling size_t for string length", "no"); +if (PHP_ZSTRLEN == "yes") { + AC_DEFINE('ZEND_USE_LEGACY_STRING_TYPES', 1, ""); +} + diff --git a/win32/registry.c b/win32/registry.c index 685a09d084abd..f646a970bd6bf 100644 --- a/win32/registry.c +++ b/win32/registry.c @@ -90,7 +90,7 @@ static int LoadDirectory(HashTable *directories, HKEY key, char *path, int path_ } INIT_PZVAL(data); Z_STRVAL_P(data) = zend_strndup(value, value_len-1); - Z_STRLEN_P(data) = value_len-1; + Z_STRSIZE_P(data) = value_len-1; Z_TYPE_P(data) = IS_STRING; zend_hash_update(ht, name, name_len+1, &data, sizeof(zval*), NULL); } @@ -261,7 +261,7 @@ void UpdateIniFromRegistry(char *path TSRMLS_DC) zend_hash_get_current_data_ex(ht, (void**)&data, &pos) == SUCCESS && zend_hash_get_current_key_ex(ht, &index, &index_len, &num, 0, &pos) == HASH_KEY_IS_STRING; zend_hash_move_forward_ex(ht, &pos)) { - zend_alter_ini_entry(index, index_len, Z_STRVAL_PP(data), Z_STRLEN_PP(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); + zend_alter_ini_entry(index, index_len, Z_STRVAL_PP(data), Z_STRSIZE_PP(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); } break; } From 890345eda0ae8594b2429091576b423404d87a00 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 4 Jul 2013 06:41:48 -0700 Subject: [PATCH 09/31] fix spl_autoload_* --- ext/spl/php_spl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 7092af24fcba1..43ec5dbf0a549 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -415,7 +415,7 @@ PHP_FUNCTION(spl_autoload_call) zval *class_name, *retval = NULL; int class_name_len; char *func_name, *lc_name; - uint func_name_len; + zend_str_size_uint func_name_len; ulong dummy; HashPosition function_pos; autoload_func_info *alfi; @@ -466,7 +466,7 @@ PHP_FUNCTION(spl_autoload_call) PHP_FUNCTION(spl_autoload_register) { char *func_name, *error = NULL; - int func_name_len; + zend_str_size_int func_name_len; char *lc_name = NULL; zval *zcallable = NULL; zend_bool do_throw = 1; From bf18c56fb726adeb3261b3705fc44c162b3c6c80 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 4 Jul 2013 08:50:58 -0700 Subject: [PATCH 10/31] trivial fixes to spl --- ext/spl/php_spl.c | 2 +- ext/spl/spl_directory.c | 4 ++-- ext/spl/spl_dllist.c | 2 +- ext/spl/spl_functions.c | 2 +- ext/spl/spl_heap.c | 2 +- ext/spl/spl_observer.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 43ec5dbf0a549..a5fd3d72de472 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -627,7 +627,7 @@ PHP_FUNCTION(spl_autoload_register) PHP_FUNCTION(spl_autoload_unregister) { char *func_name, *error = NULL; - int func_name_len; + zend_str_size_int func_name_len; char *lc_name = NULL; zval *zcallable; int success = FAILURE; diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 78d160f365c3d..cae9b7599240f 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -183,7 +183,7 @@ static zend_object_value spl_filesystem_object_new_check(zend_class_entry *class /* }}} */ -PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, int *len TSRMLS_DC) /* {{{ */ +PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, zend_str_size_int *len TSRMLS_DC) /* {{{ */ { #ifdef HAVE_GLOB if (intern->type == SPL_FS_DIR) { @@ -589,7 +589,7 @@ static HashTable* spl_filesystem_object_get_debug_info(zval *obj, int *is_temp T HashTable *rv; zval *tmp, zrv; char *pnstr, *path; - int pnlen, path_len; + zend_str_size_int pnlen, path_len; char stmp[2]; *is_temp = 1; diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index aa462dfd76460..4ae55c9c6b746 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -511,7 +511,7 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp TSRML spl_ptr_llist_element *current = intern->llist->head, *next; zval *tmp, zrv, *dllist_array; char *pnstr; - int pnlen; + zend_str_size_int pnlen; int i = 0; *is_temp = 0; diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c index 7f17d5ef239fa..93ed1b34e260b 100644 --- a/ext/spl/spl_functions.c +++ b/ext/spl/spl_functions.c @@ -133,7 +133,7 @@ int spl_add_classes(zend_class_entry *pce, zval *list, int sub, int allow, int c } /* }}} */ -char * spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, int prop_len, int *name_len TSRMLS_DC) /* {{{ */ +char * spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, zend_str_size_int prop_len, zend_str_size_int *name_len TSRMLS_DC) /* {{{ */ { char *rv; diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index cb1f68dcf1196..c99d5c07e6356 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -523,7 +523,7 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(obj TSRMLS_CC); zval *tmp, zrv, *heap_array; char *pnstr; - int pnlen; + zend_str_size_int pnlen; int i; *is_temp = 0; diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index c0c37c25cc526..67db7015bbb2b 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -318,7 +318,7 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp TSRMLS_D HashPosition pos; zval *tmp, *storage; char md5str[33]; - int name_len; + zend_str_size_int name_len; char *zname; *is_temp = 0; From 8db3e3738c2dee602df1a11688d24162a2f31968 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 4 Jul 2013 09:35:05 -0700 Subject: [PATCH 11/31] trivial fixes to ext\standard --- ext/standard/http.c | 2 +- ext/standard/info.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/standard/http.c b/ext/standard/http.c index 649782e466871..07a4c98296f50 100644 --- a/ext/standard/http.c +++ b/ext/standard/http.c @@ -34,7 +34,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, char *key = NULL; char *ekey, *newprefix, *p; int arg_sep_len, ekey_len, key_type, newprefix_len; - uint key_len; + zend_str_size_uint key_len; ulong idx; zval **zdata = NULL, *copyzval; diff --git a/ext/standard/info.c b/ext/standard/info.c index 44f9e43e8806a..c443c1060e794 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -102,7 +102,7 @@ static int php_info_print(const char *str) /* {{{ */ static void php_info_print_stream_hash(const char *name, HashTable *ht TSRMLS_DC) /* {{{ */ { char *key; - uint len; + zend_str_size_uint len; if (ht) { if (zend_hash_num_elements(ht)) { @@ -196,7 +196,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) { zval **data, **tmp, tmp2; char *string_key; - uint string_len; + zend_str_size_uint string_len; ulong num_key; zend_is_auto_global(name, name_length TSRMLS_CC); From acd85d48f0411034191eabf0cdd4629a6148a061 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 9 Jul 2013 06:13:08 -0700 Subject: [PATCH 12/31] strig size_t fixes to zend_alloc.* --- Zend/zend_alloc.c | 14 +++++++------- Zend/zend_alloc.h | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index c6aee57a73d96..ce4c9439461c6 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -433,7 +433,7 @@ struct _zend_mm_heap { int overflow; int internal; #if ZEND_MM_CACHE - unsigned int cached; + size_t cached; zend_mm_free_block *cache[ZEND_MM_NUM_BUCKETS]; #endif zend_mm_free_block *free_buckets[ZEND_MM_NUM_BUCKETS*2]; @@ -615,11 +615,11 @@ static unsigned int _zend_mm_cookie = 0; # define END_MAGIC_SIZE sizeof(unsigned int) # define ZEND_MM_SET_BLOCK_SIZE(block, __size) do { \ - char *p; \ + char *__p; \ ((zend_mm_block*)(block))->debug.size = (__size); \ - p = ZEND_MM_END_MAGIC_PTR(block); \ + __p = ZEND_MM_END_MAGIC_PTR(block); \ ((zend_mm_block*)(block))->debug.start_magic = _mem_block_start_magic; \ - memcpy(p, &_mem_block_end_magic, END_MAGIC_SIZE); \ + memcpy(__p, &_mem_block_end_magic, END_MAGIC_SIZE); \ } while (0) static unsigned int _mem_block_start_magic = 0; @@ -2619,7 +2619,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) { - int length; + zend_str_size_int length; char *p; #ifdef ZEND_SIGNALS TSRMLS_FETCH(); @@ -2638,7 +2638,7 @@ ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) return p; } -ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) +ZEND_API char *_estrndup(const char *s, zend_str_size_uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) { char *p; #ifdef ZEND_SIGNALS @@ -2659,7 +2659,7 @@ ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_ } -ZEND_API char *zend_strndup(const char *s, uint length) +ZEND_API char *zend_strndup(const char *s, zend_str_size_uint length) { char *p; #ifdef ZEND_SIGNALS diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index 0b4e74d8971a2..fbd424c333645 100644 --- a/Zend/zend_alloc.h +++ b/Zend/zend_alloc.h @@ -26,6 +26,7 @@ #include "../TSRM/TSRM.h" #include "zend.h" +#include "zend_types.h" #ifndef ZEND_MM_ALIGNMENT # define ZEND_MM_ALIGNMENT 8 @@ -52,7 +53,7 @@ typedef struct _zend_leak_info { BEGIN_EXTERN_C() -ZEND_API char *zend_strndup(const char *s, unsigned int length) ZEND_ATTRIBUTE_MALLOC; +ZEND_API char *zend_strndup(const char *s, zend_str_size_uint length) ZEND_ATTRIBUTE_MALLOC; ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE(1); ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; @@ -63,7 +64,7 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN ZEND_API void *_safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); ZEND_API void *_safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset); ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; -ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; +ZEND_API char *_estrndup(const char *s, zend_str_size_uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); /* Standard wrapper macros */ From 03ed6fc0b13fb7a5af0fa371afc262241e656fa1 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 10 Jul 2013 00:43:19 -0700 Subject: [PATCH 13/31] string sze_t fix for internal strings --- Zend/zend_string.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Zend/zend_string.c b/Zend/zend_string.c index ff7ee3fd81a22..144de9d715eae 100644 --- a/Zend/zend_string.c +++ b/Zend/zend_string.c @@ -29,11 +29,11 @@ # include #endif -ZEND_API const char *(*zend_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC); +ZEND_API const char *(*zend_new_interned_string)(const char *str, zend_str_size_int len, int free_src TSRMLS_DC); ZEND_API void (*zend_interned_strings_snapshot)(TSRMLS_D); ZEND_API void (*zend_interned_strings_restore)(TSRMLS_D); -static const char *zend_new_interned_string_int(const char *str, int len, int free_src TSRMLS_DC); +static const char *zend_new_interned_string_int(const char *str, zend_str_size_int len, int free_src TSRMLS_DC); static void zend_interned_strings_snapshot_int(TSRMLS_D); static void zend_interned_strings_restore_int(TSRMLS_D); @@ -79,7 +79,7 @@ void zend_interned_strings_dtor(TSRMLS_D) #endif } -static const char *zend_new_interned_string_int(const char *arKey, int nKeyLength, int free_src TSRMLS_DC) +static const char *zend_new_interned_string_int(const char *arKey, zend_str_size_int nKeyLength, int free_src TSRMLS_DC) { #ifndef ZTS ulong h; From 42c8f29277cd102ec9c1ba6c69926533d519b9f7 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 11 Jul 2013 02:58:53 -0700 Subject: [PATCH 14/31] fix 's' vs 'S' for datetime --- ext/date/php_date.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index a86e78f5e9a8d..655898abaac0e 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1435,7 +1435,7 @@ PHP_FUNCTION(strtotime) tzi = get_timezone_info(TSRMLS_C); - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sl", ×, &time_len, &preset_ts) != FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "Sl", ×, &time_len, &preset_ts) != FAILURE) { /* We have an initial timestamp */ now = timelib_time_ctor(); @@ -1448,7 +1448,7 @@ PHP_FUNCTION(strtotime) timelib_unixtime2local(now, t->sse); timelib_time_dtor(t); efree(initial_ts); - } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", ×, &time_len, &preset_ts) != FAILURE) { + } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", ×, &time_len, &preset_ts) != FAILURE) { /* We have no initial timestamp */ now = timelib_time_ctor(); now->tz_info = tzi; @@ -4391,7 +4391,7 @@ PHP_METHOD(DatePeriod, __construct) 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, "OOl|l", &start, date_ce_interface, &interval, date_ce_interval, &recurrences, &options) == FAILURE) { if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|l", &start, date_ce_interface, &interval, date_ce_interval, &end, date_ce_date, &options) == FAILURE) { - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &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."); zend_restore_error_handling(&error_handling TSRMLS_CC); return; From a9b623aa0b8fc7ea94244df0c3a7cfddfebf0227 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 11 Jul 2013 05:37:09 -0700 Subject: [PATCH 15/31] huge fix to spl and more --- Zend/zend_string.h | 2 +- ext/spl/php_spl.c | 11 ++--- ext/spl/spl_array.c | 2 +- ext/spl/spl_directory.c | 62 +++++++++++++------------- ext/spl/spl_directory.h | 10 ++--- ext/spl/spl_dllist.c | 4 +- ext/spl/spl_functions.h | 2 +- ext/spl/spl_iterators.c | 35 ++++++++------- ext/spl/spl_iterators.h | 2 +- ext/spl/spl_observer.c | 22 ++++----- main/streams/glob_wrapper.c | 4 +- main/streams/php_stream_glob_wrapper.h | 4 +- 12 files changed, 83 insertions(+), 77 deletions(-) diff --git a/Zend/zend_string.h b/Zend/zend_string.h index ebf8c816c11ff..3ef8f91ad180a 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -24,7 +24,7 @@ #include "zend.h" BEGIN_EXTERN_C() -ZEND_API extern const char *(*zend_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC); +ZEND_API extern const char *(*zend_new_interned_string)(const char *str, zend_str_size_int len, int free_src TSRMLS_DC); ZEND_API extern void (*zend_interned_strings_snapshot)(TSRMLS_D); ZEND_API extern void (*zend_interned_strings_restore)(TSRMLS_D); diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index a5fd3d72de472..039e3ffe4283e 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -316,13 +316,14 @@ static int spl_autoload(const char *class_name, const char * lc_name, int class_ PHP_FUNCTION(spl_autoload) { char *class_name, *lc_name, *file_exts = SPL_G(autoload_extensions); - int class_name_len, file_exts_len = SPL_G(autoload_extensions_len), found = 0; + zend_str_size_int class_name_len, file_exts_len = SPL_G(autoload_extensions_len); + int found = 0; char *copy, *pos1, *pos2; zval **original_return_value = EG(return_value_ptr_ptr); zend_op **original_opline_ptr = EG(opline_ptr); zend_op_array *original_active_op_array = EG(active_op_array); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &class_name, &class_name_len, &file_exts, &file_exts_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &class_name, &class_name_len, &file_exts, &file_exts_len) == FAILURE) { RETURN_FALSE; } @@ -371,9 +372,9 @@ PHP_FUNCTION(spl_autoload) PHP_FUNCTION(spl_autoload_extensions) { char *file_exts = NULL; - int file_exts_len; + zend_str_size_int file_exts_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &file_exts, &file_exts_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &file_exts, &file_exts_len) == FAILURE) { return; } if (file_exts) { @@ -413,7 +414,7 @@ static void autoload_func_info_dtor(autoload_func_info *alfi) PHP_FUNCTION(spl_autoload_call) { zval *class_name, *retval = NULL; - int class_name_len; + zend_str_size_int class_name_len; char *func_name, *lc_name; zend_str_size_uint func_name_len; ulong dummy; diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index cc5451baf0aa4..8ebacd1c4de0f 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -1430,7 +1430,7 @@ SPL_METHOD(Array, count) RETURN_LONG(count); } /* }}} */ -static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fname_len, int use_arg) /* {{{ */ +static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, zend_str_size_int fname_len, int use_arg) /* {{{ */ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index cae9b7599240f..4e4220e4ff6d5 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -383,7 +383,7 @@ static zend_object_value spl_filesystem_object_clone(zval *zobject TSRMLS_DC) } /* }}} */ -void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path, int len, int use_copy TSRMLS_DC) /* {{{ */ +void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path, zend_str_size_int len, int use_copy TSRMLS_DC) /* {{{ */ { char *p1, *p2; @@ -417,7 +417,7 @@ void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path, intern->_path = estrndup(path, intern->_path_len); } /* }}} */ -static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_object *source, char *file_path, int file_path_len, int use_copy, zend_class_entry *ce, zval *return_value TSRMLS_DC) /* {{{ */ +static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_object *source, char *file_path, zend_str_size_int file_path_len, int use_copy, zend_class_entry *ce, zval *return_value TSRMLS_DC) /* {{{ */ { spl_filesystem_object *intern; zval *arg1; @@ -531,7 +531,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil intern->u.file.open_mode = "r"; intern->u.file.open_mode_len = 1; - if (ht && zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sbr", + if (ht && zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|Sbr", &intern->u.file.open_mode, &intern->u.file.open_mode_len, &use_include_path, &intern->u.file.zcontext) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); @@ -565,7 +565,7 @@ static int spl_filesystem_is_invalid_or_dot(const char * d_name) /* {{{ */ } /* }}} */ -static char *spl_filesystem_object_get_pathname(spl_filesystem_object *intern, int *len TSRMLS_DC) { /* {{{ */ +static char *spl_filesystem_object_get_pathname(spl_filesystem_object *intern, zend_str_size_int *len TSRMLS_DC) { /* {{{ */ switch (intern->type) { case SPL_FS_INFO: case SPL_FS_FILE: @@ -659,7 +659,7 @@ static HashTable* spl_filesystem_object_get_debug_info(zval *obj, int *is_temp T } /* }}} */ -zend_function *spl_filesystem_object_get_method_check(zval **object_ptr, char *method, int method_len, const struct _zend_literal *key TSRMLS_DC) /* {{{ */ +zend_function *spl_filesystem_object_get_method_check(zval **object_ptr, char *method, zend_str_size_int method_len, const struct _zend_literal *key TSRMLS_DC) /* {{{ */ { spl_filesystem_object *fsobj = zend_object_store_get_object(*object_ptr TSRMLS_CC); @@ -680,7 +680,8 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, long ctor_fla { spl_filesystem_object *intern; char *path; - int parsed, len; + int parsed; + zend_str_size_int len; long flags; zend_error_handling error_handling; @@ -688,10 +689,10 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, long ctor_fla if (SPL_HAS_FLAG(ctor_flags, DIT_CTOR_FLAGS)) { flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO; - parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &len, &flags); + parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &path, &len, &flags); } else { flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF; - parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len); + parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &path, &len); } if (SPL_HAS_FLAG(ctor_flags, SPL_FILE_DIR_SKIPDOTS)) { flags |= SPL_FILE_DIR_SKIPDOTS; @@ -869,7 +870,7 @@ SPL_METHOD(SplFileInfo, getPath) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *path; - int path_len; + zend_str_size_int path_len; if (zend_parse_parameters_none() == FAILURE) { return; @@ -885,7 +886,7 @@ SPL_METHOD(SplFileInfo, getPath) SPL_METHOD(SplFileInfo, getFilename) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - int path_len; + zend_str_size_int path_len; if (zend_parse_parameters_none() == FAILURE) { return; @@ -923,7 +924,7 @@ SPL_METHOD(SplFileInfo, getExtension) char *fname = NULL; const char *p; size_t flen; - int path_len, idx; + zend_str_size_int path_len, idx; if (zend_parse_parameters_none() == FAILURE) { return; @@ -964,7 +965,7 @@ SPL_METHOD(DirectoryIterator, getExtension) char *fname = NULL; const char *p; size_t flen; - int idx; + zend_str_size_int idx; if (zend_parse_parameters_none() == FAILURE) { return; @@ -994,9 +995,9 @@ SPL_METHOD(SplFileInfo, getBasename) spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *fname, *suffix = 0; size_t flen; - int slen = 0, path_len; + zend_str_size_int slen = 0, path_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &suffix, &slen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &suffix, &slen) == FAILURE) { return; } @@ -1022,10 +1023,10 @@ SPL_METHOD(DirectoryIterator, getBasename) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *suffix = 0, *fname; - int slen = 0; + zend_str_size_int slen = 0; size_t flen; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &suffix, &slen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &suffix, &slen) == FAILURE) { return; } @@ -1041,7 +1042,7 @@ SPL_METHOD(SplFileInfo, getPathname) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *path; - int path_len; + zend_str_size_int path_len; if (zend_parse_parameters_none() == FAILURE) { return; @@ -1124,12 +1125,12 @@ SPL_METHOD(SplFileInfo, __construct) { spl_filesystem_object *intern; char *path; - int len; + zend_str_size_int len; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &path, &len) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } @@ -1401,7 +1402,7 @@ SPL_METHOD(SplFileInfo, getPathInfo) zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) == SUCCESS) { - int path_len; + zend_str_size_int path_len; char *path = spl_filesystem_object_get_pathname(intern, &path_len TSRMLS_CC); if (path) { char *dpath = estrndup(path, path_len); @@ -2282,7 +2283,7 @@ SPL_METHOD(SplFileObject, __construct) zend_bool use_include_path = 0; char *p1, *p2; char *tmp_path; - int tmp_path_len; + zend_str_size_int tmp_path_len; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC); @@ -2290,7 +2291,7 @@ SPL_METHOD(SplFileObject, __construct) intern->u.file.open_mode = NULL; intern->u.file.open_mode_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|sbr", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|Sbr", &intern->file_name, &intern->file_name_len, &intern->u.file.open_mode, &intern->u.file.open_mode_len, &use_include_path, &intern->u.file.zcontext) == FAILURE) { @@ -2580,9 +2581,9 @@ SPL_METHOD(SplFileObject, fgetcsv) spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure, escape = intern->u.file.escape; char *delim = NULL, *enclo = NULL, *esc = NULL; - int d_len = 0, e_len = 0, esc_len = 0; + zend_str_size_int d_len = 0, e_len = 0, esc_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sss", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|SSS", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) { switch(ZEND_NUM_ARGS()) { case 3: @@ -2621,10 +2622,11 @@ SPL_METHOD(SplFileObject, fputcsv) spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure, escape = intern->u.file.escape; char *delim = NULL, *enclo = NULL; - int d_len = 0, e_len = 0, ret; + zend_str_size_int d_len = 0, e_len = 0; + int ret; zval *fields = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|ss", &fields, &delim, &d_len, &enclo, &e_len) == SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|SS", &fields, &delim, &d_len, &enclo, &e_len) == SUCCESS) { switch(ZEND_NUM_ARGS()) { case 3: @@ -2658,9 +2660,9 @@ SPL_METHOD(SplFileObject, setCsvControl) spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char delimiter = ',', enclosure = '"', escape='\\'; char *delim = NULL, *enclo = NULL, *esc = NULL; - int d_len = 0, e_len = 0, esc_len = 0; + zend_str_size_int d_len = 0, e_len = 0, esc_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sss", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|SSS", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) { switch(ZEND_NUM_ARGS()) { case 3: @@ -2831,10 +2833,10 @@ SPL_METHOD(SplFileObject, fwrite) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *str; - int str_len; + zend_str_size_int str_len; long length = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &str_len, &length) == FAILURE) { return; } diff --git a/ext/spl/spl_directory.h b/ext/spl/spl_directory.h index d95ba550f8a30..48e0d87a32a6a 100644 --- a/ext/spl/spl_directory.h +++ b/ext/spl/spl_directory.h @@ -45,7 +45,7 @@ typedef struct _spl_filesystem_object spl_filesystem_object; typedef void (*spl_foreign_dtor_t)(spl_filesystem_object *object TSRMLS_DC); typedef void (*spl_foreign_clone_t)(spl_filesystem_object *src, spl_filesystem_object *dst TSRMLS_DC); -PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, int *len TSRMLS_DC); +PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, zend_str_size_int *len TSRMLS_DC); typedef struct _spl_other_handler { spl_foreign_dtor_t dtor; @@ -64,10 +64,10 @@ struct _spl_filesystem_object { void *oth; spl_other_handler *oth_handler; char *_path; - int _path_len; + zend_str_size_int _path_len; char *orig_path; char *file_name; - int file_name_len; + zend_str_size_int file_name_len; SPL_FS_OBJ_TYPE type; long flags; zend_class_entry *file_class; @@ -77,7 +77,7 @@ struct _spl_filesystem_object { php_stream *dirp; php_stream_dirent entry; char *sub_path; - int sub_path_len; + zend_str_size_int sub_path_len; int index; int is_recursive; zend_function *func_rewind; @@ -89,7 +89,7 @@ struct _spl_filesystem_object { php_stream_context *context; zval *zcontext; char *open_mode; - int open_mode_len; + size_t open_mode_len; zval *current_zval; char *current_line; size_t current_line_len; diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 4ae55c9c6b746..7e8a78b25fe49 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -1183,11 +1183,11 @@ SPL_METHOD(SplDoublyLinkedList, unserialize) spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zval *flags, *elem; char *buf; - int buf_len; + zend_str_size_int buf_len; const unsigned char *p, *s; php_unserialize_data_t var_hash; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &buf, &buf_len) == FAILURE) { return; } diff --git a/ext/spl/spl_functions.h b/ext/spl/spl_functions.h index 29ce4a7640dea..119eb54836c67 100644 --- a/ext/spl/spl_functions.h +++ b/ext/spl/spl_functions.h @@ -66,7 +66,7 @@ void spl_add_traits(zval * list, zend_class_entry * pce, int allow, int ce_flags int spl_add_classes(zend_class_entry *pce, zval *list, int sub, int allow, int ce_flags TSRMLS_DC); /* caller must efree(return) */ -char * spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, int prop_len, int *name_len TSRMLS_DC); +char * spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, zend_str_size_int prop_len, zend_str_size_int *name_len TSRMLS_DC); #define SPL_ME(class_name, function_name, arg_info, flags) \ PHP_ME( spl_ ## class_name, function_name, arg_info, flags) diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index c986ea08bf71f..28e0e0236d977 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -828,7 +828,7 @@ SPL_METHOD(RecursiveIteratorIterator, getMaxDepth) } } /* }}} */ -static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char *method, int method_len, const zend_literal *key TSRMLS_DC) +static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char *method, zend_str_size_int method_len, const zend_literal *key TSRMLS_DC) { union _zend_function *function_handler; spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(*object_ptr TSRMLS_CC); @@ -1042,9 +1042,9 @@ SPL_METHOD(RecursiveTreeIterator, setPrefixPart) spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); long part; char* prefix; - int prefix_len; + zend_str_size_int prefix_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &part, &prefix, &prefix_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lS", &part, &prefix, &prefix_len) == FAILURE) { return; } if (0 > part || part > 5) { @@ -1255,7 +1255,7 @@ static int spl_dual_it_gets_implemented(zend_class_entry *interface, zend_class_ } #endif -static union _zend_function *spl_dual_it_get_method(zval **object_ptr, char *method, int method_len, const zend_literal *key TSRMLS_DC) +static union _zend_function *spl_dual_it_get_method(zval **object_ptr, char *method, zend_str_size_int method_len, const zend_literal *key TSRMLS_DC) { union _zend_function *function_handler; spl_dual_it_object *intern; @@ -1402,9 +1402,9 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z case DIT_IteratorIterator: { zend_class_entry **pce_cast; char * class_name = NULL; - int class_name_len = 0; + zend_str_size_int class_name_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|s", &zobject, ce_inner, &class_name, &class_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|S", &zobject, ce_inner, &class_name, &class_name_len) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return NULL; } @@ -1452,13 +1452,13 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z case DIT_RegexIterator: case DIT_RecursiveRegexIterator: { char *regex; - int regex_len; + zend_str_size_int regex_len; long mode = REGIT_MODE_MATCH; intern->u.regex.use_flags = ZEND_NUM_ARGS() >= 5; intern->u.regex.flags = 0; intern->u.regex.preg_flags = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|lll", &zobject, ce_inner, ®ex, ®ex_len, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|lll", &zobject, ce_inner, ®ex, ®ex_len, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return NULL; } @@ -1944,7 +1944,8 @@ SPL_METHOD(RegexIterator, accept) { spl_dual_it_object *intern; char *subject, *result; - int subject_len, use_copy, count = 0, result_len; + zend_str_size_int subject_len; + int use_copy, count = 0, result_len; zval *subject_ptr, subject_copy, zcount, *replacement, tmp_replacement; if (zend_parse_parameters_none() == FAILURE) { @@ -2739,7 +2740,7 @@ SPL_METHOD(CachingIterator, offsetSet) { spl_dual_it_object *intern; char *arKey; - uint nKeyLength; + zend_str_size_uint nKeyLength; zval *value; SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); @@ -2749,7 +2750,7 @@ SPL_METHOD(CachingIterator, offsetSet) return; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &arKey, &nKeyLength, &value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &arKey, &nKeyLength, &value) == FAILURE) { return; } @@ -2764,7 +2765,7 @@ SPL_METHOD(CachingIterator, offsetGet) { spl_dual_it_object *intern; char *arKey; - uint nKeyLength; + zend_str_size_uint nKeyLength; zval **value; SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); @@ -2774,7 +2775,7 @@ SPL_METHOD(CachingIterator, offsetGet) return; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arKey, &nKeyLength) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arKey, &nKeyLength) == FAILURE) { return; } @@ -2793,7 +2794,7 @@ SPL_METHOD(CachingIterator, offsetUnset) { spl_dual_it_object *intern; char *arKey; - uint nKeyLength; + zend_str_size_uint nKeyLength; SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); @@ -2802,7 +2803,7 @@ SPL_METHOD(CachingIterator, offsetUnset) return; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arKey, &nKeyLength) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arKey, &nKeyLength) == FAILURE) { return; } @@ -2816,7 +2817,7 @@ SPL_METHOD(CachingIterator, offsetExists) { spl_dual_it_object *intern; char *arKey; - uint nKeyLength; + zend_str_size_uint nKeyLength; SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); @@ -2825,7 +2826,7 @@ SPL_METHOD(CachingIterator, offsetExists) return; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arKey, &nKeyLength) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arKey, &nKeyLength) == FAILURE) { return; } diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h index 73d9d2e6147f2..c99b2001f303b 100644 --- a/ext/spl/spl_iterators.h +++ b/ext/spl/spl_iterators.h @@ -160,7 +160,7 @@ typedef struct _spl_dual_it_object { long preg_flags; pcre_cache_entry *pce; char *regex; - uint regex_len; + zend_str_size_uint regex_len; } regex; #endif _spl_cbfilter_it_intern *cbfilter; diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index 67db7015bbb2b..baf39383b35b7 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -110,13 +110,13 @@ void spl_SplOjectStorage_free_storage(void *object TSRMLS_DC) /* {{{ */ efree(object); } /* }}} */ -static char *spl_object_storage_get_hash(spl_SplObjectStorage *intern, zval *this, zval *obj, int *hash_len_ptr TSRMLS_DC) { +static char *spl_object_storage_get_hash(spl_SplObjectStorage *intern, zval *this, zval *obj, zend_str_size_int *hash_len_ptr TSRMLS_DC) { if (intern->fptr_get_hash) { zval *rv; zend_call_method_with_1_params(&this, intern->std.ce, &intern->fptr_get_hash, "getHash", &rv, obj); if (rv) { if (Z_TYPE_P(rv) == IS_STRING) { - int hash_len = Z_STRSIZE_P(rv); + zend_str_size_int hash_len = Z_STRSIZE_P(rv); char *hash = emalloc((hash_len+1)*sizeof(char)); strncpy(hash, Z_STRVAL_P(rv), hash_len); hash[hash_len] = 0; @@ -183,7 +183,7 @@ static void spl_object_storage_dtor(spl_SplObjectStorageElement *element) /* {{{ zval_ptr_dtor(&element->inf); } /* }}} */ -spl_SplObjectStorageElement* spl_object_storage_get(spl_SplObjectStorage *intern, char *hash, int hash_len TSRMLS_DC) /* {{{ */ +spl_SplObjectStorageElement* spl_object_storage_get(spl_SplObjectStorage *intern, char *hash, zend_str_size_int hash_len TSRMLS_DC) /* {{{ */ { spl_SplObjectStorageElement *element; if (zend_hash_find(&intern->storage, hash, hash_len, (void**)&element) == SUCCESS) { @@ -197,7 +197,7 @@ void spl_object_storage_attach(spl_SplObjectStorage *intern, zval *this, zval *o { spl_SplObjectStorageElement *pelement, element; - int hash_len; + zend_str_size_int hash_len; char *hash = spl_object_storage_get_hash(intern, this, obj, &hash_len TSRMLS_CC); if (!hash) { return; @@ -225,7 +225,8 @@ void spl_object_storage_attach(spl_SplObjectStorage *intern, zval *this, zval *o int spl_object_storage_detach(spl_SplObjectStorage *intern, zval *this, zval *obj TSRMLS_DC) /* {{{ */ { - int hash_len, ret = FAILURE; + zend_str_size_int hash_len; + int ret = FAILURE; char *hash = spl_object_storage_get_hash(intern, this, obj, &hash_len TSRMLS_CC); if (!hash) { return ret; @@ -438,7 +439,8 @@ static zend_object_value spl_SplObjectStorage_new(zend_class_entry *class_type T int spl_object_storage_contains(spl_SplObjectStorage *intern, zval *this, zval *obj TSRMLS_DC) /* {{{ */ { - int hash_len, found; + zend_str_size_int hash_len; + int found; char *hash = spl_object_storage_get_hash(intern, this, obj, &hash_len TSRMLS_CC); if (!hash) { return 0; @@ -505,7 +507,7 @@ SPL_METHOD(SplObjectStorage, offsetGet) spl_SplObjectStorageElement *element; spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); char *hash; - int hash_len; + zend_str_size_int hash_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) { return; @@ -803,13 +805,13 @@ SPL_METHOD(SplObjectStorage, unserialize) spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); char *buf; - int buf_len; + zend_str_size_int buf_len; const unsigned char *p, *s; php_unserialize_data_t var_hash; zval *pentry, *pmembers, *pcount = NULL, *pinf; long count; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &buf, &buf_len) == FAILURE) { return; } @@ -838,7 +840,7 @@ SPL_METHOD(SplObjectStorage, unserialize) while(count-- > 0) { spl_SplObjectStorageElement *pelement; char *hash; - int hash_len; + zend_str_size_int hash_len; if (*p != ';') { goto outexcept; diff --git a/main/streams/glob_wrapper.c b/main/streams/glob_wrapper.c index 9c051a59210ab..0927b0a4c9239 100644 --- a/main/streams/glob_wrapper.c +++ b/main/streams/glob_wrapper.c @@ -47,7 +47,7 @@ typedef struct { size_t pattern_len; } glob_s_t; -PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC) /* {{{ */ +PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, zend_str_size_int *plen STREAMS_DC TSRMLS_DC) /* {{{ */ { glob_s_t *pglob = (glob_s_t *)stream->abstract; @@ -69,7 +69,7 @@ PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, int *plen S } /* }}} */ -PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC) /* {{{ */ +PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, zend_str_size_int *plen STREAMS_DC TSRMLS_DC) /* {{{ */ { glob_s_t *pglob = (glob_s_t *)stream->abstract; diff --git a/main/streams/php_stream_glob_wrapper.h b/main/streams/php_stream_glob_wrapper.h index 330e917bda4ef..3fe8965e746b9 100644 --- a/main/streams/php_stream_glob_wrapper.h +++ b/main/streams/php_stream_glob_wrapper.h @@ -23,10 +23,10 @@ PHPAPI extern php_stream_ops php_glob_stream_ops; BEGIN_EXTERN_C() -PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC); +PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, zend_str_size_int *plen STREAMS_DC TSRMLS_DC); #define php_glob_stream_get_path(stream, copy, plen) _php_glob_stream_get_path((stream), (copy), (plen) STREAMS_CC TSRMLS_CC) -PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC); +PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, zend_str_size_int *plen STREAMS_DC TSRMLS_DC); #define php_glob_stream_get_pattern(stream, copy, plen) _php_glob_stream_get_pattern((stream), (copy), (plen) STREAMS_CC TSRMLS_CC) PHPAPI int _php_glob_stream_get_count(php_stream *stream, int *pflags STREAMS_DC TSRMLS_DC); From e17ef23c2cd22c55f85241c65c8548a66be5c148 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 11 Jul 2013 06:57:22 -0700 Subject: [PATCH 16/31] fixes to url processing stuff --- ext/spl/php_spl.h | 2 +- ext/standard/url.c | 36 ++++++++++++++++++------------------ ext/standard/url.h | 10 +++++----- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/ext/spl/php_spl.h b/ext/spl/php_spl.h index 4794f12443eaa..67f6843626cbb 100644 --- a/ext/spl/php_spl.h +++ b/ext/spl/php_spl.h @@ -66,7 +66,7 @@ ZEND_BEGIN_MODULE_GLOBALS(spl) char * autoload_extensions; HashTable * autoload_functions; int autoload_running; - int autoload_extensions_len; + zend_str_size_int autoload_extensions_len; intptr_t hash_mask_handle; intptr_t hash_mask_handlers; int hash_mask_init; diff --git a/ext/standard/url.c b/ext/standard/url.c index 8dce6af893f0f..c6a7c0535637d 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -61,7 +61,7 @@ PHPAPI void php_url_free(php_url *theurl) /* {{{ php_replace_controlchars */ -PHPAPI char *php_replace_controlchars_ex(char *str, int len) +PHPAPI char *php_replace_controlchars_ex(char *str, zend_str_size_int len) { unsigned char *s = (unsigned char *)str; unsigned char *e = (unsigned char *)str + len; @@ -94,7 +94,7 @@ PHPAPI php_url *php_url_parse(char const *str) /* {{{ php_url_parse */ -PHPAPI php_url *php_url_parse_ex(char const *str, int length) +PHPAPI php_url *php_url_parse_ex(char const *str, zend_str_size_int length) { char port_buf[6]; php_url *ret = ecalloc(1, sizeof(php_url)); @@ -375,11 +375,11 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) PHP_FUNCTION(parse_url) { char *str; - int str_len; + zend_str_size_int str_len; php_url *resource; long key = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &key) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &str_len, &key) == FAILURE) { return; } @@ -485,7 +485,7 @@ static unsigned char hexchars[] = "0123456789ABCDEF"; /* {{{ php_url_encode */ -PHPAPI char *php_url_encode(char const *s, int len, int *new_length) +PHPAPI char *php_url_encode(char const *s, zend_str_size_int len, zend_str_size_int *new_length) { register unsigned char c; unsigned char *to, *start; @@ -534,9 +534,9 @@ PHPAPI char *php_url_encode(char const *s, int len, int *new_length) PHP_FUNCTION(urlencode) { char *in_str, *out_str; - int in_str_len, out_str_len; + zend_str_size_int in_str_len, out_str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &in_str, &in_str_len) == FAILURE) { return; } @@ -551,9 +551,9 @@ PHP_FUNCTION(urlencode) PHP_FUNCTION(urldecode) { char *in_str, *out_str; - int in_str_len, out_str_len; + zend_str_size_int in_str_len, out_str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &in_str, &in_str_len) == FAILURE) { return; } @@ -567,7 +567,7 @@ PHP_FUNCTION(urldecode) /* {{{ php_url_decode */ -PHPAPI int php_url_decode(char *str, int len) +PHPAPI zend_str_size_int php_url_decode(char *str, zend_str_size_int len) { char *dest = str; char *data = str; @@ -598,7 +598,7 @@ PHPAPI int php_url_decode(char *str, int len) /* {{{ php_raw_url_encode */ -PHPAPI char *php_raw_url_encode(char const *s, int len, int *new_length) +PHPAPI char *php_raw_url_encode(char const *s, zend_str_size_int len, zend_str_size_int *new_length) { register int x, y; unsigned char *str; @@ -635,9 +635,9 @@ PHPAPI char *php_raw_url_encode(char const *s, int len, int *new_length) PHP_FUNCTION(rawurlencode) { char *in_str, *out_str; - int in_str_len, out_str_len; + zend_str_size_int in_str_len, out_str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &in_str, &in_str_len) == FAILURE) { return; } @@ -652,9 +652,9 @@ PHP_FUNCTION(rawurlencode) PHP_FUNCTION(rawurldecode) { char *in_str, *out_str; - int in_str_len, out_str_len; + zend_str_size_int in_str_len, out_str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &in_str, &in_str_len) == FAILURE) { return; } @@ -668,7 +668,7 @@ PHP_FUNCTION(rawurldecode) /* {{{ php_raw_url_decode */ -PHPAPI int php_raw_url_decode(char *str, int len) +PHPAPI zend_str_size_int php_raw_url_decode(char *str, zend_str_size_int len) { char *dest = str; char *data = str; @@ -699,7 +699,7 @@ PHPAPI int php_raw_url_decode(char *str, int len) PHP_FUNCTION(get_headers) { char *url; - int url_len; + zend_str_size_int url_len; php_stream_context *context; php_stream *stream; zval **prev_val, **hdr = NULL, **h; @@ -707,7 +707,7 @@ PHP_FUNCTION(get_headers) HashTable *hashT; long format = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &url, &url_len, &format) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &url, &url_len, &format) == FAILURE) { return; } context = FG(default_context) ? FG(default_context) : (FG(default_context) = php_stream_context_alloc(TSRMLS_C)); diff --git a/ext/standard/url.h b/ext/standard/url.h index 87e2efbc73d29..03e0068221b46 100644 --- a/ext/standard/url.h +++ b/ext/standard/url.h @@ -33,11 +33,11 @@ typedef struct php_url { PHPAPI void php_url_free(php_url *theurl); PHPAPI php_url *php_url_parse(char const *str); -PHPAPI php_url *php_url_parse_ex(char const *str, int length); -PHPAPI int php_url_decode(char *str, int len); /* return value: length of decoded string */ -PHPAPI int php_raw_url_decode(char *str, int len); /* return value: length of decoded string */ -PHPAPI char *php_url_encode(char const *s, int len, int *new_length); -PHPAPI char *php_raw_url_encode(char const *s, int len, int *new_length); +PHPAPI php_url *php_url_parse_ex(char const *str, zend_str_size_int length); +PHPAPI zend_str_size_int php_url_decode(char *str, zend_str_size_int len); /* return value: length of decoded string */ +PHPAPI zend_str_size_int php_raw_url_decode(char *str, zend_str_size_int len); /* return value: length of decoded string */ +PHPAPI char *php_url_encode(char const *s, zend_str_size_int len, zend_str_size_int *new_length); +PHPAPI char *php_raw_url_encode(char const *s, zend_str_size_int len, zend_str_size_int *new_length); PHP_FUNCTION(parse_url); PHP_FUNCTION(urlencode); From 8f7abf4371cbf7b058de976021639225390f9878 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 11 Jul 2013 07:02:58 -0700 Subject: [PATCH 17/31] fix base64 stuff --- ext/standard/base64.c | 14 +++++++------- ext/standard/base64.h | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ext/standard/base64.c b/ext/standard/base64.c index 7534c8f8a4063..8e001c595a8d6 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -53,7 +53,7 @@ static const short base64_reverse_table[256] = { }; /* }}} */ -PHPAPI unsigned char *php_base64_encode(const unsigned char *str, int length, int *ret_length) /* {{{ */ +PHPAPI unsigned char *php_base64_encode(const unsigned char *str, zend_str_size_int length, zend_str_size_int *ret_length) /* {{{ */ { const unsigned char *current = str; unsigned char *p; @@ -134,13 +134,13 @@ void php_base64_init(void) */ /* }}} */ -PHPAPI unsigned char *php_base64_decode(const unsigned char *str, int length, int *ret_length) /* {{{ */ +PHPAPI unsigned char *php_base64_decode(const unsigned char *str, zend_str_size_int length, zend_str_size_int *ret_length) /* {{{ */ { return php_base64_decode_ex(str, length, ret_length, 0); } /* }}} */ -PHPAPI unsigned char *php_base64_decode_ex(const unsigned char *str, int length, int *ret_length, zend_bool strict) /* {{{ */ +PHPAPI unsigned char *php_base64_decode_ex(const unsigned char *str, zend_str_size_int length, zend_str_size_int *ret_length, zend_bool strict) /* {{{ */ { const unsigned char *current = str; int ch, i = 0, j = 0, k; @@ -221,9 +221,9 @@ PHP_FUNCTION(base64_encode) { char *str; unsigned char *result; - int str_len, ret_length; + zend_str_size_int str_len, ret_length; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { return; } result = php_base64_encode((unsigned char*)str, str_len, &ret_length); @@ -242,9 +242,9 @@ PHP_FUNCTION(base64_decode) char *str; unsigned char *result; zend_bool strict = 0; - int str_len, ret_length; + zend_str_size_int str_len, ret_length; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &str, &str_len, &strict) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &str, &str_len, &strict) == FAILURE) { return; } result = php_base64_decode_ex((unsigned char*)str, str_len, &ret_length, strict); diff --git a/ext/standard/base64.h b/ext/standard/base64.h index 3f9d818baa210..6f25fb75de7d0 100644 --- a/ext/standard/base64.h +++ b/ext/standard/base64.h @@ -24,9 +24,9 @@ PHP_FUNCTION(base64_decode); PHP_FUNCTION(base64_encode); -PHPAPI extern unsigned char *php_base64_encode(const unsigned char *, int, int *); -PHPAPI extern unsigned char *php_base64_decode_ex(const unsigned char *, int, int *, zend_bool); -PHPAPI extern unsigned char *php_base64_decode(const unsigned char *, int, int *); +PHPAPI extern unsigned char *php_base64_encode(const unsigned char *, zend_str_size_int, zend_str_size_int *); +PHPAPI extern unsigned char *php_base64_decode_ex(const unsigned char *, zend_str_size_int, zend_str_size_int *, zend_bool); +PHPAPI extern unsigned char *php_base64_decode(const unsigned char *, zend_str_size_int, zend_str_size_int *); #endif /* BASE64_H */ From 5ae81ec123c8049ad98fab5cb9c4da3b4d890bab Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 11 Jul 2013 08:12:30 -0700 Subject: [PATCH 18/31] fix uuencode --- ext/standard/php_uuencode.h | 4 ++-- ext/standard/uuencode.c | 25 ++++++++++++++----------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ext/standard/php_uuencode.h b/ext/standard/php_uuencode.h index 28bcb09c3e897..dfc579506d4f2 100644 --- a/ext/standard/php_uuencode.h +++ b/ext/standard/php_uuencode.h @@ -24,8 +24,8 @@ PHP_FUNCTION(convert_uudecode); PHP_FUNCTION(convert_uuencode); -PHPAPI int php_uudecode(char *src, int src_len, char **dest); -PHPAPI int php_uuencode(char *src, int src_len, char **dest); +PHPAPI zend_str_size_int php_uudecode(char *src, zend_str_size_int src_len, char **dest, int *error); +PHPAPI zend_str_size_int php_uuencode(char *src, zend_str_size_int src_len, char **dest); #endif /* PHP_UUENCODE_H */ diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c index 76701ff24b198..b44b01996be22 100644 --- a/ext/standard/uuencode.c +++ b/ext/standard/uuencode.c @@ -65,9 +65,9 @@ #define PHP_UU_DEC(c) (((c) - ' ') & 077) -PHPAPI int php_uuencode(char *src, int src_len, char **dest) /* {{{ */ +PHPAPI zend_str_size_int php_uuencode(char *src, zend_str_size_int src_len, char **dest) /* {{{ */ { - int len = 45; + zend_str_size_int len = 45; char *p, *s, *e, *ee; /* encoded length is ~ 38% greater than the original */ @@ -124,11 +124,12 @@ PHPAPI int php_uuencode(char *src, int src_len, char **dest) /* {{{ */ } /* }}} */ -PHPAPI int php_uudecode(char *src, int src_len, char **dest) /* {{{ */ +PHPAPI zend_str_size_int php_uudecode(char *src, zend_str_size_int src_len, char **dest, int *error) /* {{{ */ { - int len, total_len=0; + zend_str_size_int len, total_len=0; char *s, *e, *p, *ee; + *error = 0; p = *dest = safe_emalloc((size_t) ceil(src_len * 0.75), 1, 1); s = src; e = src + src_len; @@ -181,7 +182,8 @@ PHPAPI int php_uudecode(char *src, int src_len, char **dest) /* {{{ */ err: efree(*dest); - return -1; + *error = 1; + return 0; } /* }}} */ @@ -190,9 +192,9 @@ PHPAPI int php_uudecode(char *src, int src_len, char **dest) /* {{{ */ PHP_FUNCTION(convert_uuencode) { char *src, *dst; - int src_len, dst_len; + zend_str_size_int src_len, dst_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &src, &src_len) == FAILURE || src_len < 1) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &src, &src_len) == FAILURE || src_len < 1) { RETURN_FALSE; } @@ -207,14 +209,15 @@ PHP_FUNCTION(convert_uuencode) PHP_FUNCTION(convert_uudecode) { char *src, *dst; - int src_len, dst_len; + zend_str_size_int src_len, dst_len; + int err = 0;; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &src, &src_len) == FAILURE || src_len < 1) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &src, &src_len) == FAILURE || src_len < 1) { RETURN_FALSE; } - dst_len = php_uudecode(src, src_len, &dst); - if (dst_len < 0) { + dst_len = php_uudecode(src, src_len, &dst, &err); + if (err) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The given parameter is not a valid uuencoded string"); RETURN_FALSE; } From eb5ab0826790f5dbb5b3ba6df905669691b2d0a9 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 17 Jul 2013 03:31:17 -0700 Subject: [PATCH 19/31] fixes to zend_ini and output --- Zend/zend_ini.c | 20 ++++++++++---------- Zend/zend_ini.h | 24 ++++++++++++------------ main/fopen_wrappers.c | 4 ++-- main/fopen_wrappers.h | 2 +- main/main.c | 22 +++++++++++----------- main/php.h | 4 ++-- main/spprintf.c | 4 ++-- main/spprintf.h | 4 ++-- 8 files changed, 42 insertions(+), 42 deletions(-) diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 9e8e828d840d8..3afb67b2f3026 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -145,7 +145,7 @@ ZEND_API int zend_copy_ini_directives(TSRMLS_D) /* {{{ */ /* }}} */ #endif -static int ini_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ +static zend_str_size_int ini_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ { const Bucket *f; const Bucket *s; @@ -244,7 +244,7 @@ ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) /* {{{ */ /* }}} */ #endif -ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage) /* {{{ */ +ZEND_API int zend_alter_ini_entry(char *name, zend_str_size_uint name_length, char *new_value, zend_str_size_uint new_value_length, int modify_type, int stage) /* {{{ */ { TSRMLS_FETCH(); @@ -252,7 +252,7 @@ ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, } /* }}} */ -ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC) /* {{{ */ +ZEND_API int zend_alter_ini_entry_ex(char *name, zend_str_size_uint name_length, char *new_value, zend_str_size_uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC) /* {{{ */ { zend_ini_entry *ini_entry; char *duplicate; @@ -306,7 +306,7 @@ ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_val } /* }}} */ -ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage) /* {{{ */ +ZEND_API int zend_restore_ini_entry(char *name, zend_str_size_uint name_length, int stage) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); @@ -328,7 +328,7 @@ ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage) /* } /* }}} */ -ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) /* {{{ */ +ZEND_API int zend_ini_register_displayer(char *name, zend_str_size_uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) /* {{{ */ { zend_ini_entry *ini_entry; @@ -345,7 +345,7 @@ ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*di * Data retrieval */ -ZEND_API long zend_ini_long(char *name, uint name_length, int orig) /* {{{ */ +ZEND_API long zend_ini_long(char *name, zend_str_size_uint name_length, int orig) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); @@ -362,7 +362,7 @@ ZEND_API 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, zend_str_size_uint name_length, int orig) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); @@ -379,7 +379,7 @@ ZEND_API double zend_ini_double(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, zend_str_size_uint name_length, int orig, zend_bool *exists) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); @@ -403,7 +403,7 @@ ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_b } /* }}} */ -ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) /* {{{ */ +ZEND_API char *zend_ini_string(char *name, zend_str_size_uint name_length, int orig) /* {{{ */ { zend_bool exists = 1; char *return_value; @@ -425,7 +425,7 @@ static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) /* {{{ */ ini_entry->displayer(ini_entry, type); } else { char *display_string; - uint display_string_length; + zend_str_size_uint display_string_length; if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { if (ini_entry->orig_value) { diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h index b27d3d4adde7c..42bd7990fbca9 100644 --- a/Zend/zend_ini.h +++ b/Zend/zend_ini.h @@ -57,24 +57,24 @@ #endif -#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage TSRMLS_DC) +#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, char *new_value, zend_str_size_int new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage TSRMLS_DC) #define ZEND_INI_DISP(name) void name(zend_ini_entry *ini_entry, int type) struct _zend_ini_entry { int module_number; int modifiable; char *name; - uint name_length; + zend_str_size_uint name_length; ZEND_INI_MH((*on_modify)); void *mh_arg1; void *mh_arg2; void *mh_arg3; char *value; - uint value_length; + zend_str_size_uint value_length; char *orig_value; - uint orig_value_length; + zend_str_size_uint orig_value_length; int orig_modifiable; int modified; @@ -94,17 +94,17 @@ ZEND_API void zend_ini_sort_entries(TSRMLS_D); ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int module_number TSRMLS_DC); ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC); ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC); -ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage); -ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC); -ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage); +ZEND_API int zend_alter_ini_entry(char *name, zend_str_size_uint name_length, char *new_value, zend_str_size_uint new_value_length, int modify_type, int stage); +ZEND_API int zend_alter_ini_entry_ex(char *name, zend_str_size_uint name_length, char *new_value, zend_str_size_uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC); +ZEND_API int zend_restore_ini_entry(char *name, zend_str_size_uint name_length, int stage); ZEND_API void display_ini_entries(zend_module_entry *module); -ZEND_API long zend_ini_long(char *name, uint name_length, int orig); -ZEND_API double zend_ini_double(char *name, uint name_length, int orig); -ZEND_API char *zend_ini_string(char *name, uint name_length, int orig); -ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_bool *exists); +ZEND_API long zend_ini_long(char *name, zend_str_size_uint name_length, int orig); +ZEND_API double zend_ini_double(char *name, zend_str_size_uint name_length, int orig); +ZEND_API char *zend_ini_string(char *name, zend_str_size_uint name_length, int orig); +ZEND_API char *zend_ini_string_ex(char *name, zend_str_size_uint name_length, int orig, zend_bool *exists); -ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)); +ZEND_API int zend_ini_register_displayer(char *name, zend_str_size_uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)); ZEND_API ZEND_INI_DISP(zend_ini_boolean_displayer_cb); ZEND_API ZEND_INI_DISP(zend_ini_color_displayer_cb); diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index 6f11cf3f3254b..b40d2ce8d1076 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -410,7 +410,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC) #endif if (PG(doc_root) && path_info && (length = strlen(PG(doc_root))) && IS_ABSOLUTE_PATH(PG(doc_root), length)) { - int path_len = strlen(path_info); + zend_str_size_int path_len = strlen(path_info); filename = emalloc(length + path_len + 2); if (filename) { memcpy(filename, PG(doc_root), length); @@ -470,7 +470,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC) /* {{{ php_resolve_path * Returns the realpath for given filename according to include path */ -PHPAPI char *php_resolve_path(const char *filename, int filename_length, const char *path TSRMLS_DC) +PHPAPI char *php_resolve_path(const char *filename, zend_str_size_int filename_length, const char *path TSRMLS_DC) { char resolved_path[MAXPATHLEN]; char trypath[MAXPATHLEN]; diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h index ee96eef313a8c..60a21b419c2fa 100644 --- a/main/fopen_wrappers.h +++ b/main/fopen_wrappers.h @@ -46,7 +46,7 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path PHPAPI int php_check_safe_mode_include_dir(const char *path TSRMLS_DC); -PHPAPI char *php_resolve_path(const char *filename, int filename_len, const char *path TSRMLS_DC); +PHPAPI char *php_resolve_path(const char *filename, zend_str_size_int filename_len, const char *path TSRMLS_DC); PHPAPI FILE *php_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path TSRMLS_DC); diff --git a/main/main.c b/main/main.c index de794ace995f7..bef128faf72bf 100644 --- a/main/main.c +++ b/main/main.c @@ -323,7 +323,7 @@ static PHP_INI_MH(OnUpdateTimeout) /* {{{ php_get_display_errors_mode() helper function */ -static int php_get_display_errors_mode(char *value, int value_length) +static int php_get_display_errors_mode(char *value, zend_str_size_int value_length) { int mode; @@ -661,7 +661,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) /* {{{ php_write wrapper for modules to use PHPWRITE */ -PHPAPI int php_write(void *buf, uint size TSRMLS_DC) +PHPAPI zend_str_size_int php_write(void *buf, zend_str_size_uint size TSRMLS_DC) { return PHPWRITE(buf, size); } @@ -669,12 +669,12 @@ PHPAPI int php_write(void *buf, uint size TSRMLS_DC) /* {{{ php_printf */ -PHPAPI int php_printf(const char *format, ...) +PHPAPI zend_str_size_int php_printf(const char *format, ...) { va_list args; - int ret; + size_t ret; char *buffer; - int size; + zend_str_size_int size; TSRMLS_FETCH(); va_start(args, format); @@ -938,7 +938,7 @@ PHPAPI void php_html_puts(const char *str, uint size TSRMLS_DC) /* {{{ php_error_cb extended error handling function */ -static void php_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) +static void php_error_cb(int type, const char *error_filename, const zend_str_size_uint error_lineno, const char *format, va_list args) { char *buffer; int buffer_len, display; @@ -1264,7 +1264,7 @@ PHP_FUNCTION(set_time_limit) { long new_timeout; char *new_timeout_str; - int new_timeout_strlen; + zend_str_size_int new_timeout_strlen; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_timeout) == FAILURE) { return; @@ -1361,7 +1361,7 @@ PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *h } /* }}} */ -static char *php_resolve_path_for_zend(const char *filename, int filename_len TSRMLS_DC) /* {{{ */ +static char *php_resolve_path_for_zend(const char *filename, zend_str_size_int filename_len TSRMLS_DC) /* {{{ */ { return php_resolve_path(filename, filename_len, PG(include_path) TSRMLS_CC); } @@ -1369,7 +1369,7 @@ static char *php_resolve_path_for_zend(const char *filename, int filename_len TS /* {{{ php_get_configuration_directive_for_zend */ -static int php_get_configuration_directive_for_zend(const char *name, uint name_length, zval *contents) +static int php_get_configuration_directive_for_zend(const char *name, zend_str_size_uint name_length, zval *contents) { zval *retval = cfg_get_entry(name, name_length); @@ -1857,7 +1857,7 @@ PHPAPI void php_com_initialize(TSRMLS_D) /* {{{ php_output_wrapper */ -static int php_output_wrapper(const char *str, uint str_length) +static zend_str_size_int php_output_wrapper(const char *str, zend_str_size_uint str_length) { TSRMLS_FETCH(); return php_output_write(str, str_length TSRMLS_CC); @@ -2446,7 +2446,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) primary_file->opened_path == NULL && primary_file->type != ZEND_HANDLE_FILENAME ) { - int realfile_len; + zend_str_size_int realfile_len; int dummy = 1; if (expand_filepath(primary_file->filename, realfile TSRMLS_CC)) { diff --git a/main/php.h b/main/php.h index 7c1f8fd0c7b96..15e4e137cee23 100644 --- a/main/php.h +++ b/main/php.h @@ -277,8 +277,8 @@ ssize_t pread(int, void *, size_t, off64_t); BEGIN_EXTERN_C() void phperror(char *error); -PHPAPI int php_write(void *buf, uint size TSRMLS_DC); -PHPAPI int php_printf(const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, +PHPAPI zend_str_size_int php_write(void *buf, zend_str_size_uint size TSRMLS_DC); +PHPAPI zend_str_size_int php_printf(const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, 2); PHPAPI int php_get_module_initialized(void); PHPAPI void php_log_err(char *log_message TSRMLS_DC); diff --git a/main/spprintf.c b/main/spprintf.c index 9064e206a9886..b42dfd5f5e5ba 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -792,7 +792,7 @@ static void xbuf_format_converter(smart_str *xbuf, const char *fmt, va_list ap) /* * This is the general purpose conversion function. */ -PHPAPI int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) /* {{{ */ +PHPAPI zend_str_size_int vspprintf(char **pbuf, zend_str_size_size_t max_len, const char *format, va_list ap) /* {{{ */ { smart_str xbuf = {0}; @@ -809,7 +809,7 @@ PHPAPI int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap } /* }}} */ -PHPAPI int spprintf(char **pbuf, size_t max_len, const char *format, ...) /* {{{ */ +PHPAPI zend_str_size_int spprintf(char **pbuf, size_t max_len, const char *format, ...) /* {{{ */ { int cc; va_list ap; diff --git a/main/spprintf.h b/main/spprintf.h index 397928a794501..544612105f0af 100644 --- a/main/spprintf.h +++ b/main/spprintf.h @@ -37,9 +37,9 @@ There is also snprintf: See difference explained in snprintf.h #include "snprintf.h" BEGIN_EXTERN_C() -PHPAPI int spprintf( char **pbuf, size_t max_len, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4); +PHPAPI zend_str_size_int spprintf( char **pbuf, size_t max_len, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4); -PHPAPI int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) PHP_ATTRIBUTE_FORMAT(printf, 3, 0); +PHPAPI zend_str_size_int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) PHP_ATTRIBUTE_FORMAT(printf, 3, 0); END_EXTERN_C() #endif /* SNPRINTF_H */ From c292a1851404b2a68f753487e082d6cefc3ceff2 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 17 Jul 2013 04:53:56 -0700 Subject: [PATCH 20/31] fixes to xp_socket.c --- main/streams/xp_socket.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index 6745edf7140f2..b6375152d70f9 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -39,6 +39,13 @@ # define MSG_PEEK 0 #endif +#ifdef PHP_WIN32 +/* send/recv family on windows expects int */ +# define XP_SOCK_BUF_SIZE(sz) (((sz) > INT_MAX) ? INT_MAX : (int)(sz)) +#else +# define XP_SOCK_BUF_SIZE(sz) (sz) +#endif + php_stream_ops php_stream_generic_socket_ops; PHPAPI php_stream_ops php_stream_socket_ops; php_stream_ops php_stream_udp_socket_ops; @@ -54,7 +61,7 @@ static int php_tcp_sockop_set_option(php_stream *stream, int option, int value, static zend_str_size_size_t php_sockop_write(php_stream *stream, const char *buf, zend_str_size_size_t count TSRMLS_DC) { php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; - zend_str_size didwrite; + ssize_t didwrite; struct timeval *ptimeout; if (sock->socket == -1) { @@ -67,7 +74,7 @@ static zend_str_size_size_t php_sockop_write(php_stream *stream, const char *buf ptimeout = &sock->timeout; retry: - didwrite = send(sock->socket, buf, count, (sock->is_blocked && ptimeout) ? MSG_DONTWAIT : 0); + didwrite = send(sock->socket, buf, XP_SOCK_BUF_SIZE(count), (sock->is_blocked && ptimeout) ? MSG_DONTWAIT : 0); if (didwrite <= 0) { long err = php_socket_errno(); @@ -144,7 +151,7 @@ static void php_sock_stream_wait_for_data(php_stream *stream, php_netstream_data static zend_str_size_size_t php_sockop_read(php_stream *stream, char *buf, zend_str_size_size_t count TSRMLS_DC) { php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; - zend_str_size nr_bytes = 0; + ssize_t nr_bytes = 0; if (sock->socket == -1) { return 0; @@ -156,7 +163,7 @@ static zend_str_size_size_t php_sockop_read(php_stream *stream, char *buf, zend_ return 0; } - nr_bytes = recv(sock->socket, buf, count, (sock->is_blocked && sock->timeout.tv_sec != -1) ? MSG_DONTWAIT : 0); + nr_bytes = recv(sock->socket, buf, XP_SOCK_BUF_SIZE(count), (sock->is_blocked && sock->timeout.tv_sec != -1) ? MSG_DONTWAIT : 0); stream->eof = (nr_bytes == 0 || (nr_bytes == -1 && php_socket_errno() != EWOULDBLOCK)); @@ -234,31 +241,32 @@ static inline int sock_sendto(php_netstream_data_t *sock, char *buf, zend_str_si struct sockaddr *addr, socklen_t addrlen TSRMLS_DC) { - int ret; + ssize_t ret; if (addr) { - ret = sendto(sock->socket, buf, buflen, flags, addr, addrlen); + ret = sendto(sock->socket, buf, XP_SOCK_BUF_SIZE(buflen), flags, addr, XP_SOCK_BUF_SIZE(addrlen)); + return (ret == SOCK_CONN_ERR) ? -1 : ret; } - return ((ret = send(sock->socket, buf, buflen, flags)) == SOCK_CONN_ERR) ? -1 : ret; + return ((ret = send(sock->socket, buf, XP_SOCK_BUF_SIZE(buflen), flags)) == SOCK_CONN_ERR) ? -1 : ret; } static inline int sock_recvfrom(php_netstream_data_t *sock, char *buf, size_t buflen, int flags, - char **textaddr, long *textaddrlen, + char **textaddr, zend_str_size_long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC) { php_sockaddr_storage sa; socklen_t sl = sizeof(sa); - int ret; + ssize_t ret; int want_addr = textaddr || addr; if (want_addr) { - ret = recvfrom(sock->socket, buf, buflen, flags, (struct sockaddr*)&sa, &sl); + ret = recvfrom(sock->socket, buf, XP_SOCK_BUF_SIZE(buflen), flags, (struct sockaddr*)&sa, &sl); ret = (ret == SOCK_CONN_ERR) ? -1 : ret; php_network_populate_name_from_sockaddr((struct sockaddr*)&sa, sl, textaddr, textaddrlen, addr, addrlen TSRMLS_CC); } else { - ret = recv(sock->socket, buf, buflen, flags); + ret = recv(sock->socket, buf, XP_SOCK_BUF_SIZE(buflen), flags); ret = (ret == SOCK_CONN_ERR) ? -1 : ret; } From 06fe769905f2c5e43a93ddd2683e8a27c486407b Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 17 Jul 2013 05:50:33 -0700 Subject: [PATCH 21/31] fixes to plain stream wrapper --- main/streams/plain_wrapper.c | 24 +++++++++++++++--------- win32/winutil.c | 2 +- win32/winutil.h | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 39df31a170503..3657d6b54095b 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -53,6 +53,12 @@ extern int php_get_uid_by_name(const char *name, uid_t *uid TSRMLS_DC); extern int php_get_gid_by_name(const char *name, gid_t *gid TSRMLS_DC); #endif +#if defined(PHP_WIN32) +# define PLAIN_WRAP_BUF_SIZE(st) (((st) > UINT_MAX) ? UINT_MAX : (unsigned int)(st)) +#else +# define PLAIN_WRAP_BUF_SIZE(st) (st) +#endif + /* parse standard "fopen" modes into open() flags */ PHPAPI int php_stream_parse_fopen_modes(const char *mode, int *open_flags) { @@ -322,7 +328,7 @@ static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count assert(data != NULL); if (data->fd >= 0) { - int bytes_written = write(data->fd, buf, count); + ssize_t bytes_written = write(data->fd, buf, PLAIN_WRAP_BUF_SIZE(count)); if (bytes_written < 0) return 0; return (size_t) bytes_written; } else { @@ -346,13 +352,13 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS assert(data != NULL); if (data->fd >= 0) { - ret = read(data->fd, buf, count); + ret = read(data->fd, buf, PLAIN_WRAP_BUF_SIZE(count)); if (ret == (size_t)-1 && errno == EINTR) { /* Read was interrupted, retry once, If read still fails, giveup with feof==0 so script can retry if desired */ - ret = read(data->fd, buf, count); + ret = read(data->fd, buf, PLAIN_WRAP_BUF_SIZE(count)); } stream->eof = (ret == 0 || (ret == (size_t)-1 && errno != EWOULDBLOCK && errno != EINTR && errno != EBADF)); @@ -1164,7 +1170,7 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, char *dir, int mod /* we look for directory separator from the end of string, thus hopefuly reducing our work load */ char *e; struct stat sb; - int dir_len = strlen(dir); + zend_str_size_int dir_len = strlen(dir); int offset = 0; char buf[MAXPATHLEN]; @@ -1238,7 +1244,7 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, char *dir, int mod static int php_plain_files_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) { #if PHP_WIN32 - int url_len = strlen(url); + zend_str_size_int url_len = strlen(url); #endif if (php_check_open_basedir(url TSRMLS_CC)) { return 0; @@ -1273,7 +1279,7 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, char *url, int mode_t mode; int ret = 0; #if PHP_WIN32 - int url_len = strlen(url); + zend_str_size_int url_len = strlen(url); #endif #if PHP_WIN32 @@ -1378,9 +1384,9 @@ PHPAPI php_stream *_php_stream_fopen_with_path(char *filename, char *mode, char const char *exec_fname; char trypath[MAXPATHLEN]; php_stream *stream; - int path_length; - int filename_length; - int exec_fname_length; + zend_str_size_int path_length; + zend_str_size_int filename_length; + zend_str_size_int exec_fname_length; if (opened_path) { *opened_path = NULL; diff --git a/win32/winutil.c b/win32/winutil.c index 4afc28feca7db..1f467c9864232 100644 --- a/win32/winutil.c +++ b/win32/winutil.c @@ -34,7 +34,7 @@ PHPAPI char *php_win32_error_to_msg(int error) return (buf ? (char *) buf : ""); } -int php_win32_check_trailing_space(const char * path, const int path_len) { +int php_win32_check_trailing_space(const char * path, const zend_str_size_int path_len) { if (path_len < 1) { return 1; } diff --git a/win32/winutil.h b/win32/winutil.h index 8cf07ec286ffd..3292174fc3868 100644 --- a/win32/winutil.h +++ b/win32/winutil.h @@ -19,7 +19,7 @@ PHPAPI char *php_win32_error_to_msg(int error); #define php_win_err() php_win32_error_to_msg(GetLastError()) -int php_win32_check_trailing_space(const char * path, const int path_len); +int php_win32_check_trailing_space(const char * path, const zend_str_size_int path_len); PHPAPI php_win32_get_random_bytes(unsigned char *buf, size_t size); #ifdef ZTS From cc3ec2936caca1e3698e104914ff08c3d5ca16fe Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 17 Jul 2013 06:06:35 -0700 Subject: [PATCH 22/31] fixes to SAPI.c --- main/SAPI.c | 16 ++++++++-------- main/SAPI.h | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/main/SAPI.c b/main/SAPI.c index dcb2da629a03b..075b1eb22110d 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -192,7 +192,7 @@ SAPI_API void sapi_handle_post(void *arg TSRMLS_DC) static void sapi_read_post_data(TSRMLS_D) { sapi_post_entry *post_entry; - uint content_type_length = strlen(SG(request_info).content_type); + zend_str_size_uint content_type_length = strlen(SG(request_info).content_type); char *content_type = estrndup(SG(request_info).content_type, content_type_length); char *p; char oldchar=0; @@ -285,10 +285,10 @@ SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data) } -static inline char *get_default_content_type(uint prefix_len, uint *len TSRMLS_DC) +static inline char *get_default_content_type(zend_str_size_uint prefix_len, zend_str_size_uint *len TSRMLS_DC) { char *mimetype, *charset, *content_type; - uint mimetype_len, charset_len; + zend_str_size_uint mimetype_len, charset_len; if (SG(default_mimetype)) { mimetype = SG(default_mimetype); @@ -327,7 +327,7 @@ static inline char *get_default_content_type(uint prefix_len, uint *len TSRMLS_D SAPI_API char *sapi_get_default_content_type(TSRMLS_D) { - uint len; + zend_str_size_uint len; return get_default_content_type(0, &len TSRMLS_CC); } @@ -335,7 +335,7 @@ SAPI_API char *sapi_get_default_content_type(TSRMLS_D) SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_header TSRMLS_DC) { - uint len; + zend_str_size_uint len; default_header->header = get_default_content_type(sizeof("Content-type: ")-1, &len TSRMLS_CC); default_header->header_len = len; @@ -591,7 +591,7 @@ static void sapi_update_response_code(int ncode TSRMLS_DC) * since zend_llist_del_element only remove one matched item once, * we should remove them by ourself */ -static void sapi_remove_header(zend_llist *l, char *name, uint len) { +static void sapi_remove_header(zend_llist *l, char *name, zend_str_size_uint len) { sapi_header_struct *header; zend_llist_element *next; zend_llist_element *current=l->head; @@ -858,7 +858,7 @@ SAPI_API int sapi_send_headers(TSRMLS_D) */ if (SG(sapi_headers).send_default_content_type && sapi_module.send_headers) { sapi_header_struct default_header; - uint len; + zend_str_size_uint len; SG(sapi_headers).mimetype = get_default_content_type(0, &len TSRMLS_CC); default_header.header_len = sizeof("Content-type: ") - 1 + len; @@ -975,7 +975,7 @@ SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zva return SUCCESS; } -SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC) +SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, zend_str_size_uint val_len, zend_str_size_uint *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC) { if (SG(sapi_started) && EG(in_execution)) { return FAILURE; diff --git a/main/SAPI.h b/main/SAPI.h index 92b7329dbc16c..e0a3adcbcda6c 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -50,7 +50,7 @@ typedef struct { char *header; - uint header_len; + zend_str_size_uint header_len; } sapi_header_struct; @@ -194,7 +194,7 @@ SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry TSRMLS_DC); SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry TSRMLS_DC); SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRMLS_D) TSRMLS_DC); SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC) TSRMLS_DC); -SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC); +SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, zend_str_size_uint val_len, zend_str_size_uint *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC); SAPI_API int sapi_flush(TSRMLS_D); SAPI_API struct stat *sapi_get_stat(TSRMLS_D); @@ -262,7 +262,7 @@ struct _sapi_module_struct { int (*get_target_uid)(uid_t * TSRMLS_DC); int (*get_target_gid)(gid_t * TSRMLS_DC); - unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC); + unsigned int (*input_filter)(int arg, char *var, char **val, zend_str_size_uint val_len, zend_str_size_uint *new_val_len TSRMLS_DC); void (*ini_defaults)(HashTable *configuration_hash); int phpinfo_as_text; @@ -296,7 +296,7 @@ struct _sapi_post_entry { #define SAPI_POST_HANDLER_FUNC(post_handler) void post_handler(char *content_type_dup, void *arg TSRMLS_DC) #define SAPI_TREAT_DATA_FUNC(treat_data) void treat_data(int arg, char *str, zval* destArray TSRMLS_DC) -#define SAPI_INPUT_FILTER_FUNC(input_filter) unsigned int input_filter(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC) +#define SAPI_INPUT_FILTER_FUNC(input_filter) unsigned int input_filter(int arg, char *var, char **val, zend_str_size_uint val_len, zend_str_size_uint *new_val_len TSRMLS_DC) BEGIN_EXTERN_C() SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data); From 9703f57bd118fd4d7518116ad3486e4a6ba80823 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 17 Jul 2013 06:30:28 -0700 Subject: [PATCH 23/31] more fixes to streams --- main/streams/filter.c | 2 +- main/streams/memory.c | 3 ++- main/streams/streams.c | 12 ++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/main/streams/filter.c b/main/streams/filter.c index 6de3a928fe3da..6f3351a3db2e8 100644 --- a/main/streams/filter.c +++ b/main/streams/filter.c @@ -254,7 +254,7 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval HashTable *filter_hash = (FG(stream_filters) ? FG(stream_filters) : &stream_filters_hash); php_stream_filter_factory *factory = NULL; php_stream_filter *filter = NULL; - int n; + zend_str_size_int n; char *period; n = strlen(filtername); diff --git a/main/streams/memory.c b/main/streams/memory.c index 328d3be399018..7ecbbb1593da4 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -606,7 +606,8 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, cha size_t mlen, dlen, plen, vlen; off_t newoffs; zval *meta = NULL; - int base64 = 0, ilen; + int base64 = 0; + zend_str_size_int ilen; if (memcmp(path, "data:", 5)) { return NULL; diff --git a/main/streams/streams.c b/main/streams/streams.c index 823b8859bf3da..082e9c109546e 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -805,7 +805,7 @@ PHPAPI int _php_stream_getc(php_stream *stream TSRMLS_DC) PHPAPI int _php_stream_puts(php_stream *stream, char *buf TSRMLS_DC) { - int len; + zend_str_size_int len; char newline[2] = "\n"; /* is this OK for Win? */ len = strlen(buf); @@ -1387,7 +1387,7 @@ PHPAPI size_t _php_stream_passthru(php_stream * stream STREAMS_DC TSRMLS_DC) { size_t bcount = 0; char buf[8192]; - int b; + zend_str_size_int b; if (php_stream_mmap_possible(stream)) { char *p; @@ -1676,9 +1676,9 @@ int php_shutdown_stream_wrappers(int module_number TSRMLS_DC) /* Validate protocol scheme names during registration * Must conform to /^[a-zA-Z0-9+.-]+$/ */ -static inline int php_stream_wrapper_scheme_validate(char *protocol, int protocol_len) +static inline int php_stream_wrapper_scheme_validate(char *protocol, zend_str_size_int protocol_len) { - int i; + zend_str_size_int i; for(i = 0; i < protocol_len; i++) { if (!isalnum((int)protocol[i]) && @@ -1695,7 +1695,7 @@ static inline int php_stream_wrapper_scheme_validate(char *protocol, int protoco /* API for registering GLOBAL wrappers */ PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC) { - int protocol_len = strlen(protocol); + zend_str_size_int protocol_len = strlen(protocol); if (php_stream_wrapper_scheme_validate(protocol, protocol_len) == FAILURE) { return FAILURE; @@ -1721,7 +1721,7 @@ static void clone_wrapper_hash(TSRMLS_D) /* API for registering VOLATILE wrappers */ PHPAPI int php_register_url_stream_wrapper_volatile(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC) { - int protocol_len = strlen(protocol); + zend_str_size_int protocol_len = strlen(protocol); if (php_stream_wrapper_scheme_validate(protocol, protocol_len) == FAILURE) { return FAILURE; From d4c546b9562d120ceb9f1e6d1ac3c973a48bfd6b Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 17 Jul 2013 09:11:51 -0700 Subject: [PATCH 24/31] fixes to zend --- Zend/zend.c | 4 ++-- Zend/zend.h | 8 ++++---- Zend/zend_execute.h | 2 +- Zend/zend_operators.h | 6 +++++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Zend/zend.c b/Zend/zend.c index b451e6cb230d2..4f43a26a16d1c 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -311,13 +311,13 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop } /* }}} */ -ZEND_API int zend_print_zval(zval *expr, int indent) /* {{{ */ +ZEND_API zend_str_size_int zend_print_zval(zval *expr, int indent) /* {{{ */ { return zend_print_zval_ex(zend_write, expr, indent); } /* }}} */ -ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent) /* {{{ */ +ZEND_API zend_str_size_int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent) /* {{{ */ { zval expr_copy; int use_copy; diff --git a/Zend/zend.h b/Zend/zend.h index e0a71e0f569b3..26b7bab604a25 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -558,11 +558,11 @@ typedef struct _zend_utility_functions { typedef struct _zend_utility_values { char *import_use_extension; - uint import_use_extension_length; + zend_str_size_uint import_use_extension_length; zend_bool html_errors; } zend_utility_values; -typedef int (*zend_write_func_t)(const char *str, uint str_length); +typedef int (*zend_write_func_t)(const char *str, zend_str_size_uint str_length); #undef MIN #undef MAX @@ -643,8 +643,8 @@ END_EXTERN_C() BEGIN_EXTERN_C() ZEND_API char *get_zend_version(void); ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy); -ZEND_API int zend_print_zval(zval *expr, int indent); -ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent); +ZEND_API zend_str_size_int zend_print_zval(zval *expr, int indent); +ZEND_API zend_str_size_int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent); ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC); ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC); ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC); diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index e5b55b3af76b1..a7c3c59e9dcdd 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -198,7 +198,7 @@ static zend_always_inline void zend_vm_stack_destroy(TSRMLS_D) } } -static zend_always_inline void zend_vm_stack_extend(int count TSRMLS_DC) +static zend_always_inline void zend_vm_stack_extend(size_t count TSRMLS_DC) { zend_vm_stack p = zend_vm_stack_new_page(count >= ZEND_VM_STACK_PAGE_SIZE ? count : ZEND_VM_STACK_PAGE_SIZE); p->prev = EG(argument_stack); diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 7e361a7efb93c..a6311f4e42667 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -274,12 +274,16 @@ zend_memnstr(char *haystack, char *needle, zend_str_size_int needle_len, char *e { char *p = haystack; char ne = needle[needle_len-1]; + ptrdiff_t off_p; + zend_str_size_int off_s; if (needle_len == 1) { return (char *)memchr(p, *needle, (end-p)); } - if (needle_len > end-haystack) { + off_p = end - haystack; + off_s = (off_p > 0) ? (zend_str_size_int)off_p : 0; + if (needle_len > off_s) { return NULL; } From 03cae613f0287ae5f873f62910b065ed72489691 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 18 Jul 2013 03:53:51 -0700 Subject: [PATCH 25/31] fixes after merging master --- Zend/zend_vm_def.h | 124 +++--- Zend/zend_vm_execute.h | 876 ++++++++++++++++++++--------------------- 2 files changed, 500 insertions(+), 500 deletions(-) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 518af4365fc9d..14cb932ad8a90 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1026,7 +1026,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST| if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (OP1_TYPE != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -1040,7 +1040,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST| } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); FREE_OP1(); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -1055,10 +1055,10 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST| } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -1072,7 +1072,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST| /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -2302,7 +2302,7 @@ ZEND_VM_HANDLER(54, ZEND_ADD_CHAR, TMP|UNUSED, CONST) if (OP1_TYPE == IS_UNUSED) { /* Initialize for erealloc in add_char_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -2325,7 +2325,7 @@ ZEND_VM_HANDLER(55, ZEND_ADD_STRING, TMP|UNUSED, CONST) if (OP1_TYPE == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -2353,7 +2353,7 @@ ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP|UNUSED, TMP|VAR|CV) if (OP1_TYPE == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -2403,13 +2403,13 @@ ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMP|VAR|UNUSED|CV) if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -2428,7 +2428,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV) USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; zend_free_op free_op1, free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -2445,7 +2445,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV) } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R); @@ -2518,7 +2518,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -2548,12 +2548,12 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS /* do nothing */ } else if (OP2_TYPE != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size_int function_name_strlen = 0; zend_free_op free_op2; if (OP2_TYPE == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = GET_OP2_ZVAL_PTR(BP_VAR_R); @@ -2564,7 +2564,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -2637,7 +2637,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) function_name = (zval*)(opline->op2.literal+1); if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -2651,7 +2651,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) ZEND_VM_NEXT_OPCODE(); } else { char *function_name_strval, *lcname; - int function_name_strlen; + zend_str_size_int function_name_strlen; zend_free_op free_op2; SAVE_OPLINE(); @@ -2659,7 +2659,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); if (function_name_strval[0] == '\\') { function_name_strlen -= 1; lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); @@ -2718,7 +2718,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) } if (Z_TYPE_PP(obj) == IS_STRING) { - ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), NULL, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -2727,15 +2727,15 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) call->object = NULL; if (ce->get_static_method) { - call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC); + call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) TSRMLS_CC); } else { - call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); } } else { call->object = *obj; ce = call->called_scope = Z_OBJCE_PP(obj); - call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); if (UNEXPECTED(call->fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method)); } @@ -2783,9 +2783,9 @@ ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST) func_name = opline->op2.literal + 1; if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE) { + } else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRSIZE(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE) { func_name++; - if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE)) { + if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRSIZE(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -2817,7 +2817,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, CONST, ANY) if (CACHED_PTR(opline->op1.literal->cache_slot)) { EX(function_state).function = CACHED_PTR(opline->op1.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRLEN_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRSIZE_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", fname->value.str.val); } else { @@ -3004,7 +3004,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV) if (CACHED_PTR(opline->op1.literal->cache_slot)) { catch_ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC); + catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC); CACHE_PTR(opline->op1.literal->cache_slot, catch_ce); } @@ -3496,7 +3496,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) c = CACHED_PTR(opline->op2.literal->cache_slot); } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) { if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); + char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv)); if(!actual) { actual = Z_STRVAL_P(opline->op2.zv); } else { @@ -3504,7 +3504,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) } /* non-qualified constant - allow text substitution */ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); + ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -3533,7 +3533,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) } else if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -3552,7 +3552,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) } } - if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { + if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { zend_class_entry *old_scope = EG(scope); @@ -3568,7 +3568,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) } ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value); zval_copy_ctor(&EX_T(opline->result.var).tmp_var); - } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { + } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */ ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1); } else { @@ -3636,14 +3636,14 @@ ZEND_VM_C_LABEL(num_index): if (OP2_TYPE == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index)); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index)); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -3758,7 +3758,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) inc_filename = tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -3771,7 +3771,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); } else { @@ -3914,7 +3914,7 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { if (OP1_TYPE != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -3932,7 +3932,7 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -3988,17 +3988,17 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) if (OP2_TYPE == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_dim)); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_dim)); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) { zval_ptr_dtor(&offset); @@ -4222,7 +4222,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY) zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { char *str_key; - uint str_key_len; + zend_str_size_uint str_key_len; ulong int_key; zend_uchar key_type; @@ -4279,7 +4279,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) zend_object *zobj = zend_objects_get_address(array TSRMLS_CC); int key_type; char *str_key; - zend_uint str_key_len; + zend_str_size_uint str_key_len; zend_ulong int_key; fe_ht = Z_OBJPROP_P(array); @@ -4300,7 +4300,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) ZVAL_LONG(key, int_key); } else { const char *class_name, *prop_name; - int prop_name_len; + zend_str_size_int prop_name_len; zend_unmangle_property_name_ex( str_key, str_key_len - 1, &class_name, &prop_name, &prop_name_len ); @@ -4424,7 +4424,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -4434,7 +4434,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -4508,15 +4508,15 @@ ZEND_VM_C_LABEL(num_index_prop): hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_prop)); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_prop)); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -4574,7 +4574,7 @@ ZEND_VM_C_LABEL(num_index_prop): if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -4586,11 +4586,11 @@ ZEND_VM_C_LABEL(num_index_prop): } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -4710,7 +4710,7 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY) efree(EG(error_reporting_ini_entry)->value); } EG(error_reporting_ini_entry)->value = Z_STRVAL(restored_error_reporting); - EG(error_reporting_ini_entry)->value_length = Z_STRLEN(restored_error_reporting); + EG(error_reporting_ini_entry)->value_length = Z_STRSIZE(restored_error_reporting); } else { zendi_zval_dtor(restored_error_reporting); } @@ -4885,8 +4885,8 @@ ZEND_VM_HANDLER(145, ZEND_DECLARE_INHERITED_CLASS_DELAYED, ANY, ANY) zend_class_entry **pce, **pce_orig; SAVE_OPLINE(); - if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE || - (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS && + if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE || + (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS && *pce != *pce_orig)) { do_bind_inherited_class(EX(op_array), opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC); } @@ -4960,7 +4960,7 @@ ZEND_VM_HANDLER(144, ZEND_ADD_INTERFACE, ANY, CONST) if (CACHED_PTR(opline->op2.literal->cache_slot)) { iface = CACHED_PTR(opline->op2.literal->cache_slot); } else { - iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(iface == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -4988,7 +4988,7 @@ ZEND_VM_HANDLER(154, ZEND_ADD_TRAIT, ANY, ANY) trait = CACHED_PTR(opline->op2.literal->cache_slot); } else { trait = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), - Z_STRLEN_P(opline->op2.zv), + Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(trait == NULL)) { @@ -5102,7 +5102,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) Z_TYPE(restored_error_reporting) = IS_LONG; Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting)); convert_to_string(&restored_error_reporting); - zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); + zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRSIZE(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); zendi_zval_dtor(restored_error_reporting); } EX(old_error_reporting) = NULL; @@ -5191,8 +5191,8 @@ ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST) zval_copy_ctor(&c.value); } c.flags = CONST_CS; /* non persistent, case sensetive */ - c.name = IS_INTERNED(Z_STRVAL_P(name)) ? Z_STRVAL_P(name) : zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); - c.name_len = Z_STRLEN_P(name)+1; + c.name = IS_INTERNED(Z_STRVAL_P(name)) ? Z_STRVAL_P(name) : zend_strndup(Z_STRVAL_P(name), Z_STRSIZE_P(name)); + c.name_len = Z_STRSIZE_P(name)+1; c.module_number = PHP_USER_CONSTANT; if (zend_register_constant(&c TSRMLS_CC) == FAILURE) { @@ -5211,7 +5211,7 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED) SAVE_OPLINE(); - if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) || + if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) || UNEXPECTED(op_array->type != ZEND_USER_FUNCTION)) { zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index a6fec4795267f..a58226a2cf913 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -889,8 +889,8 @@ static int ZEND_FASTCALL ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER(ZEND zend_class_entry **pce, **pce_orig; SAVE_OPLINE(); - if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE || - (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS && + if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE || + (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS && *pce != *pce_orig)) { do_bind_inherited_class(EX(op_array), opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC); } @@ -944,7 +944,7 @@ static int ZEND_FASTCALL ZEND_ADD_TRAIT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) trait = CACHED_PTR(opline->op2.literal->cache_slot); } else { trait = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), - Z_STRLEN_P(opline->op2.zv), + Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(trait == NULL)) { @@ -1058,7 +1058,7 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER Z_TYPE(restored_error_reporting) = IS_LONG; Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting)); convert_to_string(&restored_error_reporting); - zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); + zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRSIZE(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); zendi_zval_dtor(restored_error_reporting); } EX(old_error_reporting) = NULL; @@ -1191,13 +1191,13 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLE if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -1220,7 +1220,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE function_name = (zval*)(opline->op2.literal+1); if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -1234,7 +1234,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE ZEND_VM_NEXT_OPCODE(); } else { char *function_name_strval, *lcname; - int function_name_strlen; + zend_str_size_int function_name_strlen; SAVE_OPLINE(); @@ -1242,7 +1242,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); if (function_name_strval[0] == '\\') { function_name_strlen -= 1; lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); @@ -1301,7 +1301,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE } if (Z_TYPE_PP(obj) == IS_STRING) { - ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), NULL, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -1310,15 +1310,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE call->object = NULL; if (ce->get_static_method) { - call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC); + call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) TSRMLS_CC); } else { - call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); } } else { call->object = *obj; ce = call->called_scope = Z_OBJCE_PP(obj); - call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); if (UNEXPECTED(call->fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method)); } @@ -1366,9 +1366,9 @@ static int ZEND_FASTCALL ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPC func_name = opline->op2.literal + 1; if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE) { + } else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRSIZE(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE) { func_name++; - if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE)) { + if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRSIZE(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -1478,7 +1478,7 @@ static int ZEND_FASTCALL ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND if (CACHED_PTR(opline->op2.literal->cache_slot)) { iface = CACHED_PTR(opline->op2.literal->cache_slot); } else { - iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(iface == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -1515,13 +1515,13 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -1545,7 +1545,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H function_name = (zval*)(opline->op2.literal+1); if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -1559,7 +1559,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H ZEND_VM_NEXT_OPCODE(); } else { char *function_name_strval, *lcname; - int function_name_strlen; + zend_str_size_int function_name_strlen; zend_free_op free_op2; SAVE_OPLINE(); @@ -1567,7 +1567,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); if (function_name_strval[0] == '\\') { function_name_strlen -= 1; lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); @@ -1626,7 +1626,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H } if (Z_TYPE_PP(obj) == IS_STRING) { - ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), NULL, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -1635,15 +1635,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H call->object = NULL; if (ce->get_static_method) { - call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC); + call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) TSRMLS_CC); } else { - call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); } } else { call->object = *obj; ce = call->called_scope = Z_OBJCE_PP(obj); - call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); if (UNEXPECTED(call->fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method)); } @@ -1702,13 +1702,13 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -1732,7 +1732,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H function_name = (zval*)(opline->op2.literal+1); if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -1746,7 +1746,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H ZEND_VM_NEXT_OPCODE(); } else { char *function_name_strval, *lcname; - int function_name_strlen; + zend_str_size_int function_name_strlen; zend_free_op free_op2; SAVE_OPLINE(); @@ -1754,7 +1754,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); if (function_name_strval[0] == '\\') { function_name_strlen -= 1; lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); @@ -1813,7 +1813,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H } if (Z_TYPE_PP(obj) == IS_STRING) { - ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), NULL, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -1822,15 +1822,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H call->object = NULL; if (ce->get_static_method) { - call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC); + call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) TSRMLS_CC); } else { - call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); } } else { call->object = *obj; ce = call->called_scope = Z_OBJCE_PP(obj); - call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); if (UNEXPECTED(call->fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method)); } @@ -1889,13 +1889,13 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDL if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -1928,13 +1928,13 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -1957,7 +1957,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA function_name = (zval*)(opline->op2.literal+1); if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -1971,7 +1971,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA ZEND_VM_NEXT_OPCODE(); } else { char *function_name_strval, *lcname; - int function_name_strlen; + zend_str_size_int function_name_strlen; SAVE_OPLINE(); @@ -1979,7 +1979,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); if (function_name_strval[0] == '\\') { function_name_strlen -= 1; lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); @@ -2038,7 +2038,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA } if (Z_TYPE_PP(obj) == IS_STRING) { - ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), NULL, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -2047,15 +2047,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA call->object = NULL; if (ce->get_static_method) { - call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC); + call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) TSRMLS_CC); } else { - call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); } } else { call->object = *obj; ce = call->called_scope = Z_OBJCE_PP(obj); - call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); + call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); if (UNEXPECTED(call->fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method)); } @@ -2311,7 +2311,7 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A if (CACHED_PTR(opline->op1.literal->cache_slot)) { EX(function_state).function = CACHED_PTR(opline->op1.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRLEN_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRSIZE_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", fname->value.str.val); } else { @@ -2654,7 +2654,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA inc_filename = tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -2667,7 +2667,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); } else { @@ -2899,7 +2899,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { char *str_key; - uint str_key_len; + zend_str_size_uint str_key_len; ulong int_key; zend_uchar key_type; @@ -3361,7 +3361,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -3375,7 +3375,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -3390,10 +3390,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -3407,7 +3407,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -3560,7 +3560,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -3590,12 +3590,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( /* do nothing */ } else if (IS_CONST != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size_int function_name_strlen = 0; if (IS_CONST == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = opline->op2.zv; @@ -3606,7 +3606,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -3696,7 +3696,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO c = CACHED_PTR(opline->op2.literal->cache_slot); } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) { if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); + char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv)); if(!actual) { actual = Z_STRVAL_P(opline->op2.zv); } else { @@ -3704,7 +3704,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO } /* non-qualified constant - allow text substitution */ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); + ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -3733,7 +3733,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO } else if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -3752,7 +3752,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO } } - if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { + if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { zend_class_entry *old_scope = EG(scope); @@ -3768,7 +3768,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO } ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value); zval_copy_ctor(&EX_T(opline->result.var).tmp_var); - } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { + } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */ ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1); } else { @@ -3836,14 +3836,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_O if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -3921,7 +3921,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { if (IS_CONST != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -3939,7 +3939,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -3997,7 +3997,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -4007,7 +4007,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -4070,8 +4070,8 @@ static int ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCOD zval_copy_ctor(&c.value); } c.flags = CONST_CS; /* non persistent, case sensetive */ - c.name = IS_INTERNED(Z_STRVAL_P(name)) ? Z_STRVAL_P(name) : zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); - c.name_len = Z_STRLEN_P(name)+1; + c.name = IS_INTERNED(Z_STRVAL_P(name)) ? Z_STRVAL_P(name) : zend_strndup(Z_STRVAL_P(name), Z_STRSIZE_P(name)); + c.name_len = Z_STRSIZE_P(name)+1; c.module_number = PHP_USER_CONSTANT; if (zend_register_constant(&c TSRMLS_CC) == FAILURE) { @@ -4553,7 +4553,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -4583,12 +4583,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE /* do nothing */ } else if (IS_TMP_VAR != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size_int function_name_strlen = 0; zend_free_op free_op2; if (IS_TMP_VAR == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); @@ -4599,7 +4599,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -4733,14 +4733,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPC if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -5236,7 +5236,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -5250,7 +5250,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -5265,10 +5265,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -5282,7 +5282,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -5411,7 +5411,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -5441,12 +5441,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE /* do nothing */ } else if (IS_VAR != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size_int function_name_strlen = 0; zend_free_op free_op2; if (IS_VAR == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); @@ -5457,7 +5457,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -5591,14 +5591,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPC if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -5676,7 +5676,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { if (IS_CONST != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -5694,7 +5694,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -5752,7 +5752,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -5762,7 +5762,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -5982,7 +5982,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -5996,7 +5996,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -6011,10 +6011,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -6028,7 +6028,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -6131,7 +6131,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -6161,12 +6161,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER /* do nothing */ } else if (IS_UNUSED != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size_int function_name_strlen = 0; if (IS_UNUSED == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = NULL; @@ -6177,7 +6177,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -6296,14 +6296,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_ if (IS_UNUSED == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -6381,7 +6381,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { if (IS_CONST != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -6399,7 +6399,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -6457,7 +6457,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_ if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -6467,7 +6467,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_ } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -6509,7 +6509,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER SAVE_OPLINE(); - if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) || + if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) || UNEXPECTED(op_array->type != ZEND_USER_FUNCTION)) { zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); } @@ -6991,7 +6991,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -7021,12 +7021,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN /* do nothing */ } else if (IS_CV != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size_int function_name_strlen = 0; if (IS_CV == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC); @@ -7037,7 +7037,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -7116,7 +7116,7 @@ static int ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A if (CACHED_PTR(opline->op1.literal->cache_slot)) { catch_ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC); + catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC); CACHE_PTR(opline->op1.literal->cache_slot, catch_ce); } @@ -7230,14 +7230,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCO if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -7980,7 +7980,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND inc_filename = tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -7993,7 +7993,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); } else { @@ -8225,7 +8225,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { char *str_key; - uint str_key_len; + zend_str_size_uint str_key_len; ulong int_key; zend_uchar key_type; @@ -8295,7 +8295,7 @@ static int ZEND_FASTCALL ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ efree(EG(error_reporting_ini_entry)->value); } EG(error_reporting_ini_entry)->value = Z_STRVAL(restored_error_reporting); - EG(error_reporting_ini_entry)->value_length = Z_STRLEN(restored_error_reporting); + EG(error_reporting_ini_entry)->value_length = Z_STRSIZE(restored_error_reporting); } else { zendi_zval_dtor(restored_error_reporting); } @@ -8739,7 +8739,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -8753,7 +8753,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_dtor(free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -8768,10 +8768,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -8785,7 +8785,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -8934,7 +8934,7 @@ static int ZEND_FASTCALL ZEND_ADD_CHAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDL if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_char_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -8957,7 +8957,7 @@ static int ZEND_FASTCALL ZEND_ADD_STRING_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAN if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -8975,7 +8975,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; zend_free_op free_op1; call_slot *call = EX(call_slots) + opline->result.num; @@ -8992,7 +8992,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -9119,14 +9119,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPC if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -9204,7 +9204,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -9222,7 +9222,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -9280,7 +9280,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -9290,7 +9290,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -9797,7 +9797,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -9832,7 +9832,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; zend_free_op free_op1, free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -9849,7 +9849,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -9978,14 +9978,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCOD if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -10481,7 +10481,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -10495,7 +10495,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_dtor(free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -10510,10 +10510,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -10527,7 +10527,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -10657,7 +10657,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -10692,7 +10692,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; zend_free_op free_op1, free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -10709,7 +10709,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -10838,14 +10838,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -10923,7 +10923,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -10941,7 +10941,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -10999,7 +10999,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -11009,7 +11009,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -11229,7 +11229,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -11243,7 +11243,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_dtor(free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -11258,10 +11258,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -11275,7 +11275,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -11420,14 +11420,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OP if (IS_UNUSED == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -11505,7 +11505,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -11523,7 +11523,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -11581,7 +11581,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -11591,7 +11591,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -12098,7 +12098,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_A if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -12132,7 +12132,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_ USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; zend_free_op free_op1; call_slot *call = EX(call_slots) + opline->result.num; @@ -12149,7 +12149,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_ } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -12276,14 +12276,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -13316,7 +13316,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND inc_filename = tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -13329,7 +13329,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); } else { @@ -13561,7 +13561,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { char *str_key; - uint str_key_len; + zend_str_size_uint str_key_len; ulong int_key; zend_uchar key_type; @@ -13618,7 +13618,7 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_object *zobj = zend_objects_get_address(array TSRMLS_CC); int key_type; char *str_key; - zend_uint str_key_len; + zend_str_size_uint str_key_len; zend_ulong int_key; fe_ht = Z_OBJPROP_P(array); @@ -13639,7 +13639,7 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG ZVAL_LONG(key, int_key); } else { const char *class_name, *prop_name; - int prop_name_len; + zend_str_size_int prop_name_len; zend_unmangle_property_name_ex( str_key, str_key_len - 1, &class_name, &prop_name, &prop_name_len ); @@ -14640,7 +14640,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -14654,7 +14654,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_ptr_dtor(&free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -14669,10 +14669,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -14686,7 +14686,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -15365,7 +15365,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; zend_free_op free_op1; call_slot *call = EX(call_slots) + opline->result.num; @@ -15382,7 +15382,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -15454,7 +15454,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -15484,12 +15484,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE /* do nothing */ } else if (IS_CONST != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size_int function_name_strlen = 0; if (IS_CONST == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = opline->op2.zv; @@ -15500,7 +15500,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -15590,7 +15590,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE c = CACHED_PTR(opline->op2.literal->cache_slot); } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) { if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); + char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv)); if(!actual) { actual = Z_STRVAL_P(opline->op2.zv); } else { @@ -15598,7 +15598,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE } /* non-qualified constant - allow text substitution */ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); + ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -15627,7 +15627,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE } else if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -15646,7 +15646,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE } } - if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { + if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { zend_class_entry *old_scope = EG(scope); @@ -15662,7 +15662,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE } ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value); zval_copy_ctor(&EX_T(opline->result.var).tmp_var); - } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { + } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */ ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1); } else { @@ -15730,14 +15730,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPC if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -15815,7 +15815,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { if (IS_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -15833,7 +15833,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -15889,17 +15889,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_CONST == IS_CV || IS_CONST == IS_VAR) { zval_ptr_dtor(&offset); @@ -16032,7 +16032,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16042,7 +16042,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -16116,15 +16116,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -16182,7 +16182,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -16194,11 +16194,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -17717,7 +17717,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; zend_free_op free_op1, free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -17734,7 +17734,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -17807,7 +17807,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -17837,12 +17837,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND /* do nothing */ } else if (IS_TMP_VAR != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size_int function_name_strlen = 0; zend_free_op free_op2; if (IS_TMP_VAR == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); @@ -17853,7 +17853,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -17987,14 +17987,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCOD if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -18068,17 +18068,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -18210,15 +18210,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -18276,7 +18276,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -18288,11 +18288,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -19249,7 +19249,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -19263,7 +19263,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_ptr_dtor(&free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -19278,10 +19278,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -19295,7 +19295,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -20030,7 +20030,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; zend_free_op free_op1, free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -20047,7 +20047,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -20120,7 +20120,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -20150,12 +20150,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND /* do nothing */ } else if (IS_VAR != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size_int function_name_strlen = 0; zend_free_op free_op2; if (IS_VAR == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); @@ -20166,7 +20166,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -20300,14 +20300,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -20385,7 +20385,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { if (IS_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -20403,7 +20403,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -20459,17 +20459,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -20602,7 +20602,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -20612,7 +20612,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -20686,15 +20686,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -20752,7 +20752,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -20764,11 +20764,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -21243,7 +21243,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -21257,7 +21257,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_ptr_dtor(&free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -21272,10 +21272,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -21289,7 +21289,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -21560,7 +21560,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -21590,12 +21590,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z /* do nothing */ } else if (IS_UNUSED != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size_int function_name_strlen = 0; if (IS_UNUSED == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = NULL; @@ -21606,7 +21606,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -21725,14 +21725,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OP if (IS_UNUSED == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -21810,7 +21810,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { if (IS_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -21828,7 +21828,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -21886,7 +21886,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -21896,7 +21896,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -23489,7 +23489,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_ USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; zend_free_op free_op1; call_slot *call = EX(call_slots) + opline->result.num; @@ -23506,7 +23506,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_ } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -23578,7 +23578,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -23608,12 +23608,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ /* do nothing */ } else if (IS_CV != IS_UNUSED) { char *function_name_strval = NULL; - int function_name_strlen = 0; + zend_str_size_int function_name_strlen = 0; if (IS_CV == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRLEN_P(opline->op2.zv); + function_name_strlen = Z_STRSIZE_P(opline->op2.zv); } else { function_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC); @@ -23624,7 +23624,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); } } @@ -23757,14 +23757,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -23838,17 +23838,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_CV == IS_CV || IS_CV == IS_VAR) { zval_ptr_dtor(&offset); @@ -23980,15 +23980,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -24046,7 +24046,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -24058,11 +24058,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -25086,7 +25086,7 @@ static int ZEND_FASTCALL ZEND_ADD_CHAR_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HA if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_char_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -25109,7 +25109,7 @@ static int ZEND_FASTCALL ZEND_ADD_STRING_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_ if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -25127,7 +25127,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; call_slot *call = EX(call_slots) + opline->result.num; @@ -25144,7 +25144,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_obj_zval_ptr_unused(TSRMLS_C); @@ -25214,7 +25214,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC c = CACHED_PTR(opline->op2.literal->cache_slot); } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) { if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); + char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv)); if(!actual) { actual = Z_STRVAL_P(opline->op2.zv); } else { @@ -25222,7 +25222,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC } /* non-qualified constant - allow text substitution */ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); + ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -25251,7 +25251,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC } else if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -25270,7 +25270,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC } } - if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { + if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { zend_class_entry *old_scope = EG(scope); @@ -25286,7 +25286,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC } ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value); zval_copy_ctor(&EX_T(opline->result.var).tmp_var); - } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { + } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */ ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1); } else { @@ -25350,17 +25350,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_H if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_CONST == IS_CV || IS_CONST == IS_VAR) { zval_ptr_dtor(&offset); @@ -25490,15 +25490,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -25556,7 +25556,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -25568,11 +25568,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -26511,7 +26511,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDL if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -26546,7 +26546,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; zend_free_op free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -26563,7 +26563,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_obj_zval_ptr_unused(TSRMLS_C); @@ -26673,17 +26673,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -26813,15 +26813,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -26879,7 +26879,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -26891,11 +26891,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -27834,7 +27834,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDL if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -27869,7 +27869,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; zend_free_op free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -27886,7 +27886,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_obj_zval_ptr_unused(TSRMLS_C); @@ -27996,17 +27996,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -28136,15 +28136,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -28202,7 +28202,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -28214,11 +28214,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -29581,7 +29581,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLE if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRLEN_P(str) = 0; + Z_STRSIZE_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -29615,7 +29615,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; call_slot *call = EX(call_slots) + opline->result.num; @@ -29632,7 +29632,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_obj_zval_ptr_unused(TSRMLS_C); @@ -29741,17 +29741,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAND if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_CV == IS_CV || IS_CV == IS_VAR) { zval_ptr_dtor(&offset); @@ -29881,15 +29881,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV( hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -29947,7 +29947,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV( if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -29959,11 +29959,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV( } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -30959,7 +30959,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL inc_filename = tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -30972,7 +30972,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); } else { @@ -31204,7 +31204,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { char *str_key; - uint str_key_len; + zend_str_size_uint str_key_len; ulong int_key; zend_uchar key_type; @@ -32148,7 +32148,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -32162,7 +32162,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -32177,10 +32177,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -32194,7 +32194,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -32866,7 +32866,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; call_slot *call = EX(call_slots) + opline->result.num; @@ -32883,7 +32883,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); @@ -33010,14 +33010,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCO if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -33095,7 +33095,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { if (IS_CV != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -33113,7 +33113,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -33169,17 +33169,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_CONST == IS_CV || IS_CONST == IS_VAR) { zval_ptr_dtor(&offset); @@ -33310,7 +33310,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -33320,7 +33320,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -33394,15 +33394,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -33460,7 +33460,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -33472,11 +33472,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -34984,7 +34984,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_ USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; zend_free_op free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -35001,7 +35001,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_ } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); @@ -35130,14 +35130,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -35211,17 +35211,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -35351,15 +35351,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -35417,7 +35417,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -35429,11 +35429,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -36386,7 +36386,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -36400,7 +36400,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -36415,10 +36415,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -36432,7 +36432,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -37159,7 +37159,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_ USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; zend_free_op free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -37176,7 +37176,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_ } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); @@ -37305,14 +37305,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -37390,7 +37390,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { if (IS_CV != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -37408,7 +37408,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -37464,17 +37464,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -37605,7 +37605,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -37615,7 +37615,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -37689,15 +37689,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -37755,7 +37755,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -37767,11 +37767,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -38242,7 +38242,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -38256,7 +38256,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -38271,10 +38271,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -38288,7 +38288,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -38600,14 +38600,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPC if (IS_UNUSED == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -38685,7 +38685,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { if (IS_CV != IS_CONST && varname == &tmp) { zval_dtor(&tmp); @@ -38703,7 +38703,7 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -38761,7 +38761,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -38771,7 +38771,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -40333,7 +40333,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H USE_OPLINE zval *function_name; char *function_name_strval; - int function_name_strlen; + zend_str_size_int function_name_strlen; call_slot *call = EX(call_slots) + opline->result.num; @@ -40350,7 +40350,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRLEN_P(function_name); + function_name_strlen = Z_STRSIZE_P(function_name); call->object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); @@ -40477,14 +40477,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_ if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -40558,17 +40558,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); } if (IS_CV == IS_CV || IS_CV == IS_VAR) { zval_ptr_dtor(&offset); @@ -40698,15 +40698,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -40764,7 +40764,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { + && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRSIZE_P(offset), NULL, NULL, 0))) { ZVAL_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -40776,11 +40776,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } From cd955c183b83b69d7fe3197a5a1c60ea51a8b529 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 29 Jul 2013 02:16:39 -0700 Subject: [PATCH 26/31] fixes to main/ --- main/SAPI.h | 2 +- main/main.c | 18 ++++++++++-------- main/rfc1867.c | 46 ++++++++++++++++++++++++---------------------- main/snprintf.c | 13 +++++++------ main/snprintf.h | 6 +++--- 5 files changed, 45 insertions(+), 40 deletions(-) diff --git a/main/SAPI.h b/main/SAPI.h index e0a3adcbcda6c..8a71b8b8241d7 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -119,7 +119,7 @@ typedef struct _sapi_globals_struct { void *server_context; sapi_request_info request_info; sapi_headers_struct sapi_headers; - int read_post_bytes; + zend_str_size_int read_post_bytes; unsigned char headers_sent; struct stat global_stat; char *default_mimetype; diff --git a/main/main.c b/main/main.c index bef128faf72bf..70d77a2c1dd6d 100644 --- a/main/main.c +++ b/main/main.c @@ -366,7 +366,8 @@ static PHP_INI_MH(OnUpdateDisplayErrors) */ static PHP_INI_DISP(display_errors_mode) { - int mode, tmp_value_length, cgi_or_cli; + int mode, cgi_or_cli; + zend_str_size_int tmp_value_length; char *tmp_value; TSRMLS_FETCH(); @@ -624,7 +625,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) fd = VCWD_OPEN_MODE(PG(error_log), O_CREAT | O_APPEND | O_WRONLY, 0644); if (fd != -1) { char *tmp; - int len; + zend_str_size_int len; char *error_time_str; time(&error_time); @@ -641,7 +642,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) #ifdef PHP_WIN32 php_flock(fd, 2); #endif - php_ignore_value(write(fd, tmp, len)); + php_ignore_value(write(fd, tmp, len)); /* XXX rework on windows, write expects int*/ efree(tmp); efree(error_time_str); close(fd); @@ -698,11 +699,11 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c char *buffer = NULL, *docref_buf = NULL, *target = NULL; char *docref_target = "", *docref_root = ""; char *p; - int buffer_len = 0; + zend_str_size_int buffer_len = 0; const char *space = ""; const char *class_name = ""; const char *function; - int origin_len; + zend_str_size_int origin_len; char *origin; char *message; int is_function = 0; @@ -783,7 +784,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c /* no docref given but function is known (the default) */ if (!docref && is_function) { - int doclen; + zend_str_size_int doclen; while (*function == '_') { function++; } @@ -915,7 +916,7 @@ PHPAPI void php_win32_docref2_from_error(DWORD error, const char *param1, const php_error_docref2(NULL TSRMLS_CC, param1, param2, E_WARNING, "%s", strerror(errno)); } else { char buf[PHP_WIN32_ERROR_MSG_BUFFER_SIZE + 1]; - int buf_len; + zend_str_size_int buf_len; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, 0, buf, PHP_WIN32_ERROR_MSG_BUFFER_SIZE, NULL); buf_len = strlen(buf); @@ -941,7 +942,8 @@ PHPAPI void php_html_puts(const char *str, uint size TSRMLS_DC) static void php_error_cb(int type, const char *error_filename, const zend_str_size_uint error_lineno, const char *format, va_list args) { char *buffer; - int buffer_len, display; + zend_str_size_int buffer_len; + int display; TSRMLS_FETCH(); buffer_len = vspprintf(&buffer, PG(log_errors_max_len), format, args); diff --git a/main/rfc1867.c b/main/rfc1867.c index ed7ce9c0c172b..0f0efe054ce9b 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -53,7 +53,7 @@ static php_rfc1867_basename_t php_rfc1867_basename = NULL; PHPAPI int (*php_rfc1867_callback)(unsigned int event, void *event_data, void **extra TSRMLS_DC) = NULL; -static void safe_php_register_variable(char *var, char *strval, int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC); +static void safe_php_register_variable(char *var, char *strval, zend_str_size_int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC); /* The longest property name we use in an uploaded file array */ #define MAX_SIZE_OF_INDEX sizeof("[tmp_name]") @@ -158,7 +158,7 @@ static zend_bool is_protected_variable(char *varname TSRMLS_DC) /* {{{ */ } /* }}} */ -static void safe_php_register_variable(char *var, char *strval, int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC) /* {{{ */ +static void safe_php_register_variable(char *var, char *strval, zend_str_size_int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC) /* {{{ */ { if (override_protection || !is_protected_variable(var TSRMLS_CC)) { php_register_variable_safe(var, strval, val_len, track_vars_array TSRMLS_CC); @@ -210,13 +210,13 @@ typedef struct { /* read buffer */ char *buffer; char *buf_begin; - int bufsize; - int bytes_in_buffer; + zend_str_size_int bufsize; + zend_str_size_int bytes_in_buffer; /* boundary info */ char *boundary; char *boundary_next; - int boundary_next_len; + zend_str_size_int boundary_next_len; const zend_encoding *input_encoding; const zend_encoding **detect_order; @@ -232,9 +232,9 @@ typedef struct { * Fill up the buffer with client data. * Returns number of bytes added to buffer. */ -static int fill_buffer(multipart_buffer *self TSRMLS_DC) +static zend_str_size_int fill_buffer(multipart_buffer *self TSRMLS_DC) { - int bytes_to_read, total_read = 0, actual_read = 0; + zend_str_size_int bytes_to_read, total_read = 0, actual_read = 0; /* shift the existing data if necessary */ if (self->bytes_in_buffer > 0 && self->buf_begin != self->buffer) { @@ -278,11 +278,11 @@ static int multipart_buffer_eof(multipart_buffer *self TSRMLS_DC) } /* create new multipart_buffer structure */ -static multipart_buffer *multipart_buffer_new(char *boundary, int boundary_len TSRMLS_DC) +static multipart_buffer *multipart_buffer_new(char *boundary, zend_str_size_int boundary_len TSRMLS_DC) { multipart_buffer *self = (multipart_buffer *) ecalloc(1, sizeof(multipart_buffer)); - int minsize = boundary_len + 6; + zend_str_size_int minsize = boundary_len + 6; if (minsize < FILLUNIT) minsize = FILLUNIT; self->buffer = (char *) ecalloc(1, minsize + 1); @@ -399,7 +399,7 @@ static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header T { char *line; mime_header_entry prev_entry, entry; - int prev_len, cur_len; + zend_str_size_int prev_len, cur_len; /* didn't find boundary, abort */ if (!find_boundary(self, self->boundary TSRMLS_CC)) { @@ -509,11 +509,11 @@ static char *php_ap_getword(const zend_encoding *encoding, char **line, char sto return res; } -static char *substring_conf(char *start, int len, char quote) +static char *substring_conf(char *start, zend_str_size_int len, char quote) { char *result = emalloc(len + 1); char *resp = result; - int i; + zend_str_size_int i; for (i = 0; i < len && start[i] != quote; ++i) { if (start[i] == '\\' && (start[i + 1] == '\\' || (quote && start[i + 1] == quote))) { @@ -577,9 +577,9 @@ static char *php_ap_basename(const zend_encoding *encoding, char *path TSRMLS_DC * If partial is true, partial matches are allowed at the end of the buffer. * Returns NULL if not found, or a pointer to the start of the first match. */ -static void *php_ap_memstr(char *haystack, int haystacklen, char *needle, int needlen, int partial) +static void *php_ap_memstr(char *haystack, zend_str_size_int haystacklen, char *needle, zend_str_size_int needlen, int partial) { - int len = haystacklen; + zend_str_size_int len = haystacklen; char *ptr = haystack; /* iterate through first character matches */ @@ -601,9 +601,9 @@ static void *php_ap_memstr(char *haystack, int haystacklen, char *needle, int ne } /* read until a boundary condition */ -static int multipart_buffer_read(multipart_buffer *self, char *buf, int bytes, int *end TSRMLS_DC) +static zend_str_size_int multipart_buffer_read(multipart_buffer *self, char *buf, zend_str_size_int bytes, int *end TSRMLS_DC) { - int len, max; + zend_str_size_int len, max; char *bound; /* fill buffer if needed */ @@ -647,10 +647,10 @@ static int multipart_buffer_read(multipart_buffer *self, char *buf, int bytes, i XXX: this is horrible memory-usage-wise, but we only expect to do this on small pieces of form data. */ -static char *multipart_buffer_read_body(multipart_buffer *self, unsigned int *len TSRMLS_DC) +static char *multipart_buffer_read_body(multipart_buffer *self, zend_str_size_uint *len TSRMLS_DC) { char buf[FILLUNIT], *out=NULL; - int total_bytes=0, read_bytes=0; + zend_str_size_int total_bytes=0, read_bytes=0; while((read_bytes = multipart_buffer_read(self, buf, sizeof(buf), NULL TSRMLS_CC))) { out = erealloc(out, total_bytes + read_bytes + 1); @@ -676,7 +676,9 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ { char *boundary, *s = NULL, *boundary_end = NULL, *start_arr = NULL, *array_index = NULL; char *temp_filename = NULL, *lbuf = NULL, *abuf = NULL; - int boundary_len = 0, total_bytes = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0; + zend_str_size_int boundary_len = 0; + zend_str_size_int total_bytes = 0; + int cancel_upload = 0, is_arr_upload = 0, array_len = 0; int max_file_size = 0, skip_upload = 0, anonindex = 0, is_anonymous; zval *http_post_files = NULL; HashTable *uploaded_files = NULL; @@ -711,7 +713,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ /* Get the boundary */ boundary = strstr(content_type_dup, "boundary"); if (!boundary) { - int content_type_len = strlen(content_type_dup); + zend_str_size_int content_type_len = strlen(content_type_dup); char *content_type_lcase = estrndup(content_type_dup, content_type_len); php_strtolower(content_type_lcase, content_type_len); @@ -843,9 +845,9 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ /* Normal form variable, safe to read all data into memory */ if (!filename && param) { - unsigned int value_len; + zend_str_size_uint value_len; char *value = multipart_buffer_read_body(mbuff, &value_len TSRMLS_CC); - unsigned int new_val_len; /* Dummy variable */ + zend_str_size_uint new_val_len; /* Dummy variable */ if (!value) { value = estrdup(""); diff --git a/main/snprintf.c b/main/snprintf.c index 23f4935cfb289..26f66ca52d18e 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -312,7 +312,7 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c */ /* char * ap_php_conv_10() {{{ */ char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, - register bool_int * is_negative, char *buf_end, register int *len) + register bool_int * is_negative, char *buf_end, register zend_str_size_int *len) { register char *p = buf_end; register u_wide_int magnitude; @@ -370,7 +370,7 @@ char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, */ /* PHPAPI char * php_conv_fp() {{{ */ PHPAPI char * php_conv_fp(register char format, register double num, - boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, int *len) + boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, zend_str_size_int *len) { register char *s = buf; register char *p, *p_orig; @@ -438,7 +438,7 @@ PHPAPI char * php_conv_fp(register char format, register double num, if (format != 'F') { char temp[EXPONENT_LENGTH]; /* for exponent conversion */ - int t_len; + zend_str_size_int t_len; bool_int exponent_is_negative; *s++ = format; /* either e or E */ @@ -474,7 +474,7 @@ PHPAPI char * php_conv_fp(register char format, register double num, * which is a pointer to the END of the buffer + 1 (i.e. if the buffer * is declared as buf[ 100 ], buf_end should be &buf[ 100 ]) */ -char * ap_php_conv_p2(register u_wide_int num, register int nbits, char format, char *buf_end, register int *len) /* {{{ */ +char * ap_php_conv_p2(register u_wide_int num, register int nbits, char format, char *buf_end, register zend_str_size_int *len) /* {{{ */ { register int mask = (1 << nbits) - 1; register char *p = buf_end; @@ -584,10 +584,11 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / char *sp; char *bep; int cc = 0; - int i; + zend_str_size_int i; char *s = NULL; - int s_len, free_zcopy; + zend_str_size_int s_len; + int free_zcopy; zval *zvp, zcopy; int min_width = 0; diff --git a/main/snprintf.h b/main/snprintf.h index f4ed4d234de14..88dbdf8a9d6c7 100644 --- a/main/snprintf.h +++ b/main/snprintf.h @@ -87,7 +87,7 @@ PHPAPI int ap_php_asprintf(char **buf, const char *format, ...); PHPAPI int php_sprintf (char* s, const char* format, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3); PHPAPI char * php_gcvt(double value, int ndigit, char dec_point, char exponent, char *buf); PHPAPI char * php_conv_fp(register char format, register double num, - boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, int *len); + boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, zend_str_size_int *len); END_EXTERN_C() @@ -153,10 +153,10 @@ typedef WIDE_INT wide_int; typedef unsigned WIDE_INT u_wide_int; extern char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, - register bool_int * is_negative, char *buf_end, register int *len); + register bool_int * is_negative, char *buf_end, register zend_str_size_int *len); extern char * ap_php_conv_p2(register u_wide_int num, register int nbits, - char format, char *buf_end, register int *len); + char format, char *buf_end, register zend_str_size_int *len); /* The maximum precision that's allowed for float conversion. Does not include * decimal separator, exponent, sign, terminator. Currently does not affect From 62c1f4127b72c8337a177c0df39580a58d63e4d3 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 29 Jul 2013 02:39:44 -0700 Subject: [PATCH 27/31] more for cli sapi --- main/SAPI.h | 2 +- sapi/cli/php_cli.c | 2 +- sapi/cli/php_cli_server.c | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/main/SAPI.h b/main/SAPI.h index 8a71b8b8241d7..75da9947f6353 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -224,7 +224,7 @@ struct _sapi_module_struct { int (*activate)(TSRMLS_D); int (*deactivate)(TSRMLS_D); - int (*ub_write)(const char *str, unsigned int str_length TSRMLS_DC); + zend_str_size_int (*ub_write)(const char *str, zend_str_size_uint str_length TSRMLS_DC); void (*flush)(void *server_context); struct stat *(*get_stat)(TSRMLS_D); char *(*getenv)(char *name, size_t name_len TSRMLS_DC); diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 164986f633f38..c343f5496e103 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -1143,7 +1143,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ } case PHP_MODE_REFLECTION_EXT_INFO: { - int len = strlen(reflection_what); + zend_str_size_int len = strlen(reflection_what); char *lcname = zend_str_tolower_dup(reflection_what, len); zend_module_entry *module; diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index a1bae67e745c9..630acc3041e28 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -492,7 +492,7 @@ static int sapi_cli_server_startup(sapi_module_struct *sapi_module) /* {{{ */ return SUCCESS; } /* }}} */ -static int sapi_cli_server_ub_write(const char *str, uint str_length TSRMLS_DC) /* {{{ */ +static zend_str_size_int sapi_cli_server_ub_write(const char *str, zend_str_size_uint str_length TSRMLS_DC) /* {{{ */ { php_cli_server_client *client = SG(server_context); if (!client) { @@ -574,7 +574,7 @@ static char *sapi_cli_server_read_cookies(TSRMLS_D) /* {{{ */ return *val; } /* }}} */ -static int sapi_cli_server_read_post(char *buf, uint count_bytes TSRMLS_DC) /* {{{ */ +static zend_str_size_int sapi_cli_server_read_post(char *buf, uint count_bytes TSRMLS_DC) /* {{{ */ { php_cli_server_client *client = SG(server_context); if (client->request.content) { @@ -590,7 +590,7 @@ static int sapi_cli_server_read_post(char *buf, uint count_bytes TSRMLS_DC) /* { static void sapi_cli_server_register_variable(zval *track_vars_array, const char *key, const char *val TSRMLS_DC) /* {{{ */ { char *new_val = (char *)val; - uint new_val_len; + zend_str_size_uint new_val_len; if (sapi_module.input_filter(PARSE_SERVER, (char*)key, &new_val, strlen(val), &new_val_len TSRMLS_CC)) { php_register_variable_safe((char *)key, new_val, new_val_len, track_vars_array TSRMLS_CC); } @@ -987,7 +987,7 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender *sen switch (chunk->type) { case PHP_CLI_SERVER_CHUNK_HEAP: - nbytes_sent = send(fd, chunk->data.heap.p, chunk->data.heap.len, 0); + nbytes_sent = send(fd, chunk->data.heap.p, chunk->data.heap.len, 0); /* XXX on windows len is int */ if (nbytes_sent < 0) { *nbytes_sent_total = _nbytes_sent_total; return php_socket_errno(); @@ -1746,7 +1746,7 @@ static int php_cli_server_client_ctor(php_cli_server_client *client, php_cli_ser client->addr_len = addr_len; { char *addr_str = 0; - long addr_str_len = 0; + zend_str_size_long addr_str_len = 0; php_network_populate_name_from_sockaddr(addr, addr_len, &addr_str, &addr_str_len, NULL, 0 TSRMLS_CC); client->addr_str = pestrndup(addr_str, addr_str_len, 1); client->addr_str_len = addr_str_len; From 88960bba1e25a411280667b2bccf6e6e3a6638c9 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 29 Jul 2013 04:50:47 -0700 Subject: [PATCH 28/31] more fixes to string.c --- ext/standard/string.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/standard/string.c b/ext/standard/string.c index 5d22db1115e41..af39a37554b9d 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2290,7 +2290,7 @@ PHP_FUNCTION(substr_replace) zval **repl; char *result; zend_str_size result_len; - int l = 0; + int l = 0; /* l and f should be size_t, however this needs much closer below logic investigation.*/ int f; int argc = ZEND_NUM_ARGS(); @@ -3226,7 +3226,7 @@ PHP_FUNCTION(similar_text) char *t1, *t2; zval **percent = NULL; int ac = ZEND_NUM_ARGS(); - int sim; + zend_str_size_int sim; zend_str_size t1_len, t2_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|Z", &t1, &t1_len, &t2, &t2_len, &percent) == FAILURE) { @@ -4145,7 +4145,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) } } if (char_count == max_chars) { /* try to avoid breaking words */ - int new_char_count=char_count, new_begin=begin; + zend_str_size_int new_char_count=char_count, new_begin=begin; while (new_char_count > 0) { if (_isblank(heb_str[new_begin]) || _isnewline(heb_str[new_begin])) { From a95f8dbac2dfe7a2941dd9cac7b5308357bd5cef Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 29 Jul 2013 09:04:56 -0700 Subject: [PATCH 29/31] fixes for types to ext/standard with types ... some stuff is broken now --- Zend/zend_highlight.c | 2 +- Zend/zend_highlight.h | 2 +- ext/standard/dir.c | 2 +- ext/standard/dl.c | 2 +- ext/standard/file.c | 9 ++- ext/standard/file.h | 2 +- ext/standard/formatted_print.c | 66 ++++++++-------- ext/standard/ftp_fopen_wrapper.c | 7 +- ext/standard/head.c | 6 +- ext/standard/head.h | 2 +- ext/standard/http.c | 9 ++- ext/standard/http_fopen_wrapper.c | 10 +-- ext/standard/info.c | 12 +-- ext/standard/mail.c | 2 +- ext/standard/math.c | 14 ++-- ext/standard/md5.c | 2 +- ext/standard/pack.c | 25 ++++--- ext/standard/password.c | 4 +- ext/standard/php_http.h | 6 +- ext/standard/url_scanner_ex.c | 120 +++++++++++++++--------------- ext/standard/url_scanner_ex.h | 2 +- ext/standard/url_scanner_ex.re | 8 +- ext/standard/versioning.c | 6 +- main/SAPI.h | 2 +- main/spprintf.c | 5 +- 25 files changed, 165 insertions(+), 162 deletions(-) diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c index c789cb719a01b..aab7804094f4e 100644 --- a/Zend/zend_highlight.c +++ b/Zend/zend_highlight.c @@ -54,7 +54,7 @@ ZEND_API void zend_html_putc(char c) } -ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC) +ZEND_API void zend_html_puts(const char *s, zend_str_size_uint len TSRMLS_DC) { const unsigned char *ptr = (const unsigned char*)s, *end = ptr + len; unsigned char *filtered; diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h index 20adf349ae200..087ad33fb70f8 100644 --- a/Zend/zend_highlight.h +++ b/Zend/zend_highlight.h @@ -44,7 +44,7 @@ ZEND_API void zend_strip(TSRMLS_D); ZEND_API int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC); ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name TSRMLS_DC); ZEND_API void zend_html_putc(char c); -ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC); +ZEND_API void zend_html_puts(const char *s, zend_str_size_uint len TSRMLS_DC); END_EXTERN_C() extern zend_syntax_highlighter_ini syntax_highlighter_ini; diff --git a/ext/standard/dir.c b/ext/standard/dir.c index a0cb511d58dbb..de45adc3de3bb 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -424,7 +424,7 @@ PHP_NAMED_FUNCTION(php_if_readdir) Find pathnames matching a pattern */ PHP_FUNCTION(glob) { - int cwd_skip = 0; + zend_str_size_int cwd_skip = 0; #ifdef ZTS char cwd[MAXPATHLEN]; char work_pattern[MAXPATHLEN]; diff --git a/ext/standard/dl.c b/ext/standard/dl.c index ceb975e93bd79..0df54ebb2717b 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -129,7 +129,7 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now TSRMLS_DC) } libpath = estrdup(filename); } else if (extension_dir && extension_dir[0]) { - int extension_dir_len = strlen(extension_dir); + zend_str_size_int extension_dir_len = strlen(extension_dir); if (IS_SLASH(extension_dir[extension_dir_len-1])) { spprintf(&libpath, 0, "%s%s", extension_dir, filename); /* SAFE */ diff --git a/ext/standard/file.c b/ext/standard/file.c index 482f364f0b064..8f667429c02ab 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1169,7 +1169,7 @@ PHPAPI PHP_FUNCTION(fwrite) zval *arg1; char *arg2; zend_str_size arg2len; - int ret; + zend_str_size_int ret; zend_str_size num_bytes; long arg3 = 0; char *buffer = NULL; @@ -1810,7 +1810,7 @@ PHP_FUNCTION(fputcsv) const char escape_char = '\\'; php_stream *stream; zval *fp = NULL, *fields = NULL; - int ret; + zend_str_size_int ret; char *delimiter_str = NULL, *enclosure_str = NULL; zend_str_size delimiter_str_len = 0, enclosure_str_len = 0; @@ -1852,9 +1852,10 @@ PHP_FUNCTION(fputcsv) /* }}} */ /* {{{ PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) */ -PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) +PHPAPI zend_str_size_int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) { - int count, i = 0, ret; + int count, i = 0; + zend_str_size_int ret; zval **field_tmp = NULL, field; smart_str csvline = {0}; HashPosition pos; diff --git a/ext/standard/file.h b/ext/standard/file.h index 2bcdfd64bf5e6..bbdce6d25dc1f 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -80,7 +80,7 @@ PHPAPI int php_copy_file_ctx(char *src, char *dest, int src_chk, php_stream_cont PHPAPI int php_mkdir_ex(char *dir, long mode, int options TSRMLS_DC); PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC); PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, size_t buf_len, char *buf, zval *return_value TSRMLS_DC); -PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC); +PHPAPI zend_str_size_int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC); #define META_DEF_BUFSIZE 8192 diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index cf3e9d77cc6cb..5ed82ed7bca73 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -52,7 +52,7 @@ static char HEXCHARS[] = "0123456789ABCDEF"; /* php_spintf_appendchar() {{{ */ inline static void -php_sprintf_appendchar(char **buffer, int *pos, int *size, char add TSRMLS_DC) +php_sprintf_appendchar(char **buffer, zend_str_size_int *pos, zend_str_size_int *size, char add TSRMLS_DC) { if ((*pos + 1) >= *size) { *size <<= 1; @@ -66,22 +66,18 @@ php_sprintf_appendchar(char **buffer, int *pos, int *size, char add TSRMLS_DC) /* php_spintf_appendstring() {{{ */ inline static void -php_sprintf_appendstring(char **buffer, int *pos, int *size, char *add, - int min_width, int max_width, char padding, - int alignment, int len, int neg, int expprec, int always_sign) +php_sprintf_appendstring(char **buffer, zend_str_size_int *pos, zend_str_size_int *size, char *add, + zend_str_size_int min_width, zend_str_size_int max_width, char padding, + zend_str_size_int alignment, zend_str_size_int len, int neg, int expprec, int always_sign) { - register int npad; - int req_size; - int copy_len; - int m_width; + register zend_str_size_int npad; + zend_str_size_int req_size; + zend_str_size_int copy_len; + zend_str_size_int m_width; copy_len = (expprec ? MIN(max_width, len) : len); - npad = min_width - copy_len; + npad = (min_width >= copy_len) ? (min_width - copy_len) : 0; - if (npad < 0) { - npad = 0; - } - PRINTF_DEBUG(("sprintf: appendstring(%x, %d, %d, \"%s\", %d, '%c', %d)\n", *buffer, *pos, *size, add, min_width, padding, alignment)); m_width = MAX(min_width, copy_len); @@ -126,8 +122,8 @@ php_sprintf_appendstring(char **buffer, int *pos, int *size, char *add, /* php_spintf_appendint() {{{ */ inline static void -php_sprintf_appendint(char **buffer, int *pos, int *size, long number, - int width, char padding, int alignment, +php_sprintf_appendint(char **buffer, zend_str_size_int *pos, zend_str_size_int *size, long number, + zend_str_size_int width, char padding, zend_str_size_int alignment, int always_sign) { char numbuf[NUM_BUF_SIZE]; @@ -170,9 +166,9 @@ php_sprintf_appendint(char **buffer, int *pos, int *size, long number, /* php_spintf_appenduint() {{{ */ inline static void -php_sprintf_appenduint(char **buffer, int *pos, int *size, +php_sprintf_appenduint(char **buffer, zend_str_size_int *pos, zend_str_size_int *size, unsigned long number, - int width, char padding, int alignment) + zend_str_size_int width, char padding, zend_str_size_int alignment) { char numbuf[NUM_BUF_SIZE]; register unsigned long magn, nmagn; @@ -202,17 +198,18 @@ php_sprintf_appenduint(char **buffer, int *pos, int *size, /* php_spintf_appenddouble() {{{ */ inline static void -php_sprintf_appenddouble(char **buffer, int *pos, - int *size, double number, - int width, char padding, - int alignment, int precision, +php_sprintf_appenddouble(char **buffer, zend_str_size_int *pos, + zend_str_size_int *size, double number, + zend_str_size_int width, char padding, + zend_str_size_int alignment, int precision, int adjust, char fmt, int always_sign TSRMLS_DC) { char num_buf[NUM_BUF_SIZE]; char *s = NULL; - int s_len = 0, is_negative = 0; + zend_str_size_int s_len = 0; + int is_negative = 0; #ifdef HAVE_LOCALE_H struct lconv *lconv; #endif @@ -293,8 +290,8 @@ php_sprintf_appenddouble(char **buffer, int *pos, /* php_spintf_appendd2n() {{{ */ inline static void -php_sprintf_append2n(char **buffer, int *pos, int *size, long number, - int width, char padding, int alignment, int n, +php_sprintf_append2n(char **buffer, zend_str_size_int *pos, zend_str_size_int *size, long number, + zend_str_size_int width, char padding, zend_str_size_int alignment, int n, char *chartable, int expprec) { char numbuf[NUM_BUF_SIZE]; @@ -324,11 +321,11 @@ php_sprintf_append2n(char **buffer, int *pos, int *size, long number, /* php_spintf_getnumber() {{{ */ inline static int -php_sprintf_getnumber(char *buffer, int *pos) +php_sprintf_getnumber(char *buffer, zend_str_size_int *pos) { char *endptr; register long num = strtol(&buffer[*pos], &endptr, 10); - register int i = 0; + register zend_str_size_int i = 0; if (endptr != NULL) { i = (endptr - &buffer[*pos]); @@ -369,10 +366,11 @@ php_sprintf_getnumber(char *buffer, int *pos) * */ static char * -php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC) +php_formatted_print(int ht, zend_str_size_int *len, int use_array, int format_offset TSRMLS_DC) { zval ***args, **z_format; - int argc, size = 240, inpos = 0, outpos = 0, temppos; + int argc; + zend_str_size_int size = 240, inpos = 0, outpos = 0, temppos; int alignment, currarg, adjusting, argnum, width, precision; char *format, *result, padding; int always_sign; @@ -666,7 +664,7 @@ php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC PHP_FUNCTION(user_sprintf) { char *result; - int len; + zend_str_size_int len; if ((result=php_formatted_print(ht, &len, 0, 0 TSRMLS_CC))==NULL) { RETURN_FALSE; @@ -680,7 +678,7 @@ PHP_FUNCTION(user_sprintf) PHP_FUNCTION(vsprintf) { char *result; - int len; + zend_str_size_int len; if ((result=php_formatted_print(ht, &len, 1, 0 TSRMLS_CC))==NULL) { RETURN_FALSE; @@ -694,7 +692,7 @@ PHP_FUNCTION(vsprintf) PHP_FUNCTION(user_printf) { char *result; - int len, rlen; + zend_str_size_int len, rlen; if ((result=php_formatted_print(ht, &len, 0, 0 TSRMLS_CC))==NULL) { RETURN_FALSE; @@ -710,7 +708,7 @@ PHP_FUNCTION(user_printf) PHP_FUNCTION(vprintf) { char *result; - int len, rlen; + zend_str_size_int len, rlen; if ((result=php_formatted_print(ht, &len, 1, 0 TSRMLS_CC))==NULL) { RETURN_FALSE; @@ -728,7 +726,7 @@ PHP_FUNCTION(fprintf) php_stream *stream; zval *arg1; char *result; - int len; + zend_str_size_int len; if (ZEND_NUM_ARGS() < 2) { WRONG_PARAM_COUNT; @@ -759,7 +757,7 @@ PHP_FUNCTION(vfprintf) php_stream *stream; zval *arg1; char *result; - int len; + zend_str_size_int len; if (ZEND_NUM_ARGS() != 3) { WRONG_PARAM_COUNT; diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index 86975d7f5b20b..179671f23a27f 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -135,10 +135,11 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, char *path { php_stream *stream = NULL, *reuseid = NULL; php_url *resource = NULL; - int result, use_ssl, use_ssl_on_data = 0, tmp_len; + int result, use_ssl, use_ssl_on_data = 0; + zend_str_size_int tmp_len; char tmp_line[512]; char *transport; - int transport_len; + zend_str_size_int transport_len; resource = php_url_parse(path); if (resource == NULL || resource->path == NULL) { @@ -425,7 +426,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch int allow_overwrite = 0; int read_write = 0; char *transport; - int transport_len; + zend_str_size_int transport_len; tmp_line[0] = '\0'; diff --git a/ext/standard/head.c b/ext/standard/head.c index 5310ff6c03b2f..ae8d5318d9beb 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -73,10 +73,10 @@ PHPAPI int php_header(TSRMLS_D) } -PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, time_t expires, char *path, int path_len, char *domain, int domain_len, int secure, int url_encode, int httponly TSRMLS_DC) +PHPAPI int php_setcookie(char *name, zend_str_size_int name_len, char *value, zend_str_size_int value_len, time_t expires, char *path, zend_str_size_int path_len, char *domain, zend_str_size_int domain_len, int secure, int url_encode, int httponly TSRMLS_DC) { char *cookie, *encoded_value = NULL; - int len=sizeof("Set-Cookie: "); + zend_str_size_int len=sizeof("Set-Cookie: "); char *dt; sapi_header_line ctr = {0}; int result; @@ -93,7 +93,7 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t len += name_len; if (value && url_encode) { - int encoded_value_len; + zend_str_size_int encoded_value_len; encoded_value = php_url_encode(value, value_len, &encoded_value_len); len += encoded_value_len; diff --git a/ext/standard/head.h b/ext/standard/head.h index 7d657ba445ef0..11306be6b7def 100644 --- a/ext/standard/head.h +++ b/ext/standard/head.h @@ -31,6 +31,6 @@ PHP_FUNCTION(headers_list); PHP_FUNCTION(http_response_code); PHPAPI int php_header(TSRMLS_D); -PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, time_t expires, char *path, int path_len, char *domain, int domain_len, int secure, int url_encode, int httponly TSRMLS_DC); +PHPAPI int php_setcookie(char *name, zend_str_size_int name_len, char *value, zend_str_size_int value_len, time_t expires, char *path, zend_str_size_int path_len, char *domain, zend_str_size_int domain_len, int secure, int url_encode, int httponly TSRMLS_DC); #endif diff --git a/ext/standard/http.c b/ext/standard/http.c index 272cd1b0d9d24..9bcd710ee69f9 100644 --- a/ext/standard/http.c +++ b/ext/standard/http.c @@ -26,14 +26,15 @@ /* {{{ php_url_encode_hash */ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, - const char *num_prefix, int num_prefix_len, - const char *key_prefix, int key_prefix_len, - const char *key_suffix, int key_suffix_len, + const char *num_prefix, zend_str_size_int num_prefix_len, + const char *key_prefix, zend_str_size_int key_prefix_len, + const char *key_suffix, zend_str_size_int key_suffix_len, zval *type, char *arg_sep, int enc_type TSRMLS_DC) { char *key = NULL; char *ekey, *newprefix, *p; - int arg_sep_len, ekey_len, key_type, newprefix_len; + zend_str_size_int arg_sep_len, ekey_len, newprefix_len; + int key_type; zend_str_size_uint key_len; ulong idx; zval **zdata = NULL, *copyzval; diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 085ffe8ac669c..5643e19fe2330 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -94,7 +94,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, char *tmp = NULL; char *ua_str = NULL; zval **ua_zval = NULL, **tmpzval = NULL; - int scratch_len = 0; + zend_str_size_int scratch_len = 0; int body = 0; char location[HTTP_HEADER_BLOCK_SIZE]; zval *response_header = NULL; @@ -104,9 +104,9 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, size_t chunk_size = 0, file_size = 0; int eol_detect = 0; char *transport_string, *errstr = NULL; - int transport_len, have_header = 0, request_fulluri = 0, ignore_errors = 0; + zend_str_size_int transport_len, have_header = 0, request_fulluri = 0, ignore_errors = 0; char *protocol_version = NULL; - int protocol_version_len = 3; /* Default: "1.0" */ + zend_str_size_int protocol_version_len = 3; /* Default: "1.0" */ struct timeval timeout; char *user_headers = NULL; int header_init = ((flags & HTTP_WRAPPER_HEADER_INIT) != 0); @@ -426,13 +426,13 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, char *s; if (!header_init) { /* Remove post headers for redirects */ - int l = strlen(tmp); + zend_str_size_int l = strlen(tmp); char *s2, *tmp_c = estrdup(tmp); php_strtolower(tmp_c, l); if ((s = strstr(tmp_c, "content-length:"))) { if ((s2 = memchr(s, '\n', tmp_c + l - s))) { - int b = tmp_c + l - 1 - s2; + zend_str_size_int b = tmp_c + l - 1 - s2; memmove(tmp, tmp + (s2 + 1 - tmp_c), b); memmove(tmp_c, s2 + 1, b); diff --git a/ext/standard/info.c b/ext/standard/info.c index d6bb5a51fa2aa..6eb050467e875 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -61,10 +61,10 @@ PHPAPI extern char *php_ini_opened_path; PHPAPI extern char *php_ini_scanned_path; PHPAPI extern char *php_ini_scanned_files; -static int php_info_print_html_esc(const char *str, int len) /* {{{ */ +static zend_str_size_int php_info_print_html_esc(const char *str, zend_str_size_int len) /* {{{ */ { size_t new_len; - int written; + zend_str_size_int written; char *new_str; TSRMLS_FETCH(); @@ -75,10 +75,10 @@ static int php_info_print_html_esc(const char *str, int len) /* {{{ */ } /* }}} */ -static int php_info_printf(const char *fmt, ...) /* {{{ */ +static zend_str_size_int php_info_printf(const char *fmt, ...) /* {{{ */ { char *buf; - int len, written; + zend_str_size_int len, written; va_list argv; TSRMLS_FETCH(); @@ -92,7 +92,7 @@ static int php_info_printf(const char *fmt, ...) /* {{{ */ } /* }}} */ -static int php_info_print(const char *str) /* {{{ */ +static zend_str_size_int php_info_print(const char *str) /* {{{ */ { TSRMLS_FETCH(); return php_output_write(str, strlen(str) TSRMLS_CC); @@ -991,7 +991,7 @@ PHPAPI void php_info_print_hr(void) /* {{{ */ PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header) /* {{{ */ { - int spaces; + zend_str_size_int spaces; if (!sapi_module.phpinfo_as_text) { php_info_printf("%s\n", num_cols, header ); diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 9499981f27261..2b19a309feb6d 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -250,7 +250,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char if (mail_log && *mail_log) { char *tmp, *date_str; time_t curtime; - int l; + zend_str_size_int l; time(&curtime); date_str = php_format_date("d-M-Y H:i:s e", 13, curtime, 1 TSRMLS_CC); diff --git a/ext/standard/math.c b/ext/standard/math.c index 346c67669b731..c0a8edd9628eb 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -794,7 +794,7 @@ PHP_FUNCTION(rad2deg) PHPAPI long _php_math_basetolong(zval *arg, int base) { long num = 0, digit, onum; - int i; + zend_str_size_int i; char c, *s; if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) { @@ -840,7 +840,7 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) { long num = 0; double fnum = 0; - int i; + zend_str_size_int i; int mode = 0; char c, *s; long cutoff; @@ -1099,13 +1099,13 @@ PHPAPI char *_php_math_number_format(double d, int dec, char dec_point, char tho static char *_php_math_number_format_ex_len(double d, int dec, char *dec_point, zend_str_size_size_t dec_point_len, char *thousand_sep, zend_str_size_size_t thousand_sep_len, - int *result_len) + zend_str_size_int *result_len) { char *tmpbuf = NULL, *resbuf; char *s, *t; /* source, target */ char *dp; - int integral; - int tmplen, reslen=0; + zend_str_size_int integral; + zend_str_size_int tmplen, reslen=0; int count=0; int is_negative=0; @@ -1171,8 +1171,8 @@ static char *_php_math_number_format_ex_len(double d, int dec, char *dec_point, * Take care, as the sprintf implementation may return less places than * we requested due to internal buffer limitations */ if (dec) { - int declen = dp ? s - dp : 0; - int topad = dec > declen ? dec - declen : 0; + zend_str_size_int declen = dp ? s - dp : 0; + zend_str_size_int topad = dec > declen ? dec - declen : 0; /* pad with '0's */ while (topad--) { diff --git a/ext/standard/md5.c b/ext/standard/md5.c index 69bc71d7a0f30..bee01ba778c97 100644 --- a/ext/standard/md5.c +++ b/ext/standard/md5.c @@ -82,7 +82,7 @@ PHP_NAMED_FUNCTION(php_if_md5_file) unsigned char buf[1024]; unsigned char digest[16]; PHP_MD5_CTX context; - int n; + zend_str_size_int n; php_stream *stream; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|b", &arg, &arg_len, &raw_output) == FAILURE) { diff --git a/ext/standard/pack.c b/ext/standard/pack.c index a0330536fae1f..a766b539a46e2 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -84,7 +84,7 @@ static int little_endian_long_map[4]; /* {{{ php_pack */ -static void php_pack(zval **val, int size, int *map, char *output) +static void php_pack(zval **val, zend_str_size_int size, int *map, char *output) { int i; char *v; @@ -109,7 +109,7 @@ PHP_FUNCTION(pack) int num_args, i; int currentarg; char *format; - int formatlen; + zend_str_size_int formatlen; char *formatcodes; int *formatargs; int formatcount = 0; @@ -496,7 +496,7 @@ PHP_FUNCTION(pack) /* {{{ php_unpack */ -static long php_unpack(char *data, int size, int issigned, int *map) +static long php_unpack(char *data, zend_str_size_int size, int issigned, int *map) { long result; char *cresult = (char *) &result; @@ -529,10 +529,11 @@ static long php_unpack(char *data, int size, int issigned, int *map) PHP_FUNCTION(unpack) { char *format, *input, *formatarg, *inputarg; - int formatlen, formatarg_len, inputarg_len; + int formatlen; + zend_str_size_int formatarg_len, inputarg_len; int inputpos, inputlen, i; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &formatarg, &formatarg_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &formatarg, &formatarg_len, &inputarg, &inputarg_len) == FAILURE) { return; } @@ -550,8 +551,8 @@ PHP_FUNCTION(unpack) char c; int arg = 1, argb; char *name; - int namelen; - int size=0; + zend_str_size_int namelen; + zend_str_size_int size=0; /* Handle format arguments if any */ if (formatlen > 0) { @@ -676,7 +677,7 @@ PHP_FUNCTION(unpack) switch ((int) type) { case 'a': { /* a will not strip any trailing whitespace or null padding */ - int len = inputlen - inputpos; /* Remaining string */ + zend_str_size_int len = inputlen - inputpos; /* Remaining string */ /* If size was given take minimum of len and size */ if ((size >= 0) && (len > size)) { @@ -691,7 +692,7 @@ PHP_FUNCTION(unpack) case 'A': { /* A will strip any trailing whitespace */ char padn = '\0'; char pads = ' '; char padt = '\t'; char padc = '\r'; char padl = '\n'; - int len = inputlen - inputpos; /* Remaining string */ + zend_str_size_int len = inputlen - inputpos; /* Remaining string */ /* If size was given take minimum of len and size */ if ((size >= 0) && (len > size)) { @@ -718,7 +719,7 @@ PHP_FUNCTION(unpack) case 'Z': { /* Z will strip everything after the first null character */ char pad = '\0'; - int s, + zend_str_size_int s, len = inputlen - inputpos; /* Remaining string */ /* If size was given take minimum of len and size */ @@ -742,11 +743,11 @@ PHP_FUNCTION(unpack) case 'h': case 'H': { - int len = (inputlen - inputpos) * 2; /* Remaining */ + zend_str_size_int len = (inputlen - inputpos) * 2; /* Remaining */ int nibbleshift = (type == 'h') ? 0 : 4; int first = 1; char *buf; - int ipos, opos; + zend_str_size_int ipos, opos; /* If size was given take minimum of len and size */ if (size >= 0 && len > (size * 2)) { diff --git a/ext/standard/password.c b/ext/standard/password.c index 81e8ad54ef348..b16ca71c0d456 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -87,7 +87,7 @@ static zend_bool php_password_salt_to64(const char *str, const size_t str_len, c if ((int) str_len < 0) { return FAILURE; } - buffer = php_base64_encode((unsigned char*) str, (int) str_len, (int*) &ret_len); + buffer = php_base64_encode((unsigned char*) str, str_len, &ret_len); if (ret_len < out_len) { /* Too short of an encoded string generated */ efree(buffer); @@ -354,7 +354,7 @@ PHP_FUNCTION(password_hash) if (options && zend_symtable_find(options, "salt", 5, (void**) &option_buffer) == SUCCESS) { char *buffer; - int buffer_len_int = 0; + zend_str_size_int buffer_len_int = 0; size_t buffer_len; switch (Z_TYPE_PP(option_buffer)) { case IS_STRING: diff --git a/ext/standard/php_http.h b/ext/standard/php_http.h index 468fd0508cc33..2b4cca59a8824 100644 --- a/ext/standard/php_http.h +++ b/ext/standard/php_http.h @@ -25,9 +25,9 @@ #include "php_smart_str.h" PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, - const char *num_prefix, int num_prefix_len, - const char *key_prefix, int key_prefix_len, - const char *key_suffix, int key_suffix_len, + const char *num_prefix, zend_str_size_int num_prefix_len, + const char *key_prefix, zend_str_size_int key_prefix_len, + const char *key_suffix, zend_str_size_int key_suffix_len, zval *type, char *arg_sep, int enc_type TSRMLS_DC); #define php_url_encode_hash(ht, formstr) php_url_encode_hash_ex((ht), (formstr), NULL, 0, NULL, 0, NULL, 0, NULL TSRMLS_CC) diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index 833e9d86cea76..ef44bb670d108 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -1,5 +1,5 @@ /* Generated by re2c 0.13.5 */ -#line 1 "ext/standard/url_scanner_ex.re" +#line 1 "url_scanner_ex.re" /* +----------------------------------------------------------------------+ | PHP Version 5 | @@ -74,7 +74,7 @@ static PHP_INI_MH(OnUpdateTags) val = strchr(key, '='); if (val) { char *q; - int keylen; + zend_str_size_int keylen; *val++ = '\0'; for (q = key; *q; q++) @@ -95,7 +95,7 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("url_rewriter.tags", "a=href,area=href,frame=src,form=,fieldset=", PHP_INI_ALL, OnUpdateTags, url_adapt_state_ex, php_basic_globals, basic_globals) PHP_INI_END() -#line 102 "ext/standard/url_scanner_ex.re" +#line 102 "url_scanner_ex.re" #define YYFILL(n) goto done @@ -114,7 +114,7 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st scan: -#line 118 "ext/standard/url_scanner_ex.c" +#line 118 "url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -160,19 +160,19 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st if (yych <= '9') goto yy6; if (yych >= ';') goto yy4; ++YYCURSOR; -#line 120 "ext/standard/url_scanner_ex.re" +#line 120 "url_scanner_ex.re" { smart_str_append(dest, url); return; } -#line 166 "ext/standard/url_scanner_ex.c" +#line 166 "url_scanner_ex.c" yy4: ++YYCURSOR; -#line 121 "ext/standard/url_scanner_ex.re" +#line 121 "url_scanner_ex.re" { sep = separator; goto scan; } -#line 171 "ext/standard/url_scanner_ex.c" +#line 171 "url_scanner_ex.c" yy6: ++YYCURSOR; -#line 122 "ext/standard/url_scanner_ex.re" +#line 122 "url_scanner_ex.re" { bash = p - 1; goto done; } -#line 176 "ext/standard/url_scanner_ex.c" +#line 176 "url_scanner_ex.c" yy8: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -180,11 +180,11 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st if (yybm[0+yych] & 128) { goto yy8; } -#line 123 "ext/standard/url_scanner_ex.re" +#line 123 "url_scanner_ex.re" { goto scan; } -#line 186 "ext/standard/url_scanner_ex.c" +#line 186 "url_scanner_ex.c" } -#line 124 "ext/standard/url_scanner_ex.re" +#line 124 "url_scanner_ex.re" done: @@ -364,7 +364,7 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s state_plain: start = YYCURSOR; -#line 368 "ext/standard/url_scanner_ex.c" +#line 368 "url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -407,9 +407,9 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s goto yy15; } ++YYCURSOR; -#line 303 "ext/standard/url_scanner_ex.re" +#line 303 "url_scanner_ex.re" { passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; } -#line 413 "ext/standard/url_scanner_ex.c" +#line 413 "url_scanner_ex.c" yy15: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -417,17 +417,17 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s if (yybm[0+yych] & 128) { goto yy15; } -#line 304 "ext/standard/url_scanner_ex.re" +#line 304 "url_scanner_ex.re" { passthru(STD_ARGS); goto state_plain; } -#line 423 "ext/standard/url_scanner_ex.c" +#line 423 "url_scanner_ex.c" } -#line 305 "ext/standard/url_scanner_ex.re" +#line 305 "url_scanner_ex.re" state_tag: start = YYCURSOR; -#line 431 "ext/standard/url_scanner_ex.c" +#line 431 "url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -478,14 +478,14 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s yych = *YYCURSOR; goto yy25; yy21: -#line 310 "ext/standard/url_scanner_ex.re" +#line 310 "url_scanner_ex.re" { handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; } -#line 484 "ext/standard/url_scanner_ex.c" +#line 484 "url_scanner_ex.c" yy22: ++YYCURSOR; -#line 311 "ext/standard/url_scanner_ex.re" +#line 311 "url_scanner_ex.re" { passthru(STD_ARGS); goto state_plain_begin; } -#line 489 "ext/standard/url_scanner_ex.c" +#line 489 "url_scanner_ex.c" yy24: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -496,7 +496,7 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s } goto yy21; } -#line 312 "ext/standard/url_scanner_ex.re" +#line 312 "url_scanner_ex.re" state_next_arg_begin: @@ -505,7 +505,7 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s state_next_arg: start = YYCURSOR; -#line 509 "ext/standard/url_scanner_ex.c" +#line 509 "url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -570,28 +570,28 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s ++YYCURSOR; if ((yych = *YYCURSOR) == '>') goto yy39; yy29: -#line 323 "ext/standard/url_scanner_ex.re" +#line 323 "url_scanner_ex.re" { passthru(STD_ARGS); goto state_plain_begin; } -#line 576 "ext/standard/url_scanner_ex.c" +#line 576 "url_scanner_ex.c" yy30: ++YYCURSOR; yy31: -#line 320 "ext/standard/url_scanner_ex.re" +#line 320 "url_scanner_ex.re" { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } -#line 582 "ext/standard/url_scanner_ex.c" +#line 582 "url_scanner_ex.c" yy32: ++YYCURSOR; yych = *YYCURSOR; goto yy38; yy33: -#line 321 "ext/standard/url_scanner_ex.re" +#line 321 "url_scanner_ex.re" { passthru(STD_ARGS); goto state_next_arg; } -#line 590 "ext/standard/url_scanner_ex.c" +#line 590 "url_scanner_ex.c" yy34: ++YYCURSOR; -#line 322 "ext/standard/url_scanner_ex.re" +#line 322 "url_scanner_ex.re" { --YYCURSOR; STATE = STATE_ARG; goto state_arg; } -#line 595 "ext/standard/url_scanner_ex.c" +#line 595 "url_scanner_ex.c" yy36: yych = *++YYCURSOR; goto yy29; @@ -609,13 +609,13 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s yych = *YYCURSOR; goto yy31; } -#line 324 "ext/standard/url_scanner_ex.re" +#line 324 "url_scanner_ex.re" state_arg: start = YYCURSOR; -#line 619 "ext/standard/url_scanner_ex.c" +#line 619 "url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -663,14 +663,14 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s yych = *YYCURSOR; goto yy47; yy43: -#line 329 "ext/standard/url_scanner_ex.re" +#line 329 "url_scanner_ex.re" { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; } -#line 669 "ext/standard/url_scanner_ex.c" +#line 669 "url_scanner_ex.c" yy44: ++YYCURSOR; -#line 330 "ext/standard/url_scanner_ex.re" +#line 330 "url_scanner_ex.re" { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; } -#line 674 "ext/standard/url_scanner_ex.c" +#line 674 "url_scanner_ex.c" yy46: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -681,13 +681,13 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s } goto yy43; } -#line 331 "ext/standard/url_scanner_ex.re" +#line 331 "url_scanner_ex.re" state_before_val: start = YYCURSOR; -#line 691 "ext/standard/url_scanner_ex.c" +#line 691 "url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -734,17 +734,17 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s if (yych == ' ') goto yy57; if (yych == '=') goto yy55; yy51: -#line 337 "ext/standard/url_scanner_ex.re" +#line 337 "url_scanner_ex.re" { --YYCURSOR; goto state_next_arg_begin; } -#line 740 "ext/standard/url_scanner_ex.c" +#line 740 "url_scanner_ex.c" yy52: ++YYCURSOR; yych = *YYCURSOR; goto yy56; yy53: -#line 336 "ext/standard/url_scanner_ex.re" +#line 336 "url_scanner_ex.re" { passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; } -#line 748 "ext/standard/url_scanner_ex.c" +#line 748 "url_scanner_ex.c" yy54: yych = *++YYCURSOR; goto yy51; @@ -766,14 +766,14 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s YYCURSOR = YYMARKER; goto yy51; } -#line 338 "ext/standard/url_scanner_ex.re" +#line 338 "url_scanner_ex.re" state_val: start = YYCURSOR; -#line 777 "ext/standard/url_scanner_ex.c" +#line 777 "url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -834,9 +834,9 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s yych = *(YYMARKER = ++YYCURSOR); if (yych != '>') goto yy76; yy63: -#line 347 "ext/standard/url_scanner_ex.re" +#line 347 "url_scanner_ex.re" { passthru(STD_ARGS); goto state_next_arg_begin; } -#line 840 "ext/standard/url_scanner_ex.c" +#line 840 "url_scanner_ex.c" yy64: yych = *(YYMARKER = ++YYCURSOR); if (yych == '>') goto yy63; @@ -846,9 +846,9 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s yych = *YYCURSOR; goto yy69; yy66: -#line 346 "ext/standard/url_scanner_ex.re" +#line 346 "url_scanner_ex.re" { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } -#line 852 "ext/standard/url_scanner_ex.c" +#line 852 "url_scanner_ex.c" yy67: yych = *++YYCURSOR; goto yy63; @@ -875,9 +875,9 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s goto yy63; yy73: ++YYCURSOR; -#line 345 "ext/standard/url_scanner_ex.re" +#line 345 "url_scanner_ex.re" { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; } -#line 881 "ext/standard/url_scanner_ex.c" +#line 881 "url_scanner_ex.c" yy75: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -888,11 +888,11 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s } if (yych >= '>') goto yy72; ++YYCURSOR; -#line 344 "ext/standard/url_scanner_ex.re" +#line 344 "url_scanner_ex.re" { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; } -#line 894 "ext/standard/url_scanner_ex.c" +#line 894 "url_scanner_ex.c" } -#line 348 "ext/standard/url_scanner_ex.re" +#line 348 "url_scanner_ex.re" stop: @@ -978,7 +978,7 @@ static int php_url_scanner_ex_deactivate(TSRMLS_D) return SUCCESS; } -static void php_url_scanner_output_handler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC) +static void php_url_scanner_output_handler(char *output, zend_str_size_uint output_len, char **handled_output, zend_str_size_uint *handled_output_len, int mode TSRMLS_DC) { size_t len; @@ -1009,10 +1009,10 @@ static void php_url_scanner_output_handler(char *output, uint output_len, char * } } -PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC) +PHPAPI int php_url_scanner_add_var(char *name, zend_str_size_int name_len, char *value, zend_str_size_int value_len, int urlencode TSRMLS_DC) { char *encoded; - int encoded_len; + zend_str_size_int encoded_len; smart_str val; if (! BG(url_adapt_state_ex).active) { diff --git a/ext/standard/url_scanner_ex.h b/ext/standard/url_scanner_ex.h index 667c56c1ec0f5..3ed9eb53e431a 100644 --- a/ext/standard/url_scanner_ex.h +++ b/ext/standard/url_scanner_ex.h @@ -28,7 +28,7 @@ PHP_RINIT_FUNCTION(url_scanner_ex); PHP_RSHUTDOWN_FUNCTION(url_scanner_ex); PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen TSRMLS_DC); -PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC); +PHPAPI int php_url_scanner_add_var(char *name, zend_str_size_int name_len, char *value, zend_str_size_int value_len, int urlencode TSRMLS_DC); PHPAPI int php_url_scanner_reset_vars(TSRMLS_D); #include "php_smart_str_public.h" diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index f0dee8ebc1cb7..08175042181f0 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -72,7 +72,7 @@ static PHP_INI_MH(OnUpdateTags) val = strchr(key, '='); if (val) { char *q; - int keylen; + zend_str_size_int keylen; *val++ = '\0'; for (q = key; *q; q++) @@ -430,7 +430,7 @@ static int php_url_scanner_ex_deactivate(TSRMLS_D) return SUCCESS; } -static void php_url_scanner_output_handler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC) +static void php_url_scanner_output_handler(char *output, zend_str_size_uint output_len, char **handled_output, zend_str_size_uint *handled_output_len, int mode TSRMLS_DC) { size_t len; @@ -461,10 +461,10 @@ static void php_url_scanner_output_handler(char *output, uint output_len, char * } } -PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC) +PHPAPI int php_url_scanner_add_var(char *name, zend_str_size_int name_len, char *value, zend_str_size_int value_len, int urlencode TSRMLS_DC) { char *encoded; - int encoded_len; + zend_str_size_int encoded_len; smart_str val; if (! BG(url_adapt_state_ex).active) { diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c index aadbcaf84ab52..c70f439bc7798 100644 --- a/ext/standard/versioning.c +++ b/ext/standard/versioning.c @@ -33,7 +33,7 @@ PHPAPI char * php_canonicalize_version(const char *version) { - int len = strlen(version); + zend_str_size_int len = strlen(version); char *buf = safe_emalloc(len, 2, 1), *q, lp, lq; const char *p; @@ -211,11 +211,11 @@ php_version_compare(const char *orig_ver1, const char *orig_ver2) PHP_FUNCTION(version_compare) { char *v1, *v2, *op = NULL; - int v1_len, v2_len, op_len = 0; + zend_str_size_int v1_len, v2_len, op_len = 0; int compare, argc; argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "ss|s", &v1, &v1_len, &v2, + if (zend_parse_parameters(argc TSRMLS_CC, "SS|S", &v1, &v1_len, &v2, &v2_len, &op, &op_len) == FAILURE) { return; } diff --git a/main/SAPI.h b/main/SAPI.h index 75da9947f6353..84e65b90a81c7 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -165,7 +165,7 @@ END_EXTERN_C() typedef struct { char *line; /* If you allocated this, you need to free it yourself */ - uint line_len; + zend_str_size_uint line_len; long response_code; /* long due to zend_parse_parameters compatibility */ } sapi_header_line; diff --git a/main/spprintf.c b/main/spprintf.c index b42dfd5f5e5ba..db77cc82d765f 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -198,7 +198,8 @@ static size_t strnlen(const char *s, size_t maxlen) { static void xbuf_format_converter(smart_str *xbuf, const char *fmt, va_list ap) /* {{{ */ { char *s = NULL; - int s_len, free_zcopy; + zend_str_size_int s_len; + int free_zcopy; zval *zvp, zcopy; int min_width = 0; @@ -811,7 +812,7 @@ PHPAPI zend_str_size_int vspprintf(char **pbuf, zend_str_size_size_t max_len, co PHPAPI zend_str_size_int spprintf(char **pbuf, size_t max_len, const char *format, ...) /* {{{ */ { - int cc; + zend_str_size_int cc; va_list ap; va_start(ap, format); From 0773ab461e12d6496b77dc021f76f747f0787494 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 13 Aug 2013 01:26:05 -0700 Subject: [PATCH 30/31] changes to dns.c --- ext/standard/dns.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ext/standard/dns.c b/ext/standard/dns.c index 3584fc1bfe9ec..136ef0fd4d1ff 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -153,10 +153,10 @@ PHP_FUNCTION(gethostname) PHP_FUNCTION(gethostbyaddr) { char *addr; - int addr_len; + zend_str_size_int addr_len; char *hostname; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &addr, &addr_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &addr, &addr_len) == FAILURE) { return; } @@ -215,10 +215,10 @@ static char *php_gethostbyaddr(char *ip) PHP_FUNCTION(gethostbyname) { char *hostname; - int hostname_len; + zend_str_size_int hostname_len; char *addr; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &hostname_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &hostname, &hostname_len) == FAILURE) { return; } @@ -233,12 +233,12 @@ PHP_FUNCTION(gethostbyname) PHP_FUNCTION(gethostbynamel) { char *hostname; - int hostname_len; + zend_str_size_int hostname_len; struct hostent *hp; struct in_addr in; int i; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &hostname_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &hostname, &hostname_len) == FAILURE) { return; } @@ -346,7 +346,7 @@ PHP_FUNCTION(dns_check_record) #endif u_char ans[MAXPACKET]; char *hostname, *rectype = NULL; - int hostname_len, rectype_len = 0; + zend_str_size_int hostname_len, rectype_len = 0; int type = T_MX, i; #if defined(HAVE_DNS_SEARCH) struct sockaddr_storage from; @@ -357,7 +357,7 @@ PHP_FUNCTION(dns_check_record) struct __res_state *handle = &state; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &hostname, &hostname_len, &rectype, &rectype_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &hostname, &hostname_len, &rectype, &rectype_len) == FAILURE) { return; } @@ -714,7 +714,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int PHP_FUNCTION(dns_get_record) { char *hostname; - int hostname_len; + zend_str_size_int hostname_len; long type_param = PHP_DNS_ANY; zval *authns = NULL, *addtl = NULL; int type_to_fetch; @@ -733,7 +733,7 @@ PHP_FUNCTION(dns_get_record) int type, first_query = 1, store_results = 1; zend_bool raw = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz!z!b", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lz!z!b", &hostname, &hostname_len, &type_param, &authns, &addtl, &raw) == FAILURE) { return; } @@ -926,7 +926,7 @@ PHP_FUNCTION(dns_get_record) PHP_FUNCTION(dns_get_mx) { char *hostname; - int hostname_len; + zend_str_size_int hostname_len; zval *mx_list, *weight_list = NULL; int count, qdc; u_short type, weight; @@ -944,7 +944,7 @@ PHP_FUNCTION(dns_get_mx) struct __res_state *handle = &state; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|z", &hostname, &hostname_len, &mx_list, &weight_list) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|z", &hostname, &hostname_len, &mx_list, &weight_list) == FAILURE) { return; } From 1a069d567fa366cf142fb5dd593d8e11db9ef60f Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Tue, 13 Aug 2013 10:11:04 -0400 Subject: [PATCH 31/31] Revert "Merge pull request #3 from weltling/string_size_refactor_take_2" This reverts commit 2d63270ac8df8d695114dab05f43c3878a1f247e, reversing changes made to 1db66942e1c2e16b36ee614d827605b9fd9b611f. --- CODING_STANDARDS | 5 +- INSTALL | 4 +- Makefile.global | 15 +- NEWS | 13 - README.EXTENSIONS | 39 + README.PHP4-TO-PHP5-THIN-CHANGES | 155 ++ README.STREAMS | 2 +- README.SUBMITTING_PATCH | 28 +- TSRM/tsrm_virtual_cwd.c | 2 +- TSRM/tsrm_virtual_cwd.h | 2 +- TSRM/tsrm_win32.c | 8 +- UPGRADING | 12 - UPGRADING.INTERNALS | 4 +- Zend/README.ZEND_VM | 2 +- Zend/ZEND_CHANGES | 4 +- Zend/acinclude.m4 | 29 +- Zend/tests/bug60771.phpt | 20 +- Zend/tests/bug65254.phpt | 21 - Zend/tests/bug65291.phpt | 25 - Zend/tests/bug65372.phpt | 40 - Zend/tests/closure_044.phpt | 2 +- .../bugs/overridding-conflicting-methods.phpt | 2 +- Zend/zend.c | 62 +- Zend/zend.h | 58 +- Zend/zend_API.c | 238 ++-- Zend/zend_API.h | 154 +- Zend/zend_alloc.c | 20 +- Zend/zend_alloc.h | 5 +- Zend/zend_builtin_functions.c | 142 +- Zend/zend_closures.c | 10 +- Zend/zend_compile.c | 338 ++--- Zend/zend_compile.h | 36 +- Zend/zend_constants.c | 117 +- Zend/zend_constants.h | 22 +- Zend/zend_exceptions.c | 62 +- Zend/zend_exceptions.h | 2 +- Zend/zend_execute.c | 32 +- Zend/zend_execute.h | 22 +- Zend/zend_execute_API.c | 57 +- Zend/zend_generators.c | 2 +- Zend/zend_globals.h | 2 +- Zend/zend_hash.c | 32 +- Zend/zend_hash.h | 47 +- Zend/zend_highlight.c | 2 +- Zend/zend_highlight.h | 2 +- Zend/zend_ini.c | 24 +- Zend/zend_ini.h | 24 +- Zend/zend_ini_parser.y | 36 +- Zend/zend_ini_scanner.c | 10 +- Zend/zend_ini_scanner.l | 10 +- Zend/zend_ini_scanner_defs.h | 26 +- Zend/zend_interfaces.c | 14 +- Zend/zend_interfaces.h | 10 +- Zend/zend_language_parser.y | 10 +- Zend/zend_language_scanner.h | 2 +- Zend/zend_object_handlers.c | 40 +- Zend/zend_object_handlers.h | 14 +- Zend/zend_operators.c | 196 +-- Zend/zend_operators.h | 59 +- Zend/zend_string.c | 6 +- Zend/zend_string.h | 2 +- Zend/zend_types.h | 15 - Zend/zend_vm_def.h | 157 +- Zend/zend_vm_execute.h | 1104 +++++++-------- Zend/zend_vm_gen.php | 2 +- acinclude.m4 | 33 +- build/libtool.m4 | 17 +- config.guess | 2 +- configure.in | 16 +- ext/bz2/bz2.c | 6 +- ext/bz2/config.m4 | 2 +- ext/bz2/php_bz2.h | 4 +- ext/com_dotnet/com_variant.c | 2 +- ext/com_dotnet/com_wrapper.c | 6 +- ext/curl/config.m4 | 2 +- ext/date/config0.m4 | 1 - ext/date/lib/timelib_structs.h | 32 +- ext/date/lib/timezonedb.h | 88 +- ext/date/php_date.c | 141 +- ext/date/php_date.h | 6 +- ext/date/tests/bug55397.phpt | 2 +- ext/date/tests/bug65184.phpt | 26 - ext/dba/config.m4 | 4 +- ext/dba/dba.c | 2 +- ext/dba/tests/dba_gdbm.phpt | 2 +- ext/dom/document.c | 16 +- ext/dom/tests/DOMDocument_loadXML_basic.phpt | 21 - ext/dom/tests/DOMDocument_loadXML_error1.phpt | 26 - ext/dom/tests/DOMDocument_loadXML_error2.phpt | 30 - ext/dom/tests/DOMDocument_loadXML_error3.phpt | 22 - ext/dom/tests/DOMDocument_loadXML_error4.phpt | 22 - ext/dom/tests/DOMDocument_loadXML_error5.phpt | 22 - .../tests/DOMDocument_loadXML_variation1.phpt | 21 - .../tests/DOMDocument_loadXML_variation2.phpt | 22 - .../tests/DOMDocument_loadXML_variation3.phpt | 22 - .../tests/DOMDocument_loadXML_variation4.phpt | 32 - ext/dom/tests/DOMDocument_load_basic.phpt | 21 - ext/dom/tests/DOMDocument_load_error1.phpt | 26 - ext/dom/tests/DOMDocument_load_error2.phpt | 30 - ext/dom/tests/DOMDocument_load_error3.phpt | 22 - ext/dom/tests/DOMDocument_load_error4.phpt | 22 - ext/dom/tests/DOMDocument_load_error5.phpt | 22 - .../tests/DOMDocument_load_variation1.phpt | 21 - .../tests/DOMDocument_load_variation2.phpt | 22 - .../tests/DOMDocument_load_variation3.phpt | 22 - .../tests/DOMDocument_load_variation4.phpt | 25 - ...ocument_schemaValidateSource_addAttrs.phpt | 25 - ...MDocument_schemaValidateSource_error4.phpt | 2 +- ...ent_schemaValidateSource_missingAttrs.phpt | 25 - .../DOMDocument_schemaValidate_addAttrs.phpt | 23 - .../DOMDocument_schemaValidate_error4.phpt | 2 +- .../DOMDocument_schemaValidate_error5.phpt | 8 +- ...MDocument_schemaValidate_missingAttrs.phpt | 23 - ext/dom/tests/book-attr.xml | 11 - ext/dom/tests/book.xsd | 1 - ext/dom/tests/book_with_dtd.xml | 16 - ext/dom/tests/book_with_dtd2.xml | 23 - ext/dom/tests/books.dtd | 7 - ext/dom/tests/bug44648.phpt | 2 +- ext/dom/tests/domdocumentload_test_method.php | 12 - .../domdocumentload_test_method_savexml.php | 14 - ext/dom/tests/domdocumentload_utilities.php | 16 - .../tests/domdocumentloadxml_test_method.php | 12 - ...domdocumentloadxml_test_method_savexml.php | 14 - ext/dom/tests/not_well_formed.xml | 12 - ext/dom/tests/not_well_formed2.xml | 12 - ext/dom/tests/not_well_formed3.xml | 12 - ext/dom/tests/not_well_formed4.xml | 12 - ext/dom/tests/not_well_formed5.xml | 10 - ext/dom/tests/wrong_book_with_dtd.xml | 13 - ext/dom/tests/wrong_book_with_dtd2.xml | 20 - ext/enchant/config.m4 | 2 +- ext/enchant/enchant.c | 2 +- ext/ereg/config0.m4 | 2 +- ext/ereg/ereg.c | 8 +- ext/exif/exif.c | 12 +- ext/ext_skel | 38 +- ext/fileinfo/fileinfo.c | 2 +- ext/fileinfo/libmagic/softmagic.c | 2 +- ext/fileinfo/tests/magic | 4 +- ext/filter/config.m4 | 2 +- ext/filter/filter.c | 2 +- ext/ftp/ftp.c | 71 +- ext/ftp/ftp.h | 12 +- ext/ftp/php_ftp.c | 16 +- ext/ftp/tests/filesize_large.phpt | 23 - ext/ftp/tests/ftp_fget_basic.phpt | 2 +- ext/ftp/tests/ftp_get_basic.phpt | 2 +- ext/ftp/tests/ftp_nb_get_large.phpt | 36 - ext/ftp/tests/server.inc | 23 +- ext/gd/config.m4 | 8 +- ext/gd/gd.c | 2 +- ext/gd/libgd/gd_crop.c | 2 +- ext/gd/libgd/webpimg.h | 2 +- ext/gd/tests/imagecrop_auto.phpt | 2 - ext/gettext/config.m4 | 2 +- ext/gmp/config.m4 | 2 +- ext/hash/config.m4 | 4 +- ext/hash/config.w32 | 3 +- ext/hash/hash.c | 4 +- ext/hash/package.xml | 1 + ext/hash/php_hash.h | 7 +- ext/hash/php_hash_types.h | 71 + ext/hash/tests/hash_file_error.phpt | 6 +- ext/iconv/config.m4 | 2 +- ext/imap/config.m4 | 2 +- ext/interbase/config.m4 | 2 +- .../breakiterator/breakiterator_class.cpp | 16 +- ext/intl/calendar/calendar_class.cpp | 7 +- ext/intl/calendar/calendar_methods.cpp | 26 - ext/intl/calendar/calendar_methods.h | 2 - ext/intl/collator/collator_convert.c | 4 +- ext/intl/php_intl.c | 6 - .../calendar_const_field_field_count.phpt | 13 - ...endar_setMinimalDaysInFirstWeek_basic.phpt | 26 - ...endar_setMinimalDaysInFirstWeek_error.phpt | 40 - .../tests/transliterator_create_error.phpt | 6 +- ...transliterator_transliterate_variant1.phpt | 8 +- ext/json/json.c | 4 +- ext/ldap/config.m4 | 2 +- ext/ldap/tests/ldap_get_values_len_error.phpt | 2 +- .../tests/ldap_set_rebind_proc_error.phpt | 4 +- ext/libxml/libxml.c | 9 +- ext/mbstring/config.m4 | 8 +- ext/mbstring/oniguruma/HISTORY | 2 +- .../tests/illformed_utf_sequences.phpt | 18 +- ext/mbstring/tests/mb_http_output.phpt | 2 +- ext/mcrypt/config.m4 | 2 +- ext/mssql/config.m4 | 2 +- ext/mssql/php_mssql.c | 13 +- ext/mssql/php_mssql.h | 2 +- ext/mysql/config.m4 | 7 +- ext/mysql/php_mysql.c | 4 +- ext/mysqli/config.m4 | 7 +- ext/mysqli/mysqli.c | 2 +- ext/mysqli/mysqli_nonapi.c | 4 +- ext/mysqli/tests/mysqli_driver.phpt | 2 +- .../mysqli_fetch_assoc_no_alias_utf8.phpt | 4 +- ext/mysqli/tests/mysqli_get_client_stats.phpt | 2 +- ext/mysqli/tests/mysqli_options.phpt | 2 +- ext/mysqli/tests/mysqli_stmt_big_prepare.phpt | 50 - ext/mysqlnd/config9.m4 | 16 +- ext/mysqlnd/mysqlnd.c | 31 +- ext/mysqlnd/mysqlnd_enum_n_def.h | 2 +- ext/mysqlnd/mysqlnd_net.c | 2 +- ext/mysqlnd/mysqlnd_portability.h | 107 +- ext/mysqlnd/mysqlnd_ps_codec.c | 1 - ext/oci8/README | 10 +- ext/oci8/config.m4 | 23 +- ext/oci8/oci8.c | 600 ++++---- ext/oci8/oci8_collection.c | 125 +- ext/oci8/oci8_dtrace.d | 195 --- ext/oci8/oci8_interface.c | 55 +- ext/oci8/oci8_lob.c | 113 +- ext/oci8/oci8_statement.c | 272 ++-- ext/oci8/package.xml | 191 +-- ext/oci8/php_oci8.h | 2 +- ext/oci8/php_oci8_int.h | 298 ++-- ext/oci8/tests/bind_char_1.phpt | 13 +- ext/oci8/tests/bind_char_1_11gR1.phpt | 10 +- ext/oci8/tests/bind_char_2.phpt | 13 +- ext/oci8/tests/bind_char_2_11gR1.phpt | 10 +- ext/oci8/tests/bind_char_3.phpt | 13 +- ext/oci8/tests/bind_char_3_11gR1.phpt | 10 +- ext/oci8/tests/bind_char_4.phpt | 13 +- ext/oci8/tests/bind_char_4_11gR1.phpt | 10 +- ext/oci8/tests/bind_unsupported_2.phpt | 3 +- ext/oci8/tests/bug27303_1.phpt | 13 +- ext/oci8/tests/bug27303_1_11gR1.phpt | 13 +- ext/oci8/tests/bug27303_2.phpt | 13 +- ext/oci8/tests/bug27303_2_11gR1.phpt | 13 +- ext/oci8/tests/bug27303_4.phpt | 14 +- ext/oci8/tests/bug27303_4_11gR1.phpt | 13 +- ext/oci8/tests/bug36403.phpt | 5 +- ext/oci8/tests/bug43492_2.phpt | 2 +- ext/oci8/tests/bug43497.phpt | 5 +- ext/oci8/tests/bug47281.phpt | 7 +- ext/oci8/tests/commit_001.phpt | 36 +- ext/oci8/tests/conn_attr.inc | 42 +- ext/oci8/tests/conn_attr_1.phpt | 12 +- ext/oci8/tests/conn_attr_2.phpt | 36 +- ext/oci8/tests/conn_attr_3.phpt | 11 +- ext/oci8/tests/conn_attr_4.phpt | 18 +- ext/oci8/tests/conn_attr_5.phpt | 11 +- .../tests/connect_without_oracle_home.phpt | 4 +- .../tests/connect_without_oracle_home_11.phpt | 6 +- .../connect_without_oracle_home_old_11.phpt | 6 +- ext/oci8/tests/cursors_old.phpt | 16 +- ext/oci8/tests/debug.phpt | 7 +- ext/oci8/tests/define.phpt | 2 +- ext/oci8/tests/define1.phpt | 2 +- ext/oci8/tests/define4.phpt | 14 +- ext/oci8/tests/define5.phpt | 8 +- ext/oci8/tests/define_old.phpt | 2 +- ext/oci8/tests/details.inc | 4 +- ext/oci8/tests/edition_1.phpt | 47 +- ext/oci8/tests/edition_2.phpt | 10 +- ext/oci8/tests/extauth_01.phpt | 48 +- ext/oci8/tests/extauth_02.phpt | 48 +- ext/oci8/tests/extauth_03.phpt | 48 +- ext/oci8/tests/fetch.phpt | 12 +- ext/oci8/tests/fetch_all.phpt | 32 +- ext/oci8/tests/fetch_all1.phpt | 32 +- ext/oci8/tests/fetch_all3.phpt | 336 ++--- ext/oci8/tests/fetch_all4.phpt | 4 +- ext/oci8/tests/fetch_all5.phpt | 32 +- ext/oci8/tests/fetch_into.phpt | 16 +- ext/oci8/tests/fetch_object.phpt | 36 +- ext/oci8/tests/fetch_row.phpt | 12 +- ext/oci8/tests/field_funcs1.phpt | 4 +- ext/oci8/tests/imp_res_1.phpt | 630 --------- ext/oci8/tests/imp_res_2.phpt | 99 -- ext/oci8/tests/imp_res_3.phpt | 1257 ----------------- ext/oci8/tests/imp_res_4.phpt | 82 -- ext/oci8/tests/imp_res_5.phpt | 84 -- ext/oci8/tests/imp_res_6.phpt | 118 -- ext/oci8/tests/imp_res_7.phpt | 873 ------------ ext/oci8/tests/imp_res_call_error.phpt | 61 - ext/oci8/tests/imp_res_cancel.phpt | 68 - ext/oci8/tests/imp_res_close.phpt | 69 - ext/oci8/tests/imp_res_cursor.phpt | 99 -- ext/oci8/tests/imp_res_dbmsoutput.phpt | 136 -- ext/oci8/tests/imp_res_field.phpt | 227 --- ext/oci8/tests/imp_res_func_error.phpt | 67 - ext/oci8/tests/imp_res_get_1.phpt | 109 -- ext/oci8/tests/imp_res_get_2.phpt | 107 -- ext/oci8/tests/imp_res_get_3.phpt | 267 ---- ext/oci8/tests/imp_res_get_4.phpt | 146 -- ext/oci8/tests/imp_res_get_5.phpt | 124 -- ext/oci8/tests/imp_res_get_all.phpt | 120 -- ext/oci8/tests/imp_res_get_cancel.phpt | 56 - ext/oci8/tests/imp_res_get_close_1.phpt | 68 - ext/oci8/tests/imp_res_get_close_2.phpt | 64 - ext/oci8/tests/imp_res_get_close_3.phpt | 65 - ext/oci8/tests/imp_res_get_cursor.phpt | 101 -- ext/oci8/tests/imp_res_get_dbmsoutput.phpt | 156 -- ext/oci8/tests/imp_res_get_exec.phpt | 55 - ext/oci8/tests/imp_res_get_none.phpt | 46 - ext/oci8/tests/imp_res_insert.phpt | 152 -- ext/oci8/tests/imp_res_lob.phpt | 101 -- ext/oci8/tests/imp_res_prefetch.phpt | 185 --- ext/oci8/tests/lob_015.phpt | 2 +- ext/oci8/tests/lob_temp2.phpt | 40 - ext/oci8/tests/minfo.phpt | 6 +- ext/oci8/tests/password.phpt | 16 +- ext/oci8/tests/password_2.phpt | 16 +- ext/oci8/tests/password_new.phpt | 24 +- ext/oci8/tests/password_old.phpt | 24 +- ext/oci8/tests/refcur_prefetch_3.phpt | 20 +- ext/oci8/tests/reflection1.phpt | 8 - ext/odbc/config.m4 | 31 +- ext/odbc/php_odbc.c | 2 +- ext/opcache/Optimizer/block_pass.c | 86 +- ext/opcache/Optimizer/pass1_5.c | 52 - ext/opcache/Optimizer/zend_optimizer.c | 29 - ext/opcache/README | 4 - ext/opcache/ZendAccelerator.c | 20 +- ext/opcache/ZendAccelerator.h | 4 +- ext/opcache/config.m4 | 6 +- ext/opcache/tests/blacklist.inc | 3 - ext/opcache/tests/blacklist.phpt | 16 +- ext/opcache/tests/compact_literals.phpt | 4 +- ext/opcache/tests/opcache-2.blacklist | 5 - ext/opcache/zend_accelerator_blacklist.c | 146 +- ext/opcache/zend_accelerator_module.c | 33 - ext/opcache/zend_accelerator_util_funcs.c | 2 +- ext/openssl/config0.m4 | 2 +- ext/openssl/openssl.c | 7 +- ext/openssl/xp_ssl.c | 8 +- ext/pcntl/pcntl.c | 2 +- ext/pcntl/php_signal.c | 2 +- ext/pcntl/tests/pcntl_exec.phpt | 2 +- ext/pcntl/tests/pcntl_exec_2.phpt | 2 +- ext/pcre/php_pcre.c | 80 +- ext/pcre/tests/preg_grep_error1.phpt | 6 +- ext/pcre/tests/preg_match_all_error1.phpt | 6 +- ext/pcre/tests/preg_match_error1.phpt | 6 +- ext/pcre/tests/preg_replace_error1.phpt | 6 +- ext/pdo/pdo_dbh.c | 2 +- ext/pdo_dblib/dblib_driver.c | 16 +- ext/pdo_firebird/config.m4 | 2 +- ext/pdo_mysql/config.m4 | 6 +- ext/pdo_mysql/mysql_driver.c | 8 +- ext/pdo_mysql/pdo_mysql.c | 4 +- ext/pdo_mysql/php_pdo_mysql_int.h | 2 +- ext/pdo_mysql/tests/bug_44454.phpt | 2 + ext/pdo_mysql/tests/mysql_pdo_test.inc | 6 +- .../tests/pdo_mysql_exec_load_data.phpt | 1 - ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt | 5 +- ext/pdo_oci/config.m4 | 8 +- .../tests/pdo_oci_attr_autocommit_3.phpt | 2 +- ext/pdo_odbc/config.m4 | 32 +- ext/pdo_pgsql/config.m4 | 2 +- ext/pdo_pgsql/pgsql_statement.c | 2 +- ext/pdo_pgsql/tests/bug_33876.phpt | 2 +- ext/pdo_sqlite/config.m4 | 4 +- .../tests/pdo_sqlite_createfunction_002.phpt | 17 - ext/pgsql/config.m4 | 2 +- ext/pgsql/mysql_users.php | 2 +- ext/pgsql/pgsql.c | 211 +-- ext/pgsql/tests/00version.phpt | 30 - ext/pgsql/tests/09notice.phpt | 2 +- ext/pgsql/tests/10pg_convert.phpt | 12 +- ext/pgsql/tests/10pg_convert_9.phpt | 12 +- ext/pgsql/tests/12pg_insert.phpt | 4 +- ext/pgsql/tests/12pg_insert_9.phpt | 4 +- ext/pgsql/tests/13pg_select.phpt | 2 +- ext/pgsql/tests/13pg_select_9.phpt | 4 +- ext/pgsql/tests/14pg_update.phpt | 4 +- ext/pgsql/tests/14pg_update_9.phpt | 6 +- ext/pgsql/tests/80_bug14383.phpt | 2 +- ext/pgsql/tests/80_bug24499.phpt | 2 +- ext/pgsql/tests/80_bug32223.phpt | 6 +- ext/pgsql/tests/80_bug32223b.phpt | 4 +- ext/pgsql/tests/80_bug36625.phpt | 2 +- ext/pgsql/tests/80_bug39971.phpt | 2 +- ext/pgsql/tests/80_bug42783.phpt | 2 +- ext/pgsql/tests/bug47199.phpt | 4 +- ext/pgsql/tests/bug64609.phpt | 6 +- ext/pgsql/tests/config.inc | 6 +- ext/pgsql/tests/pg_delete_001.phpt | 4 +- ext/pgsql/tests/pg_insert_001.phpt | 2 +- ext/pgsql/tests/pg_update_001.phpt | 4 +- ext/phar/Makefile.frag | 4 - ext/phar/config.m4 | 2 - ext/phar/dirstream.c | 16 +- ext/phar/dirstream.h | 8 +- ext/phar/phar.1.in | 523 ------- ext/phar/phar.c | 45 +- ext/phar/phar.phar.1.in | 1 - ext/phar/phar_internal.h | 9 +- ext/phar/stream.c | 18 +- ext/phar/stream.h | 10 +- ext/phar/tests/bug65028.phpt | 156 -- ext/phar/tests/phpinfo_004.phpt | 30 +- ext/phar/util.c | 6 +- ext/posix/tests/posix_ctermid.phpt | 2 +- ext/pspell/config.m4 | 2 +- ext/readline/config.m4 | 4 +- ext/recode/config.m4 | 2 +- ext/reflection/php_reflection.c | 155 +- ...flectionExtension_getClassNames_basic.phpt | 2 +- ext/session/mod_files.c | 94 +- ext/session/mod_files.h | 2 +- ext/session/mod_mm.c | 59 +- ext/session/mod_user.c | 1 + ext/session/php_session.h | 13 +- ext/session/session.c | 264 +--- ext/session/tests/003.phpt | 1 - ext/session/tests/004.phpt | 1 - ext/session/tests/005.phpt | 1 - ext/session/tests/006.phpt | 1 - ext/session/tests/009.phpt | 1 - ext/session/tests/012.phpt | 1 - ext/session/tests/013.phpt | 1 - ext/session/tests/014.phpt | 1 - ext/session/tests/015.phpt | 1 - ext/session/tests/016.phpt | 7 +- ext/session/tests/018.phpt | 1 - ext/session/tests/019.phpt | 1 - ext/session/tests/020.phpt | 3 +- ext/session/tests/021.phpt | 1 - ext/session/tests/023.phpt | 1 - ext/session/tests/024.phpt | 1 - ext/session/tests/025.phpt | 1 - ext/session/tests/026.phpt | 1 - ext/session/tests/027.phpt | 1 - ext/session/tests/030.phpt | 1 - ext/session/tests/bug41600.phpt | 1 - ext/session/tests/bug50308.phpt | 30 - ext/session/tests/bug60634.phpt | 3 +- ext/session/tests/bug60634_error_1.phpt | 3 +- ext/session/tests/bug60634_error_2.phpt | 7 +- ext/session/tests/bug60634_error_3.phpt | 3 +- ext/session/tests/bug60634_error_4.phpt | 7 +- ext/session/tests/rfc1867_sid_invalid.phpt | 10 - ext/session/tests/session_abort_basic.phpt | 51 - .../tests/session_commit_variation4.phpt | 2 - ext/session/tests/session_gc_basic.phpt | 56 - .../tests/session_hash_function_basic.phpt | 50 - ext/session/tests/session_reset_basic.phpt | 49 - .../tests/session_save_path_variation2.phpt | 2 +- .../tests/session_save_path_variation5.phpt | 3 +- .../tests/session_serializer_name_basic.phpt | 37 - .../tests/session_set_save_handler_basic.phpt | 3 +- .../session_set_save_handler_class_003.phpt | 5 +- .../session_set_save_handler_class_007.phpt | 3 +- .../session_set_save_handler_closures.phpt | 7 +- .../session_set_save_handler_error2.phpt | 2 - .../session_set_save_handler_error3.phpt | 1 + .../session_set_save_handler_error4.phpt | 1 + ..._set_save_handler_write_short_circuit.phpt | 104 -- .../tests/session_status_disabled.phpt | 2 +- .../tests/session_write_close_variation4.phpt | 2 - ext/simplexml/config.m4 | 3 +- ext/simplexml/config.w32 | 1 - ext/skeleton/php_skeleton.h | 9 + ext/skeleton/skeleton.c | 117 +- ext/snmp/config.m4 | 2 +- ext/soap/config.m4 | 2 +- ext/soap/interop/client_round2_interop.php | 4 +- ext/soap/interop/index.php | 2 +- ext/soap/php_http.c | 2 +- ext/soap/php_schema.c | 54 +- ext/soap/soap.c | 99 +- ext/soap/tests/bugs/bug28985.phpt | 6 +- ext/soap/tests/bugs/bug28985.wsdl | 2 +- ext/soap/tests/bugs/bug65018.phpt | 28 - ext/sockets/conversions.c | 37 +- ext/sockets/sockets.c | 25 +- ext/sockets/tests/socket_abstract_path.phpt | 44 - .../tests/socket_abstract_path_sendmsg.phpt | 40 - ext/sockets/tests/socket_cmsg_rights.phpt | 1 - ext/spl/internal/iteratoriterator.inc | 2 +- ext/spl/internal/multipleiterator.inc | 4 +- ext/spl/internal/splobjectstorage.inc | 2 +- ext/spl/php_spl.c | 42 +- ext/spl/php_spl.h | 7 +- ext/spl/spl.php | 4 +- ext/spl/spl_array.c | 26 +- ext/spl/spl_directory.c | 74 +- ext/spl/spl_directory.h | 10 +- ext/spl/spl_dllist.c | 6 +- ext/spl/spl_engine.c | 2 +- ext/spl/spl_functions.c | 2 +- ext/spl/spl_functions.h | 2 +- ext/spl/spl_heap.c | 2 +- ext/spl/spl_iterators.c | 93 +- ext/spl/spl_iterators.h | 2 +- ext/spl/spl_observer.c | 26 +- ...SplFileObject_fgetcsv_delimiter_basic.phpt | 2 +- ...SplFileObject_fgetcsv_delimiter_error.phpt | 2 +- ...SplFileObject_fgetcsv_enclosure_basic.phpt | 2 +- ...SplFileObject_fgetcsv_enclosure_error.phpt | 2 +- .../SplFileObject_fgetcsv_escape_basic.phpt | 2 +- .../SplFileObject_fgetcsv_escape_error.phpt | 2 +- .../tests/SplFileObject_rewind_error001.phpt | 4 - ext/spl/tests/bug61697.phpt | 2 + ext/spl/tests/bug63680.phpt | 2 - ext/spl/tests/bug65328.phpt | 348 ----- .../recursive_tree_iterator_setpostfix.phpt | 88 -- ..._priorityqeue_insert_two_params_error.phpt | 2 +- ext/sqlite3/config0.m4 | 2 +- ext/sqlite3/libsqlite/sqlite3.c | 42 +- ext/sqlite3/php_sqlite3_structs.h | 2 +- ext/standard/array.c | 109 +- ext/standard/assert.c | 10 +- ext/standard/base64.c | 14 +- ext/standard/base64.h | 6 +- ext/standard/basic_functions.c | 132 +- ext/standard/basic_functions.h | 4 +- ext/standard/browscap.c | 56 +- ext/standard/config.m4 | 24 +- ext/standard/crypt_freesec.h | 17 +- ext/standard/crypt_sha256.c | 6 + ext/standard/crypt_sha512.c | 6 + ext/standard/css.c | 31 +- ext/standard/css.h | 4 +- ext/standard/dir.c | 24 +- ext/standard/dl.c | 2 +- ext/standard/dns.c | 24 +- ext/standard/exec.c | 37 +- ext/standard/file.c | 185 ++- ext/standard/file.h | 14 +- ext/standard/filestat.c | 36 +- ext/standard/filters.c | 16 +- ext/standard/formatted_print.c | 70 +- ext/standard/ftp_fopen_wrapper.c | 28 +- ext/standard/head.c | 6 +- ext/standard/head.h | 2 +- ext/standard/html.c | 84 +- ext/standard/http.c | 21 +- ext/standard/http_fopen_wrapper.c | 55 +- ext/standard/image.c | 2 +- ext/standard/incomplete_class.c | 12 +- ext/standard/info.c | 90 +- ext/standard/info.h | 16 +- ext/standard/link.c | 18 +- ext/standard/mail.c | 4 +- ext/standard/math.c | 28 +- ext/standard/md5.c | 10 +- ext/standard/pack.c | 39 +- ext/standard/password.c | 12 +- ext/standard/php_filestat.h | 8 +- ext/standard/php_fopen_wrapper.c | 3 +- ext/standard/php_fopen_wrappers.h | 4 +- ext/standard/php_http.h | 6 +- ext/standard/php_incomplete_class.h | 6 +- ext/standard/php_smart_str.h | 9 +- ext/standard/php_smart_str_public.h | 4 +- ext/standard/php_string.h | 44 +- ext/standard/php_uuencode.h | 4 +- ext/standard/proc_open.c | 14 +- ext/standard/streamsfuncs.c | 54 +- ext/standard/string.c | 641 ++++----- .../tests/array/array_column_basic.phpt | 4 +- .../array/array_count_values_variation.phpt | 4 +- .../array/array_key_exists_variation2.phpt | 2 +- .../tests/array/array_search_variation4.phpt | 2 +- .../tests/array/array_values_variation7.phpt | 2 +- ext/standard/tests/array/bug34066.phpt | 4 +- ext/standard/tests/array/bug34066_1.phpt | 4 +- ext/standard/tests/array/bug65304.phpt | 10 - .../tests/array/in_array_variation4.phpt | 2 +- ext/standard/tests/array/uasort_object2.phpt | 2 +- .../tests/array/uasort_variation10.phpt | 2 +- .../tests/array/uasort_variation4.phpt | 2 +- ext/standard/tests/file/bug41874.phpt | 4 +- ext/standard/tests/file/bug41874_2.phpt | 2 +- ext/standard/tests/file/bug41874_3.phpt | 2 +- .../tests/file/chmod_basic-win32.phpt | 2 +- ext/standard/tests/file/chmod_basic.phpt | 2 +- ext/standard/tests/file/file.inc | 4 +- ext/standard/tests/file/lchown_error.phpt | 2 +- .../tests/file/symlink_to_symlink.phpt | 6 +- ext/standard/tests/file/userstreams.phpt | 2 +- .../general_functions/dl-cve-2007-4887.phpt | 7 - .../tests/mail/ezmlm_hash_variation1.phpt | 10 +- .../tests/network/ip2long_variation2_x64.phpt | 14 +- ext/standard/tests/strings/bug38322.phpt | 2 +- ext/standard/tests/strings/bug47322.phpt | 2 +- ext/standard/tests/strings/explode_error.phpt | 4 +- .../tests/strings/explode_variation1.phpt | 10 +- .../tests/strings/explode_variation2.phpt | 4 +- .../tests/strings/explode_variation3.phpt | 6 +- ext/standard/tests/strings/implode1.phpt | Bin 5875 -> 5876 bytes ext/standard/tests/strings/lcfirst.phpt | Bin 6878 -> 6877 bytes ext/standard/tests/strings/str_replace.phpt | 2 +- .../tests/strings/str_replace_variation3.phpt | 2 +- ext/standard/tests/strings/strcasecmp.phpt | Bin 22269 -> 22268 bytes ext/standard/tests/strings/strcmp.phpt | Bin 20035 -> 20034 bytes ext/standard/tests/strings/strlen.phpt | Bin 7091 -> 7090 bytes ext/standard/tests/strings/strpos.phpt | Bin 9982 -> 9981 bytes ext/standard/tests/strings/strrchr_basic.phpt | 2 +- ext/standard/tests/strings/strstr.phpt | Bin 10531 -> 10530 bytes .../tests/strings/substr_replace_error.phpt | 4 +- ext/standard/tests/strings/ucfirst.phpt | Bin 6106 -> 6105 bytes .../tests/url/parse_url_basic_001.phpt | 11 +- .../tests/url/parse_url_basic_002.phpt | 4 +- .../tests/url/parse_url_basic_003.phpt | 4 +- .../tests/url/parse_url_basic_004.phpt | 4 +- .../tests/url/parse_url_basic_005.phpt | 4 +- .../tests/url/parse_url_basic_006.phpt | 4 +- .../tests/url/parse_url_basic_007.phpt | 4 +- .../tests/url/parse_url_basic_008.phpt | 4 +- .../tests/url/parse_url_basic_009.phpt | 4 +- ext/standard/tests/url/urls.inc | 4 +- ext/standard/type.c | 6 +- ext/standard/uniqid.c | 5 +- ext/standard/url.c | 44 +- ext/standard/url.h | 10 +- ext/standard/url_scanner_ex.c | 408 +++--- ext/standard/url_scanner_ex.h | 2 +- ext/standard/url_scanner_ex.re | 12 +- ext/standard/user_filters.c | 22 +- ext/standard/uuencode.c | 25 +- ext/standard/var.c | 68 +- ext/standard/var_unserializer.c | 6 +- ext/standard/var_unserializer.re | 6 +- ext/standard/versioning.c | 6 +- ext/sybase_ct/config.m4 | 2 +- ext/sybase_ct/php_sybase_ct.c | 8 +- ext/sybase_ct/tests/bug26407.phpt | 2 +- ext/sybase_ct/tests/bug43578.phpt | 2 +- ext/sybase_ct/tests/test_fetch_object.phpt | 2 +- ext/sybase_ct/tests/test_msghandler.phpt | 4 +- ext/tidy/config.m4 | 2 +- ext/tidy/tidy.c | 2 +- ext/wddx/config.m4 | 4 +- ext/xml/config.m4 | 4 +- ext/xml/tests/bug65236.phpt | 15 - ext/xml/xml.c | 90 +- ext/xmlreader/config.m4 | 2 +- ext/xmlrpc/config.m4 | 8 +- ext/xmlrpc/libxmlrpc/xml_to_soap.c | 2 +- ext/xmlrpc/xmlrpc-epi-php.c | 4 +- ext/xmlwriter/config.m4 | 2 +- ext/xmlwriter/tests/bug41287.phpt | 2 +- ext/xsl/config.m4 | 2 +- ext/zip/config.m4 | 2 +- ext/zip/lib/zipconf.h | 6 +- ext/zip/php_zip.h | 4 +- ext/zip/zip_stream.c | 6 +- ext/zlib/config0.m4 | 2 +- ext/zlib/php_zlib.h | 2 +- ext/zlib/tests/bug65391.phpt | 27 - ext/zlib/zlib.c | 6 +- ext/zlib/zlib_fopen_wrapper.c | 2 +- main/SAPI.c | 16 +- main/SAPI.h | 17 +- main/fopen_wrappers.c | 6 +- main/fopen_wrappers.h | 2 +- main/main.c | 40 +- main/network.c | 12 +- main/output.c | 60 +- main/php.h | 6 +- main/php_ini.c | 60 +- main/php_ini.h | 6 +- main/php_network.h | 14 +- main/php_output.h | 42 +- main/php_stdint.h | 206 --- main/php_streams.h | 44 +- main/php_variables.c | 52 +- main/php_variables.h | 2 +- main/rfc1867.c | 54 +- main/snprintf.c | 15 +- main/snprintf.h | 12 +- main/spprintf.c | 11 +- main/spprintf.h | 6 +- main/streams/cast.c | 2 +- main/streams/filter.c | 2 +- main/streams/glob_wrapper.c | 14 +- main/streams/memory.c | 11 +- main/streams/php_stream_glob_wrapper.h | 4 +- main/streams/php_stream_plain_wrapper.h | 2 +- main/streams/php_stream_transport.h | 30 +- main/streams/plain_wrapper.c | 45 +- main/streams/streams.c | 70 +- main/streams/transports.c | 22 +- main/streams/userspace.c | 68 +- main/streams/xp_socket.c | 44 +- php.ini-development | 10 +- php.ini-production | 10 +- sapi/apache/config.m4 | 8 +- sapi/apache2filter/config.m4 | 2 +- sapi/apache2handler/config.m4 | 4 +- sapi/apache_hooks/config.m4 | 4 +- sapi/caudium/config.m4 | 2 +- sapi/cgi/Makefile.frag | 4 - sapi/cgi/cgi_main.c | 2 +- sapi/cgi/config9.m4 | 2 - sapi/cgi/php-cgi.1.in | 1 - sapi/cli/cli.h | 6 +- sapi/cli/php.1.in | 24 +- sapi/cli/php_cli.c | 29 +- sapi/cli/php_cli_server.c | 10 +- sapi/cli/php_http_parser.h | 6 +- sapi/cli/tests/php_cli_server.inc | 6 +- sapi/cli/tests/upload_2G.phpt | 99 -- sapi/embed/config.m4 | 2 +- sapi/fpm/config.m4 | 8 +- sapi/fpm/fpm/fastcgi.c | 2 +- sapi/fpm/php-fpm.conf.in | 4 +- sapi/isapi/config.m4 | 2 +- sapi/litespeed/README | 2 +- sapi/milter/config.m4 | 2 +- sapi/pi3web/config.m4 | 2 +- sapi/roxen/config.m4 | 2 +- scripts/Makefile.frag | 2 +- scripts/dev/conv_proto | 30 + scripts/dev/conv_z_macros | 61 + scripts/dev/extern_c.php | 45 + scripts/dev/generate-phpt.phar | Bin 52356 -> 52354 bytes .../generate-phpt/src/testcase/gtTestCase.php | 2 +- .../testcase/gtVariationContainerFunction.php | 2 +- tests/basic/bug45986.phpt | 2 +- tests/classes/static_properties_004.phpt | 4 +- travis/compile.sh | 6 +- win32/build/config.w32 | 6 - win32/build/mkdist.php | 2 + win32/install.txt | 21 +- win32/pws-php5cgi.reg | 6 + win32/pws-php5isapi.reg | 5 + win32/registry.c | 4 +- win32/select.c | 6 +- win32/sendmail.c | 2 +- win32/time.h | 2 - win32/winutil.c | 2 +- win32/winutil.h | 2 +- 729 files changed, 6513 insertions(+), 16942 deletions(-) create mode 100644 README.EXTENSIONS create mode 100644 README.PHP4-TO-PHP5-THIN-CHANGES delete mode 100644 Zend/tests/bug65254.phpt delete mode 100644 Zend/tests/bug65291.phpt delete mode 100644 Zend/tests/bug65372.phpt delete mode 100644 ext/date/tests/bug65184.phpt delete mode 100644 ext/dom/tests/DOMDocument_loadXML_basic.phpt delete mode 100644 ext/dom/tests/DOMDocument_loadXML_error1.phpt delete mode 100644 ext/dom/tests/DOMDocument_loadXML_error2.phpt delete mode 100644 ext/dom/tests/DOMDocument_loadXML_error3.phpt delete mode 100644 ext/dom/tests/DOMDocument_loadXML_error4.phpt delete mode 100644 ext/dom/tests/DOMDocument_loadXML_error5.phpt delete mode 100644 ext/dom/tests/DOMDocument_loadXML_variation1.phpt delete mode 100644 ext/dom/tests/DOMDocument_loadXML_variation2.phpt delete mode 100644 ext/dom/tests/DOMDocument_loadXML_variation3.phpt delete mode 100644 ext/dom/tests/DOMDocument_loadXML_variation4.phpt delete mode 100644 ext/dom/tests/DOMDocument_load_basic.phpt delete mode 100644 ext/dom/tests/DOMDocument_load_error1.phpt delete mode 100644 ext/dom/tests/DOMDocument_load_error2.phpt delete mode 100644 ext/dom/tests/DOMDocument_load_error3.phpt delete mode 100644 ext/dom/tests/DOMDocument_load_error4.phpt delete mode 100644 ext/dom/tests/DOMDocument_load_error5.phpt delete mode 100644 ext/dom/tests/DOMDocument_load_variation1.phpt delete mode 100644 ext/dom/tests/DOMDocument_load_variation2.phpt delete mode 100644 ext/dom/tests/DOMDocument_load_variation3.phpt delete mode 100644 ext/dom/tests/DOMDocument_load_variation4.phpt delete mode 100644 ext/dom/tests/DOMDocument_schemaValidateSource_addAttrs.phpt delete mode 100644 ext/dom/tests/DOMDocument_schemaValidateSource_missingAttrs.phpt delete mode 100644 ext/dom/tests/DOMDocument_schemaValidate_addAttrs.phpt delete mode 100644 ext/dom/tests/DOMDocument_schemaValidate_missingAttrs.phpt delete mode 100644 ext/dom/tests/book-attr.xml delete mode 100644 ext/dom/tests/book_with_dtd.xml delete mode 100644 ext/dom/tests/book_with_dtd2.xml delete mode 100644 ext/dom/tests/books.dtd delete mode 100644 ext/dom/tests/domdocumentload_test_method.php delete mode 100644 ext/dom/tests/domdocumentload_test_method_savexml.php delete mode 100644 ext/dom/tests/domdocumentload_utilities.php delete mode 100644 ext/dom/tests/domdocumentloadxml_test_method.php delete mode 100644 ext/dom/tests/domdocumentloadxml_test_method_savexml.php delete mode 100644 ext/dom/tests/not_well_formed.xml delete mode 100644 ext/dom/tests/not_well_formed2.xml delete mode 100644 ext/dom/tests/not_well_formed3.xml delete mode 100644 ext/dom/tests/not_well_formed4.xml delete mode 100644 ext/dom/tests/not_well_formed5.xml delete mode 100644 ext/dom/tests/wrong_book_with_dtd.xml delete mode 100644 ext/dom/tests/wrong_book_with_dtd2.xml delete mode 100644 ext/ftp/tests/filesize_large.phpt delete mode 100644 ext/ftp/tests/ftp_nb_get_large.phpt create mode 100644 ext/hash/php_hash_types.h delete mode 100644 ext/intl/tests/calendar_const_field_field_count.phpt delete mode 100644 ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt delete mode 100644 ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt delete mode 100644 ext/mysqli/tests/mysqli_stmt_big_prepare.phpt delete mode 100644 ext/oci8/oci8_dtrace.d delete mode 100644 ext/oci8/tests/imp_res_1.phpt delete mode 100644 ext/oci8/tests/imp_res_2.phpt delete mode 100644 ext/oci8/tests/imp_res_3.phpt delete mode 100644 ext/oci8/tests/imp_res_4.phpt delete mode 100644 ext/oci8/tests/imp_res_5.phpt delete mode 100644 ext/oci8/tests/imp_res_6.phpt delete mode 100644 ext/oci8/tests/imp_res_7.phpt delete mode 100644 ext/oci8/tests/imp_res_call_error.phpt delete mode 100644 ext/oci8/tests/imp_res_cancel.phpt delete mode 100644 ext/oci8/tests/imp_res_close.phpt delete mode 100644 ext/oci8/tests/imp_res_cursor.phpt delete mode 100644 ext/oci8/tests/imp_res_dbmsoutput.phpt delete mode 100644 ext/oci8/tests/imp_res_field.phpt delete mode 100644 ext/oci8/tests/imp_res_func_error.phpt delete mode 100644 ext/oci8/tests/imp_res_get_1.phpt delete mode 100644 ext/oci8/tests/imp_res_get_2.phpt delete mode 100644 ext/oci8/tests/imp_res_get_3.phpt delete mode 100644 ext/oci8/tests/imp_res_get_4.phpt delete mode 100644 ext/oci8/tests/imp_res_get_5.phpt delete mode 100644 ext/oci8/tests/imp_res_get_all.phpt delete mode 100644 ext/oci8/tests/imp_res_get_cancel.phpt delete mode 100644 ext/oci8/tests/imp_res_get_close_1.phpt delete mode 100644 ext/oci8/tests/imp_res_get_close_2.phpt delete mode 100644 ext/oci8/tests/imp_res_get_close_3.phpt delete mode 100644 ext/oci8/tests/imp_res_get_cursor.phpt delete mode 100644 ext/oci8/tests/imp_res_get_dbmsoutput.phpt delete mode 100644 ext/oci8/tests/imp_res_get_exec.phpt delete mode 100644 ext/oci8/tests/imp_res_get_none.phpt delete mode 100644 ext/oci8/tests/imp_res_insert.phpt delete mode 100644 ext/oci8/tests/imp_res_lob.phpt delete mode 100644 ext/oci8/tests/imp_res_prefetch.phpt delete mode 100644 ext/oci8/tests/lob_temp2.phpt delete mode 100644 ext/opcache/tests/blacklist.inc delete mode 100644 ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt delete mode 100644 ext/pgsql/tests/00version.phpt delete mode 100644 ext/phar/phar.1.in delete mode 100644 ext/phar/phar.phar.1.in delete mode 100644 ext/phar/tests/bug65028.phpt delete mode 100644 ext/session/tests/bug50308.phpt delete mode 100644 ext/session/tests/session_abort_basic.phpt delete mode 100644 ext/session/tests/session_gc_basic.phpt delete mode 100644 ext/session/tests/session_hash_function_basic.phpt delete mode 100644 ext/session/tests/session_reset_basic.phpt delete mode 100644 ext/session/tests/session_serializer_name_basic.phpt delete mode 100644 ext/session/tests/session_set_save_handler_write_short_circuit.phpt delete mode 100644 ext/soap/tests/bugs/bug65018.phpt delete mode 100644 ext/sockets/tests/socket_abstract_path.phpt delete mode 100644 ext/sockets/tests/socket_abstract_path_sendmsg.phpt delete mode 100644 ext/spl/tests/bug65328.phpt delete mode 100644 ext/spl/tests/recursive_tree_iterator_setpostfix.phpt delete mode 100644 ext/standard/tests/array/bug65304.phpt delete mode 100644 ext/xml/tests/bug65236.phpt delete mode 100644 ext/zlib/tests/bug65391.phpt delete mode 100644 main/php_stdint.h delete mode 100644 sapi/cgi/php-cgi.1.in delete mode 100644 sapi/cli/tests/upload_2G.phpt create mode 100755 scripts/dev/conv_proto create mode 100755 scripts/dev/conv_z_macros create mode 100644 scripts/dev/extern_c.php create mode 100644 win32/pws-php5cgi.reg create mode 100644 win32/pws-php5isapi.reg diff --git a/CODING_STANDARDS b/CODING_STANDARDS index 16ec36b681307..7413be453ca6b 100644 --- a/CODING_STANDARDS +++ b/CODING_STANDARDS @@ -259,10 +259,7 @@ The file labelled 'EXPERIMENTAL' should include the following information:: Any authoring information (known bugs, future directions of the module). - Ongoing status notes which may not be appropriate for Git comments. - -In general new features should go to PECL or experimental branches until -there are specific reasons for directly adding it to the core distribution. + Ongoing status notes which may not be appropriate for SVN comments. Aliases & Legacy Documentation ----------------------------------- diff --git a/INSTALL b/INSTALL index 141e4f8312f63..c0cbe5f2c15c1 100644 --- a/INSTALL +++ b/INSTALL @@ -1819,7 +1819,7 @@ Installation set of HTTP headers. The headers it did return are: 10. Windows: I've followed all the instructions, but still can't get PHP and IIS to work together! - 11. When running PHP as CGI with IIS, OmniHTTPD or Xitami, I get + 11. When running PHP as CGI with IIS, PWS, OmniHTTPD or Xitami, I get the following error: Security Alert! PHP CGI cannot be accessed directly.. 12. How do I know if my php.ini is being found and read? It seems like @@ -2007,7 +2007,7 @@ cgi error: And for IIS4 you need to tell it that PHP is a script engine. Also, you will want to read this faq. - When running PHP as CGI with IIS, OmniHTTPD or Xitami, I get the + When running PHP as CGI with IIS, PWS, OmniHTTPD or Xitami, I get the following error: Security Alert! PHP CGI cannot be accessed directly.. You must set the cgi.force_redirect directive to 0. It defaults diff --git a/Makefile.global b/Makefile.global index bd82daf4d891e..5118de83fe453 100644 --- a/Makefile.global +++ b/Makefile.global @@ -10,7 +10,7 @@ all: $(all_targets) @echo "Build complete." @echo "Don't forget to run 'make test'." @echo - + build-modules: $(PHP_MODULES) $(PHP_ZEND_EX) build-binaries: $(PHP_BINARIES) @@ -115,19 +115,10 @@ clean: find . -name \*.la -o -name \*.a | xargs rm -f find . -name \*.so | xargs rm -f find . -name .libs -a -type d|xargs rm -rf - rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_MILTER_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/* + rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/* distclean: clean - rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module sapi/apache_hooks/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h - rm -f php5.spec main/build-defs.h scripts/phpize - rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak - rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 ext/phar/phar.1 ext/phar/phar.phar.1 - rm -f sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html - rm -f ext/iconv/php_have_bsd_iconv.h ext/iconv/php_have_glibc_iconv.h ext/iconv/php_have_ibm_iconv.h ext/iconv/php_have_iconv.h ext/iconv/php_have_libiconv.h ext/iconv/php_iconv_aliased_libiconv.h ext/iconv/php_iconv_supports_errno.h ext/iconv/php_php_iconv_h_path.h ext/iconv/php_php_iconv_impl.h - rm -f ext/phar/phar.phar ext/phar/phar.php - if test "$(srcdir)" != "$(builddir)"; then \ - rm -f ext/phar/phar/phar.inc; \ - fi + rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp $(EGREP) define'.*include/php' $(top_srcdir)/configure | $(SED) 's/.*>//'|xargs rm -f .PHONY: all clean install distclean test diff --git a/NEWS b/NEWS index 0c94ea23e12c7..076a0c181929f 100644 --- a/NEWS +++ b/NEWS @@ -7,19 +7,6 @@ PHP NEWS . Implemented internal operator overloading (RFC: https://wiki.php.net/rfc/operator_overloading_gmp). (Nikita) -- Session: - . Fixed Bug #65315 (session.hash_function silently fallback to default md5) - (Yasuo) - . Implemented Request #54649 (Create session_serializer_name()). (Yasuo) - . Implemented Request #17860 (Session write short circuit). (Yasuo) - . Implemented Request #20421 (session_abort() and session_reset() function). - (Yasuo) - . Implemented Request #11100 (session_gc() function). (Yasuo) - -- mysqlnd: - . Disabled flag for SP OUT variables for 5.5+ servers as they are not natively - supported by the overlying APIs. (Andrey) - - OPcache: . Added an optimization pass to convert FCALL_BY_NAME into DO_FCALL. (Laruence, Dmitry) diff --git a/README.EXTENSIONS b/README.EXTENSIONS new file mode 100644 index 0000000000000..51e3b730e7de7 --- /dev/null +++ b/README.EXTENSIONS @@ -0,0 +1,39 @@ +Between PHP 4.0.6 and 4.1.0, the Zend module struct changed in a way +that broke both source and binary compatibility. If you are +maintaining a third party extension, here's how to update it: + +If this was your old module entry: + +zend_module_entry foo_module_entry = { + "foo", /* extension name */ + foo_functions, /* extension function list */ + NULL, /* extension-wide startup function */ + NULL, /* extension-wide shutdown function */ + PHP_RINIT(foo), /* per-request startup function */ + PHP_RSHUTDOWN(foo), /* per-request shutdown function */ + PHP_MINFO(foo), /* information function */ + STANDARD_MODULE_PROPERTIES +}; + +Here's how it should look if you want your code to build with PHP +4.1.0 and up: + +zend_module_entry foo_module_entry = { +#if ZEND_MODULE_API_NO >= 20010901 + STANDARD_MODULE_HEADER, +#endif + "foo", /* extension name */ + foo_functions, /* extension function list */ + NULL, /* extension-wide startup function */ + NULL, /* extension-wide shutdown function */ + PHP_RINIT(foo), /* per-request startup function */ + PHP_RSHUTDOWN(foo), /* per-request shutdown function */ + PHP_MINFO(foo), /* information function */ +#if ZEND_MODULE_API_NO >= 20010901 + FOO_VERSION, /* extension version number (string) */ +#endif + STANDARD_MODULE_PROPERTIES +}; + +If you don't care about source compatibility with earlier PHP releases +than 4.1.0, you can drop the #if/#endif lines. diff --git a/README.PHP4-TO-PHP5-THIN-CHANGES b/README.PHP4-TO-PHP5-THIN-CHANGES new file mode 100644 index 0000000000000..0a2c6d6657131 --- /dev/null +++ b/README.PHP4-TO-PHP5-THIN-CHANGES @@ -0,0 +1,155 @@ +1. strrpos() and strripos() now use the entire string as a needle. Be aware + that the existing scripts may no longer work as you expect. + + EX : + + + Will give you different results. The former returns 3 while the latter + returns false rather than the position of the last occurrence of 'D'. + The same applies to strripos(). + +2. Illegal use of string offsets causes E_ERROR instead of E_WARNING. + + EX : + + + Fatal error: Cannot use string offset as an array in ... on line 1 + +3. array_merge() was changed to accept only arrays. If a non-array variable is + passed, a E_WARNING will be thrown for every such parameter. Be careful + because your code may start emitting E_WARNING out of the blue. + +4. Be careful when porting from ext/mysql to ext/mysqli. The following + functions return NULL when no more data is available in the result set + (ext/mysql's functions return FALSE). + + - mysqli_fetch_row() + - mysqli_fetch_array() + - mysqli_fetch_assoc() + +5. PATH_TRANSLATED server variable is no longer set implicitly under + Apache2 SAPI in contrast to the situation in PHP 4, where it is set to the + same value as the SCRIPT_FILENAME server variable when it is not populated + by Apache. This change was made to comply with the CGI specification. + Please refer to bug #23610 for further information. + +6. Starting PHP 5.0.0 the T_ML_CONSTANT constant is no longer defined by the + ext/tokenizer extension. If error_reporting is set to E_ALL notices will + be produced. Instead of T_ML_CONSTANT for /* */ the T_COMMENT constant + is used, thus both // and /* */ are resolved as the T_COMMENT constant. + However the PHPDoc style comments /** */ ,which starting PHP 5 are parsed + by PHP, are recongnized as T_DOC_COMMENT. + +7. $_SERVER should be populated with argc and argv if variables_order + includes "S". If you have specifically configured your system to not + create $_SERVER, then of course it shouldn't be there. The change was to + always make argc and argv available in the CLI version regardless of the + variables_order setting. As in, the CLI version will now always populate + the global $argc and $argv variables. + +8. In some cases classes must be declared before used. It only happens only + if some of the new features of PHP 5 are used. Otherwise the behaviour is + the old. + Example 1 (works with no errors): + + + Example 2 (throws an error): + + + Output (example 2) : + Fatal error: Class 'a' not found in /tmp/cl.php on line 2 + +9. get_class() starting PHP 5 returns the name of the class as it was + declared which may lead to problems in older scripts that rely on + the previous behaviour - the class name is lowercased. Expect the + same behaviour from get_parent_class() when applicable. + Example : + + + Output (PHP 4): + string(6) "foobar" + string(9) "extfoobar" + + Output (PHP 5): + string(6) "FooBar" + string(9) "ExtFooBar" + ---------------------------------------------------------------------- + Example code that will break : + //.... + function someMethod($p) { + if (get_class($p) != 'helpingclass') { + return FALSE; + } + //... + } + //... + Possible solution is to search for get_class() and get_parent_class() in + all your scripts and use strtolower(). + +10. get_class_methods() returns the names of the methods of a class as they + declared. In PHP4 the names are all lowercased. + Example code : + + Output (PHP4): + array(2) { + [0]=> + string(5) "dofoo" + [1]=> + string(6) "hasfoo" + } + Output (PHP5): + array(2) { + [0]=> + string(5) "doFoo" + [1]=> + string(6) "hasFoo" + } + +11. Assignment $this is impossible. Starting PHP 5.0.0 $this has special + meaning in class methods and is recognized by the PHP parser. The latter + will generate a parse error when assignment to $this is found + Example code : + assignNew($b); + echo "I was executed\n"; + ?> + Output (PHP 4): + I was executed + Output (PHP 5): + PHP Fatal error: Cannot re-assign $this in /tmp/this_ex.php on line 4 + diff --git a/README.STREAMS b/README.STREAMS index 0046e6a75438d..f625406a3bae6 100644 --- a/README.STREAMS +++ b/README.STREAMS @@ -46,7 +46,7 @@ Opening Streams =============== In most cases, you should use this API: -PHPAPI php_stream *php_stream_open_wrapper(const char *path, const char *mode, +PHPAPI php_stream *php_stream_open_wrapper(char *path, char *mode, int options, char **opened_path TSRMLS_DC); Where: diff --git a/README.SUBMITTING_PATCH b/README.SUBMITTING_PATCH index d1b74bd18d996..63b7156f100b2 100644 --- a/README.SUBMITTING_PATCH +++ b/README.SUBMITTING_PATCH @@ -5,7 +5,7 @@ This document describes how to submit an enhancement or patch for PHP. It's easy! You don't need any login accounts or special access to download, -build, debug and begin submitting PHP or PECL code, tests or +build, debug and begin submitting PHP, PECL or PEAR code, tests or documentation. Once you've followed this README and had several patches accepted, commit privileges are often quickly granted. @@ -16,8 +16,8 @@ http://phpadvent.org/2008/less-whining-more-coding-by-elizabeth-smith Online Forums ------------- There are several IRC channels where PHP developers are often -available to discuss questions. They include #php.pecl and #php.doc -on the EFNet network and #php-dev-win on FreeNode. +available to discuss questions. They include #php.pecl, #php.doc and +#pear on the EFNet network and #php-dev-win on FreeNode. PHP Patches @@ -78,7 +78,7 @@ of type 'text/*' are accepted. PECL Extension Patches: http://pecl.php.net/ -------------------------------------------- If you are fixing broken functionality in a PECL extension then create -a bug or identify an existing bug at http://bugs.php.net/. A bug +a bug or identify an existing bug at http://pecl.php.net/bugs/. A bug can be used to track the patch progress and prevent your changes getting lost in the PHP mail archives. @@ -114,15 +114,15 @@ http://pear.php.net/manual/en/guide-developers.php How to create your PHP, PHP Documentation or PECL patch ------------------------------------------------------- -PHP and most PECL packages use Git for revision control. Some PECL -packages use Subversion (SVN) Read http://www.php.net/git.php for help -on using Git to get and build PHP source code. We recommend to look -at our workflow on https://wiki.php.net/vcs/gitworkflow and our FAQ -https://wiki.php.net/vcs/gitfaq. +PHP and PECL use Subversion (SVN) for revision control. Read +http://www.php.net/svn.php for help on using SVN to get and build PHP +source code. We recommend using a Sparse Directory checkout described +in http://wiki.php.net/vcs/svnfaq. If you are new to SVN, read +http://svnbook.red-bean.com. Generally we ask that bug fix patches work on the current stable PHP -development branches and on "master". New PHP features only need to -work on "master". +development branches and on "trunk". New PHP features only need to +work on "trunk". Read CODING_STANDARDS before you start working. @@ -134,7 +134,7 @@ comprehensive. After testing is finished, create a patch file using the command: - git diff > your_patch.txt + svn diff > your_patch.txt For ease of review and later troubleshooting, submit individual patches for each bug or feature. @@ -142,7 +142,7 @@ patches for each bug or feature. Checklist for submitting your PHP or PECL code patch ---------------------------------------------------- - - Update git source just before running your final 'diff' and + - Update SVN source just before running your final 'diff' and before testing. - Add in-line comments and/or have external documentation ready. Use only "/* */" style comments, not "//". @@ -175,7 +175,7 @@ about these questions: What happens when your PHP or PECL patch is applied --------------------------------------------------- -Your name will likely be included in the Git commit log. If your +Your name will likely be included in the SVN commit log. If your patch affects end users, a brief description and your name might be added to the NEWS file. diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index a7d09630a26c7..3e211fa54f9a2 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -1673,7 +1673,7 @@ CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC) /* {{{ */ } /* }}} */ -CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC) /* {{{ */ +CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC) /* {{{ */ { cwd_state old_state; cwd_state new_state; diff --git a/TSRM/tsrm_virtual_cwd.h b/TSRM/tsrm_virtual_cwd.h index 72c4424670566..8aac4aa2671ec 100644 --- a/TSRM/tsrm_virtual_cwd.h +++ b/TSRM/tsrm_virtual_cwd.h @@ -161,7 +161,7 @@ CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC); CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC); CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...); CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC); -CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC); +CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC); CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC); CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC); CWD_API int virtual_unlink(const char *path TSRMLS_DC); diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c index 2ec97be0116bc..0ced6db451bfe 100644 --- a/TSRM/tsrm_win32.c +++ b/TSRM/tsrm_win32.c @@ -625,7 +625,7 @@ TSRM_API int shmget(int key, int size, int flags) shm->info = info_handle; shm->descriptor = MapViewOfFileEx(shm->info, FILE_MAP_ALL_ACCESS, 0, 0, 0, NULL); - if (NULL != shm->descriptor && created) { + if (created) { shm->descriptor->shm_perm.key = key; shm->descriptor->shm_segsz = size; shm->descriptor->shm_ctime = time(NULL); @@ -639,10 +639,8 @@ TSRM_API int shmget(int key, int size, int flags) shm->descriptor->shm_perm.mode = shm->descriptor->shm_perm.seq = 0; } - if (NULL != shm->descriptor && (shm->descriptor->shm_perm.key != key || size > shm->descriptor->shm_segsz)) { - if (NULL != shm->segment) { - CloseHandle(shm->segment); - } + if (shm->descriptor->shm_perm.key != key || size > shm->descriptor->shm_segsz ) { + CloseHandle(shm->segment); UnmapViewOfFile(shm->descriptor); CloseHandle(shm->info); return -1; diff --git a/UPGRADING b/UPGRADING index 431ad79e999b9..e78e46d1d37a3 100755 --- a/UPGRADING +++ b/UPGRADING @@ -69,16 +69,6 @@ PHP X.Y UPGRADE NOTES casts to primitive types and have overloaded operators. (RFC: https://wiki.php.net/rfc/operator_overloading_gmp) -- OCI8: - - Added Implicit Result Set support for Oracle Database 12c with a - new oci_get_implicit_resultset() function. - - Using 'oci_execute($s, OCI_NO_AUTO_COMMIT)' for a SELECT no longer - unnecessarily initiates an internal ROLLBACK during connection - close. - - Added DTrace probes enabled with PHP's generic --enable-dtrace - - The oci_internal_debug() function is now a no-op. - - The phpinfo() output format for OCI8 has changed. - ======================================== 9. New Global Constants ======================================== @@ -93,5 +83,3 @@ PHP X.Y UPGRADE NOTES 11. Other Changes ======================================== -- File upload: - Uploads equal or greater than 2GB in size are now accepted. diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 566f310998738..cfc19d515d770 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -48,9 +48,7 @@ UPGRADE NOTES - PHP X.Y ======================== a. Unix build system changes - - The bison version check is now a blacklist instead of a whitelist. - - The bison binary can be specified through the YACC environment/configure - variable. Previously `bison` was assumed to be in $PATH. + - b. Windows build system changes - diff --git a/Zend/README.ZEND_VM b/Zend/README.ZEND_VM index de66110d64832..15ff6fd86f4bd 100644 --- a/Zend/README.ZEND_VM +++ b/Zend/README.ZEND_VM @@ -6,7 +6,7 @@ fields and using different execution methods (call threading, switch threading and direct threading). As a result ZE2 got more than 20% speedup on raw PHP code execution (with specialized executor and direct threading execution method). As in most PHP applications raw execution speed isn't the limiting -factor but system calls and database calls are, your mileage with this patch +factor but system calls and database callls are, your mileage with this patch will vary. Most parts of the old zend_execute.c go into zend_vm_def.h. Here you can diff --git a/Zend/ZEND_CHANGES b/Zend/ZEND_CHANGES index afb3595595f43..4a6dc6cdcf166 100644 --- a/Zend/ZEND_CHANGES +++ b/Zend/ZEND_CHANGES @@ -1136,7 +1136,7 @@ Changes in the Zend Engine 1.0 (supports breakpoints, expression evaluation, step-in/over, function call backtrace, and more). - The Zend Engine claims 100% compatibility with the engine of PHP + The Zend Engine claims 100% compatability with the engine of PHP 3.0, and is shamelessly lying about it. Here's why: * Static variable initializers only accept scalar values @@ -1161,6 +1161,6 @@ Changes in the Zend Engine 1.0 printed the letter { and the contents of the variable $somevar in PHP 3.0), it will result in a parse error with the Zend Engine. In this case, you would have to change the code to print - "\{$somevar"; This incompatibility is due to the full variable + "\{$somevar"; This incompatability is due to the full variable reference within quoted strings feature added in the Zend Engine. diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 index fe3ab63beb4c6..136d2d8befeb5 100644 --- a/Zend/acinclude.m4 +++ b/Zend/acinclude.m4 @@ -3,13 +3,8 @@ dnl dnl This file contains local autoconf functions. AC_DEFUN([LIBZEND_BISON_CHECK],[ - # we only support certain bison versions; - # min: 2.4 (i.e. 204, major * 100 + minor for easier comparison) - bison_version_min="204" - # non-working versions, e.g. "3.0 3.2"; - # remove "none" when introducing the first incompatible bison version an - # separate any following additions by spaces - bison_version_exclude="none" + # we only support certain bison versions + bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 2.6 2.6.1 2.6.2" # for standalone build of Zend Engine test -z "$SED" && SED=sed @@ -17,27 +12,23 @@ AC_DEFUN([LIBZEND_BISON_CHECK],[ bison_version=none if test "$YACC"; then AC_CACHE_CHECK([for bison version], php_cv_bison_version, [ - bison_version_vars=`$YACC --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /g' | tr -d a-z` + bison_version_vars=`bison --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /' | tr -d a-z` php_cv_bison_version=invalid if test -n "$bison_version_vars"; then set $bison_version_vars bison_version="${1}.${2}" - bison_version_num="`expr ${1} \* 100 + ${2}`" - if test $bison_version_num -ge $bison_version_min; then - php_cv_bison_version="$bison_version (ok)" - for bison_check_version in $bison_version_exclude; do - if test "$bison_version" = "$bison_check_version"; then - php_cv_bison_version=invalid - break - fi - done - fi + for bison_check_version in $bison_version_list; do + if test "$bison_version" = "$bison_check_version"; then + php_cv_bison_version="$bison_check_version (ok)" + break + fi + done fi ]) fi case $php_cv_bison_version in ""|invalid[)] - bison_msg="This bison version is not supported for regeneration of the Zend/PHP parsers (found: $bison_version, min: $bison_version_min, excluded: $bison_version_exclude)." + bison_msg="bison versions supported for regeneration of the Zend/PHP parsers: $bison_version_list (found: $bison_version)." AC_MSG_WARN([$bison_msg]) YACC="exit 0;" ;; diff --git a/Zend/tests/bug60771.phpt b/Zend/tests/bug60771.phpt index 119ae50ad4f8e..c20bbc462a96e 100644 --- a/Zend/tests/bug60771.phpt +++ b/Zend/tests/bug60771.phpt @@ -1,10 +1,10 @@ ---TEST-- -test of larger than 8kb text file being parsed by require statement ---FILE-- - ---EXPECT-- -passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, +--TEST-- +test of larger than 8kb text file being parsed by require statement +--FILE-- + +--EXPECT-- +passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, passed, diff --git a/Zend/tests/bug65254.phpt b/Zend/tests/bug65254.phpt deleted file mode 100644 index d2ebba4d97fb9..0000000000000 --- a/Zend/tests/bug65254.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #65254 (Exception not catchable when exception thrown in autoload with a namespace) ---FILE-- - ---EXPECT-- -Tester diff --git a/Zend/tests/bug65372.phpt b/Zend/tests/bug65372.phpt deleted file mode 100644 index 50fc2dbb1b268..0000000000000 --- a/Zend/tests/bug65372.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Bug #65372 (Segfault in gc_zval_possible_root when return reference fails) ---FILE-- -Manager = $this; - } - - public static function &GetCurrent() - { - return ChildClass::Get(); - } - - public static function &Get() - { - return parent::Get(); - } -} - -$staff = ChildClass::GetCurrent(); -?> ---EXPECTF-- -Notice: Only variable references should be returned by reference in %sbug65372.php on line 30 diff --git a/Zend/tests/closure_044.phpt b/Zend/tests/closure_044.phpt index 8fdef135dc08e..d2644c0401f5b 100644 --- a/Zend/tests/closure_044.phpt +++ b/Zend/tests/closure_044.phpt @@ -3,7 +3,7 @@ Closure 044: Scope/bounding combination invariants; non static closures --FILE-- name); - Z_STRSIZE_P(expr_copy) = 0; + Z_STRLEN_P(expr_copy) = 0; Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC(); } break; @@ -311,13 +311,13 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop } /* }}} */ -ZEND_API zend_str_size_int zend_print_zval(zval *expr, int indent) /* {{{ */ +ZEND_API int zend_print_zval(zval *expr, int indent) /* {{{ */ { return zend_print_zval_ex(zend_write, expr, indent); } /* }}} */ -ZEND_API zend_str_size_int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent) /* {{{ */ +ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent) /* {{{ */ { zval expr_copy; int use_copy; @@ -326,17 +326,17 @@ ZEND_API zend_str_size_int zend_print_zval_ex(zend_write_func_t write_func, zval if (use_copy) { expr = &expr_copy; } - if (Z_STRSIZE_P(expr) == 0) { /* optimize away empty strings */ + if (Z_STRLEN_P(expr) == 0) { /* optimize away empty strings */ if (use_copy) { zval_dtor(expr); } return 0; } - write_func(Z_STRVAL_P(expr), Z_STRSIZE_P(expr)); + write_func(Z_STRVAL_P(expr), Z_STRLEN_P(expr)); if (use_copy) { zval_dtor(expr); } - return Z_STRSIZE_P(expr); + return Z_STRLEN_P(expr); } /* }}} */ @@ -358,7 +358,7 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) /* {{{ */ { HashTable *properties = NULL; const char *class_name = NULL; - zend_str_size clen; + zend_uint clen; if (Z_OBJ_HANDLER_P(expr, get_class_name)) { Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC); @@ -416,7 +416,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int { HashTable *properties; const char *class_name = NULL; - zend_str_size clen; + zend_uint clen; int is_temp; if (Z_OBJ_HANDLER_P(expr, get_class_name)) { @@ -624,7 +624,7 @@ static void php_scanner_globals_ctor(zend_php_scanner_globals *scanner_globals_p void zend_init_opcodes_handlers(void); -static zend_bool php_auto_globals_create_globals(const char *name, zend_str_size_uint name_len TSRMLS_DC) /* {{{ */ +static zend_bool php_auto_globals_create_globals(const char *name, uint name_len TSRMLS_DC) /* {{{ */ { zval *globals; @@ -863,7 +863,7 @@ void zenderror(const char *error) /* {{{ */ /* }}} */ BEGIN_EXTERN_C() -ZEND_API void _zend_bailout(char *filename, zend_str_size_uint lineno) /* {{{ */ +ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */ { TSRMLS_FETCH(); @@ -883,7 +883,7 @@ END_EXTERN_C() void zend_append_version_info(const zend_extension *extension) /* {{{ */ { char *new_info; - zend_str_size new_info_length; + uint new_info_length; new_info_length = sizeof(" with v, , by \n") + strlen(extension->name) @@ -980,7 +980,7 @@ ZEND_API void zend_message_dispatcher(long message, const void *data TSRMLS_DC) /* }}} */ END_EXTERN_C() -ZEND_API int zend_get_configuration_directive(const char *name, zend_str_size_uint name_length, zval *contents) /* {{{ */ +ZEND_API int zend_get_configuration_directive(const char *name, uint name_length, zval *contents) /* {{{ */ { if (zend_get_configuration_directive_p) { return zend_get_configuration_directive_p(name, name_length, contents); @@ -1015,7 +1015,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ zval *retval; zval *z_error_type, *z_error_message, *z_error_filename, *z_error_lineno, *z_context; const char *error_filename; - zend_str_size error_lineno; + uint error_lineno; zval *orig_user_error_handler; zend_bool in_compilation; zend_class_entry *saved_class_entry; @@ -1138,7 +1138,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ # endif #endif va_copy(usr_copy, args); - Z_STRSIZE_P(z_error_message) = zend_vspprintf(&Z_STRVAL_P(z_error_message), 0, format, usr_copy); + Z_STRLEN_P(z_error_message) = zend_vspprintf(&Z_STRVAL_P(z_error_message), 0, format, usr_copy); #ifdef va_copy va_end(usr_copy); #endif @@ -1364,7 +1364,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC) /* {{{ */ { const char *cur_filename; - zend_str_size cur_lineno; + int cur_lineno; char *compiled_string_description; if (zend_is_compiling(TSRMLS_C)) { diff --git a/Zend/zend.h b/Zend/zend.h index 26b7bab604a25..1377fd566594b 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -323,7 +323,7 @@ typedef union _zvalue_value { double dval; /* double value */ struct { char *val; - zend_str_size_int len; + int len; } str; HashTable *ht; /* hash table value */ zend_object_value obj; @@ -441,12 +441,12 @@ typedef struct _zend_unserialize_data zend_unserialize_data; struct _zend_trait_method_reference { const char* method_name; - zend_str_size_uint mname_len; + unsigned int mname_len; zend_class_entry *ce; const char* class_name; - zend_str_size_uint cname_len; + unsigned int cname_len; }; typedef struct _zend_trait_method_reference zend_trait_method_reference; @@ -464,7 +464,7 @@ struct _zend_trait_alias { * name for method to be added */ const char* alias; - zend_str_size_uint alias_len; + unsigned int alias_len; /** * modifiers to be set on trait method @@ -476,7 +476,7 @@ typedef struct _zend_trait_alias zend_trait_alias; struct _zend_class_entry { char type; const char *name; - zend_str_size_uint name_length; + zend_uint name_length; struct _zend_class_entry *parent; int refcount; zend_uint ce_flags; @@ -509,11 +509,11 @@ struct _zend_class_entry { zend_object_value (*create_object)(zend_class_entry *class_type TSRMLS_DC); zend_object_iterator *(*get_iterator)(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC); int (*interface_gets_implemented)(zend_class_entry *iface, zend_class_entry *class_type TSRMLS_DC); /* a class implements this interface */ - union _zend_function *(*get_static_method)(zend_class_entry *ce, char* method, zend_str_size_int method_len TSRMLS_DC); + union _zend_function *(*get_static_method)(zend_class_entry *ce, char* method, int method_len TSRMLS_DC); /* serializer callbacks */ - int (*serialize)(zval *object, unsigned char **buffer, zend_str_size_uint *buf_len, zend_serialize_data *data TSRMLS_DC); - int (*unserialize)(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_str_size_uint buf_len, zend_unserialize_data *data TSRMLS_DC); + int (*serialize)(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC); + int (*unserialize)(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC); zend_class_entry **interfaces; zend_uint num_interfaces; @@ -526,10 +526,10 @@ struct _zend_class_entry { union { struct { const char *filename; - zend_str_size_uint line_start; - zend_str_size_uint line_end; + zend_uint line_start; + zend_uint line_end; const char *doc_comment; - zend_str_size_uint doc_comment_len; + zend_uint doc_comment_len; } user; struct { const struct _zend_function_entry *builtin_functions; @@ -540,29 +540,29 @@ struct _zend_class_entry { #include "zend_stream.h" typedef struct _zend_utility_functions { - void (*error_function)(int type, const char *error_filename, const zend_str_size_uint error_lineno, const char *format, va_list args) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0); - zend_str_size_int (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); - zend_str_size_int (*write_function)(const char *str, zend_str_size_uint str_length); + 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); + int (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); + int (*write_function)(const char *str, uint str_length); FILE *(*fopen_function)(const char *filename, char **opened_path TSRMLS_DC); void (*message_handler)(long message, const void *data TSRMLS_DC); void (*block_interruptions)(void); void (*unblock_interruptions)(void); - int (*get_configuration_directive)(const char *name, zend_str_size_uint name_length, zval *contents); + int (*get_configuration_directive)(const char *name, uint name_length, zval *contents); void (*ticks_function)(int ticks); void (*on_timeout)(int seconds TSRMLS_DC); int (*stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC); - zend_str_size_int (*vspprintf_function)(char **pbuf, zend_str_size_size_t max_len, const char *format, va_list ap); - char *(*getenv_function)(char *name, zend_str_size_size_t name_len TSRMLS_DC); - char *(*resolve_path_function)(const char *filename, zend_str_size_int filename_len TSRMLS_DC); + int (*vspprintf_function)(char **pbuf, size_t max_len, const char *format, va_list ap); + char *(*getenv_function)(char *name, size_t name_len TSRMLS_DC); + char *(*resolve_path_function)(const char *filename, int filename_len TSRMLS_DC); } zend_utility_functions; typedef struct _zend_utility_values { char *import_use_extension; - zend_str_size_uint import_use_extension_length; + uint import_use_extension_length; zend_bool html_errors; } zend_utility_values; -typedef int (*zend_write_func_t)(const char *str, zend_str_size_uint str_length); +typedef int (*zend_write_func_t)(const char *str, uint str_length); #undef MIN #undef MAX @@ -609,7 +609,7 @@ void zend_post_startup(TSRMLS_D); void zend_set_utility_values(zend_utility_values *utility_values); BEGIN_EXTERN_C() -ZEND_API void _zend_bailout(char *filename, zend_str_size_uint lineno); +ZEND_API void _zend_bailout(char *filename, uint lineno); END_EXTERN_C() #define zend_bailout() _zend_bailout(__FILE__, __LINE__) @@ -643,8 +643,8 @@ END_EXTERN_C() BEGIN_EXTERN_C() ZEND_API char *get_zend_version(void); ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy); -ZEND_API zend_str_size_int zend_print_zval(zval *expr, int indent); -ZEND_API zend_str_size_int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent); +ZEND_API int zend_print_zval(zval *expr, int indent); +ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent); ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC); ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC); ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC); @@ -686,18 +686,18 @@ END_EXTERN_C() #define ZEND_PUTC(c) zend_write(&(c), 1), (c) BEGIN_EXTERN_C() -extern ZEND_API zend_str_size_int (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); +extern ZEND_API int (*zend_printf)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); extern ZEND_API zend_write_func_t zend_write; extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC); extern ZEND_API void (*zend_block_interruptions)(void); extern ZEND_API void (*zend_unblock_interruptions)(void); extern ZEND_API void (*zend_ticks_function)(int ticks); -extern ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const zend_str_size_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 int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC); -extern zend_str_size_int (*zend_vspprintf)(char **pbuf, zend_str_size_size_t max_len, const char *format, va_list ap); -extern ZEND_API char *(*zend_getenv)(char *name, zend_str_size_size_t name_len TSRMLS_DC); -extern ZEND_API char *(*zend_resolve_path)(const char *filename, zend_str_size_int filename_len TSRMLS_DC); +extern int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap); +extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC); +extern ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC); ZEND_API void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); @@ -726,7 +726,7 @@ END_EXTERN_C() BEGIN_EXTERN_C() ZEND_API void zend_message_dispatcher(long message, const void *data TSRMLS_DC); -ZEND_API int zend_get_configuration_directive(const char *name, zend_str_size_uint name_length, zval *contents); +ZEND_API int zend_get_configuration_directive(const char *name, uint name_length, zval *contents); END_EXTERN_C() /* Messages for applications of Zend */ diff --git a/Zend/zend_API.c b/Zend/zend_API.c index ddcd2e88d814d..23ad158b17d44 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -244,7 +244,7 @@ ZEND_API zend_class_entry *zend_get_class_entry(const zval *zobject TSRMLS_DC) / /* }}} */ /* returns 1 if you need to copy result, 0 if it's already a copy */ -ZEND_API int zend_get_object_classname(const zval *object, const char **class_name, zend_str_size_uint *class_name_len TSRMLS_DC) /* {{{ */ +ZEND_API int zend_get_object_classname(const zval *object, const char **class_name, zend_uint *class_name_len TSRMLS_DC) /* {{{ */ { if (Z_OBJ_HT_P(object)->get_class_name == NULL || Z_OBJ_HT_P(object)->get_class_name(object, class_name, class_name_len, 0 TSRMLS_CC) != SUCCESS) { @@ -258,7 +258,7 @@ ZEND_API int zend_get_object_classname(const zval *object, const char **class_na } /* }}} */ -static int parse_arg_object_to_string(zval **arg, char **p, zend_str_size_int *pl, int type TSRMLS_DC) /* {{{ */ +static int parse_arg_object_to_string(zval **arg, char **p, int *pl, int type TSRMLS_DC) /* {{{ */ { if (Z_OBJ_HANDLER_PP(arg, cast_object)) { zval *obj; @@ -266,7 +266,7 @@ static int parse_arg_object_to_string(zval **arg, char **p, zend_str_size_int *p if (Z_OBJ_HANDLER_P(*arg, cast_object)(*arg, obj, type TSRMLS_CC) == SUCCESS) { zval_ptr_dtor(arg); *arg = obj; - *pl = Z_STRSIZE_PP(arg); + *pl = Z_STRLEN_PP(arg); *p = Z_STRVAL_PP(arg); return SUCCESS; } @@ -276,7 +276,7 @@ static int parse_arg_object_to_string(zval **arg, char **p, zend_str_size_int *p if (Z_OBJ_HT_PP(arg) == &std_object_handlers || !Z_OBJ_HANDLER_PP(arg, cast_object)) { SEPARATE_ZVAL_IF_NOT_REF(arg); if (zend_std_cast_object_tostring(*arg, *arg, type TSRMLS_CC) == SUCCESS) { - *pl = Z_STRSIZE_PP(arg); + *pl = Z_STRLEN_PP(arg); *p = Z_STRVAL_PP(arg); return SUCCESS; } @@ -292,7 +292,7 @@ static int parse_arg_object_to_string(zval **arg, char **p, zend_str_size_int *p if (!use_copy) { ZVAL_ZVAL(*arg, z, 1, 1); } - *pl = Z_STRSIZE_PP(arg); + *pl = Z_STRLEN_PP(arg); *p = Z_STRVAL_PP(arg); return SUCCESS; } @@ -337,7 +337,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con double d; int type; - if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRSIZE_PP(arg), p, &d, -1)) == 0) { + if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), p, &d, -1)) == 0) { return "long"; } else if (type == IS_DOUBLE) { if (c == 'L') { @@ -396,7 +396,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con long l; int type; - if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRSIZE_PP(arg), &l, p, -1)) == 0) { + if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &l, p, -1)) == 0) { return "double"; } else if (type == IS_LONG) { *p = (double) l; @@ -420,28 +420,17 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con } } break; -#ifdef ZEND_USE_LEGACY_STRING_TYPES - case 'p': /* Deprecated, Legacy int size */ - case 's': /* Deprecated, Legacy int size */ -#endif - case 'P': /* New zend_str_size size */ - case 'S': /* New zend_str_size size */ + + case 'p': + case 's': { char **p = va_arg(*va, char **); - zend_str_size pl; - zend_str_size *plsize; - int *plint; - - if (c == 'p' || c == 's') { - plint = va_arg(*va, int *); - } else { - plsize = va_arg(*va, zend_str_size *); - } + int *pl = va_arg(*va, int *); switch (Z_TYPE_PP(arg)) { case IS_NULL: if (check_null) { *p = NULL; - pl = 0; + *pl = 0; break; } /* break omitted intentionally */ @@ -458,15 +447,15 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con SEPARATE_ZVAL(arg); } *p = Z_STRVAL_PP(arg); - pl = Z_STRSIZE_PP(arg); - if ((c == 'p' || c == 'P') && CHECK_ZVAL_NULL_PATH(*arg)) { + *pl = Z_STRLEN_PP(arg); + if (c == 'p' && CHECK_ZVAL_NULL_PATH(*arg)) { return "a valid path"; } break; case IS_OBJECT: - if (parse_arg_object_to_string(arg, p, &pl, IS_STRING TSRMLS_CC) == SUCCESS) { - if ((c == 'p' || c == 'P') && CHECK_ZVAL_NULL_PATH(*arg)) { + if (parse_arg_object_to_string(arg, p, pl, IS_STRING TSRMLS_CC) == SUCCESS) { + if (c == 'p' && CHECK_ZVAL_NULL_PATH(*arg)) { return "a valid path"; } break; @@ -475,12 +464,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con case IS_ARRAY: case IS_RESOURCE: default: - return (c == 's' || c == 'S') ? "string" : "a valid path"; - } - if (c == 'p' || c == 's') { - *plint = (int) pl; - } else { - *plsize = pl; + return c == 's' ? "string" : "a valid path"; } } break; @@ -610,7 +594,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, con break; } convert_to_string_ex(arg); - if (zend_lookup_class(Z_STRVAL_PP(arg), Z_STRSIZE_PP(arg), &lookup TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &lookup TSRMLS_CC) == FAILURE) { *pce = NULL; } else { *pce = *lookup; @@ -710,9 +694,6 @@ static int zend_parse_arg(int arg_num, zval **arg, va_list *va, const char **spe const char *space; const char *class_name = get_active_class_name(&space TSRMLS_CC); - if (0 == strcmp(expected_type, "unknown")) { - severity = E_ERROR; - } if (error) { zend_error(severity, "%s%s%s() expects parameter %d %s", class_name, space, get_active_function_name(TSRMLS_C), arg_num, error); @@ -770,7 +751,6 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va, case 'C': case 'h': case 'f': case 'A': case 'H': case 'p': - case 'S': case 'P': max_num_args++; break; @@ -1242,7 +1222,7 @@ ZEND_API int add_assoc_function(zval *arg, const char *key, void (*function_ptr) } /* }}} */ -ZEND_API int add_assoc_long_ex(zval *arg, const char *key, zend_str_size_uint key_len, long n) /* {{{ */ +ZEND_API int add_assoc_long_ex(zval *arg, const char *key, uint key_len, long n) /* {{{ */ { zval *tmp; @@ -1253,7 +1233,7 @@ ZEND_API int add_assoc_long_ex(zval *arg, const char *key, zend_str_size_uint ke } /* }}} */ -ZEND_API int add_assoc_null_ex(zval *arg, const char *key, zend_str_size_uint key_len) /* {{{ */ +ZEND_API int add_assoc_null_ex(zval *arg, const char *key, uint key_len) /* {{{ */ { zval *tmp; @@ -1264,7 +1244,7 @@ ZEND_API int add_assoc_null_ex(zval *arg, const char *key, zend_str_size_uint ke } /* }}} */ -ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, zend_str_size_uint key_len, int b) /* {{{ */ +ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, uint key_len, int b) /* {{{ */ { zval *tmp; @@ -1275,7 +1255,7 @@ ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, zend_str_size_uint ke } /* }}} */ -ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, zend_str_size_uint key_len, int r) /* {{{ */ +ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, int r) /* {{{ */ { zval *tmp; @@ -1286,7 +1266,7 @@ ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, zend_str_size_uin } /* }}} */ -ZEND_API int add_assoc_double_ex(zval *arg, const char *key, zend_str_size_uint key_len, double d) /* {{{ */ +ZEND_API int add_assoc_double_ex(zval *arg, const char *key, uint key_len, double d) /* {{{ */ { zval *tmp; @@ -1297,7 +1277,7 @@ ZEND_API int add_assoc_double_ex(zval *arg, const char *key, zend_str_size_uint } /* }}} */ -ZEND_API int add_assoc_string_ex(zval *arg, const char *key, zend_str_size_uint key_len, char *str, int duplicate) /* {{{ */ +ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate) /* {{{ */ { zval *tmp; @@ -1308,7 +1288,7 @@ ZEND_API int add_assoc_string_ex(zval *arg, const char *key, zend_str_size_uint } /* }}} */ -ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, zend_str_size_uint key_len, char *str, zend_str_size_uint length, int duplicate) /* {{{ */ +ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate) /* {{{ */ { zval *tmp; @@ -1319,7 +1299,7 @@ ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, zend_str_size_uint } /* }}} */ -ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, zend_str_size_uint key_len, zval *value) /* {{{ */ +ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value) /* {{{ */ { return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &value, sizeof(zval *), NULL); } @@ -1391,7 +1371,7 @@ ZEND_API int add_index_string(zval *arg, ulong index, const char *str, int dupli } /* }}} */ -ZEND_API int add_index_stringl(zval *arg, ulong index, const char *str, zend_str_size_uint length, int duplicate) /* {{{ */ +ZEND_API int add_index_stringl(zval *arg, ulong index, const char *str, uint length, int duplicate) /* {{{ */ { zval *tmp; @@ -1474,7 +1454,7 @@ ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate) /* } /* }}} */ -ZEND_API int add_next_index_stringl(zval *arg, const char *str, zend_str_size_uint length, int duplicate) /* {{{ */ +ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate) /* {{{ */ { zval *tmp; @@ -1491,7 +1471,7 @@ ZEND_API int add_next_index_zval(zval *arg, zval *value) /* {{{ */ } /* }}} */ -ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, zend_str_size_uint key_len, const char *str, void **dest, int duplicate) /* {{{ */ +ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, void **dest, int duplicate) /* {{{ */ { zval *tmp; @@ -1502,7 +1482,7 @@ ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, zend_str_size_u } /* }}} */ -ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, zend_str_size_uint key_len, const char *str, zend_str_size_uint length, void **dest, int duplicate) /* {{{ */ +ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, void **dest, int duplicate) /* {{{ */ { zval *tmp; @@ -1546,7 +1526,7 @@ ZEND_API int add_get_index_string(zval *arg, ulong index, const char *str, void } /* }}} */ -ZEND_API int add_get_index_stringl(zval *arg, ulong index, const char *str, zend_str_size_uint length, void **dest, int duplicate) /* {{{ */ +ZEND_API int add_get_index_stringl(zval *arg, ulong index, const char *str, uint length, void **dest, int duplicate) /* {{{ */ { zval *tmp; @@ -1563,7 +1543,7 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */ switch (Z_TYPE_P(key)) { case IS_STRING: - result = zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRSIZE_P(key) + 1, &value, sizeof(zval *), NULL); + result = zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL); break; case IS_NULL: result = zend_symtable_update(ht, "", 1, &value, sizeof(zval *), NULL); @@ -1591,7 +1571,7 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */ } /* }}} */ -ZEND_API int add_property_long_ex(zval *arg, const char *key, zend_str_size_uint key_len, long n TSRMLS_DC) /* {{{ */ +ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, long n TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; @@ -1609,7 +1589,7 @@ ZEND_API int add_property_long_ex(zval *arg, const char *key, zend_str_size_uint } /* }}} */ -ZEND_API int add_property_bool_ex(zval *arg, const char *key, zend_str_size_uint key_len, int b TSRMLS_DC) /* {{{ */ +ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, int b TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; @@ -1627,7 +1607,7 @@ ZEND_API int add_property_bool_ex(zval *arg, const char *key, zend_str_size_uint } /* }}} */ -ZEND_API int add_property_null_ex(zval *arg, const char *key, zend_str_size_uint key_len TSRMLS_DC) /* {{{ */ +ZEND_API int add_property_null_ex(zval *arg, const char *key, uint key_len TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; @@ -1645,7 +1625,7 @@ ZEND_API int add_property_null_ex(zval *arg, const char *key, zend_str_size_uint } /* }}} */ -ZEND_API int add_property_resource_ex(zval *arg, const char *key, zend_str_size_uint key_len, long n TSRMLS_DC) /* {{{ */ +ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, long n TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; @@ -1663,7 +1643,7 @@ ZEND_API int add_property_resource_ex(zval *arg, const char *key, zend_str_size_ } /* }}} */ -ZEND_API int add_property_double_ex(zval *arg, const char *key, zend_str_size_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) /* {{{ */ { zval *tmp; zval *z_key; @@ -1681,7 +1661,7 @@ ZEND_API int add_property_double_ex(zval *arg, const char *key, zend_str_size_ui } /* }}} */ -ZEND_API int add_property_string_ex(zval *arg, const char *key, zend_str_size_uint key_len, const char *str, int duplicate TSRMLS_DC) /* {{{ */ +ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; @@ -1699,7 +1679,7 @@ ZEND_API int add_property_string_ex(zval *arg, const char *key, zend_str_size_ui } /* }}} */ -ZEND_API int add_property_stringl_ex(zval *arg, const char *key, zend_str_size_uint key_len, const char *str, zend_str_size_uint length, int duplicate TSRMLS_DC) /* {{{ */ +ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; @@ -1717,7 +1697,7 @@ ZEND_API int add_property_stringl_ex(zval *arg, const char *key, zend_str_size_u } /* }}} */ -ZEND_API int add_property_zval_ex(zval *arg, const char *key, zend_str_size_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) /* {{{ */ { zval *z_key; @@ -1732,7 +1712,7 @@ ZEND_API int add_property_zval_ex(zval *arg, const char *key, zend_str_size_uint ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC) /* {{{ */ { - zend_str_size name_len; + int name_len; char *lcname; if (module->module_started) { @@ -1918,7 +1898,7 @@ ZEND_API void zend_destroy_modules(void) /* {{{ */ ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC) /* {{{ */ { - zend_str_size name_len; + int name_len; char *lcname; zend_module_entry *module_ptr; @@ -1985,7 +1965,7 @@ ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *mod ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce, const zend_function *fptr, int error_type TSRMLS_DC) /* {{{ */ { char lcname[16]; - zend_str_size name_len; + int name_len; /* we don't care if the function name is longer, in fact lowercasing only * the beginning of the name speeds up the check process */ @@ -2054,9 +2034,9 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio int error_type; zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__callstatic = NULL, *__tostring = NULL; const char *lowercase_name; - zend_str_size fname_len; + int fname_len; const char *lc_class_name = NULL; - zend_str_size class_name_len = 0; + int class_name_len = 0; if (type==MODULE_PERSISTENT) { error_type = E_CORE_WARNING; @@ -2592,7 +2572,7 @@ ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *or } /* }}} */ -ZEND_API int zend_register_class_alias_ex(const char *name, zend_str_size_int name_len, zend_class_entry *ce TSRMLS_DC) /* {{{ */ +ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_class_entry *ce TSRMLS_DC) /* {{{ */ { char *lcname = zend_str_tolower_dup(name, name_len); int ret; @@ -2606,7 +2586,7 @@ ZEND_API int zend_register_class_alias_ex(const char *name, zend_str_size_int na } /* }}} */ -ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, zend_str_size_int name_length, zend_bool is_ref, int num_symbol_tables, ...) /* {{{ */ +ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, int name_length, zend_bool is_ref, int num_symbol_tables, ...) /* {{{ */ { HashTable *symbol_table; va_list symbol_table_list; @@ -2641,7 +2621,7 @@ static zend_function_entry disabled_function[] = { ZEND_FE_END }; -ZEND_API int zend_disable_function(char *function_name, zend_str_size_uint function_name_length TSRMLS_DC) /* {{{ */ +ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC) /* {{{ */ { if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) { return FAILURE; @@ -2671,7 +2651,7 @@ static const zend_function_entry disabled_class_new[] = { ZEND_FE_END }; -ZEND_API int zend_disable_class(char *class_name, zend_str_size_uint class_name_length TSRMLS_DC) /* {{{ */ +ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC) /* {{{ */ { zend_class_entry **disabled_class; @@ -2686,7 +2666,7 @@ ZEND_API int zend_disable_class(char *class_name, zend_str_size_uint class_name_ } /* }}} */ -static int zend_is_callable_check_class(const char *name, zend_str_size_int name_len, zend_fcall_info_cache *fcc, int *strict_class, char **error TSRMLS_DC) /* {{{ */ +static int zend_is_callable_check_class(const char *name, int name_len, zend_fcall_info_cache *fcc, int *strict_class, char **error TSRMLS_DC) /* {{{ */ { int ret = 0; zend_class_entry **pce; @@ -2761,7 +2741,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca int retval = 0; char *mname, *lmname; const char *colon; - zend_str_size clen, mlen; + int clen, mlen; zend_class_entry *last_scope; HashTable *ftable; int call_via_handler = 0; @@ -2776,10 +2756,10 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca if (!ce_org) { /* Skip leading \ */ if (Z_STRVAL_P(callable)[0] == '\\') { - mlen = Z_STRSIZE_P(callable) - 1; + mlen = Z_STRLEN_P(callable) - 1; lmname = zend_str_tolower_dup(Z_STRVAL_P(callable) + 1, mlen); } else { - mlen = Z_STRSIZE_P(callable); + mlen = Z_STRLEN_P(callable); lmname = zend_str_tolower_dup(Z_STRVAL_P(callable), mlen); } /* Check if function with given name exists. @@ -2792,13 +2772,13 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca } /* Split name into class/namespace and method/function names */ - if ((colon = zend_memrchr(Z_STRVAL_P(callable), ':', Z_STRSIZE_P(callable))) != NULL && + if ((colon = zend_memrchr(Z_STRVAL_P(callable), ':', Z_STRLEN_P(callable))) != NULL && colon > Z_STRVAL_P(callable) && *(colon-1) == ':' ) { colon--; clen = colon - Z_STRVAL_P(callable); - mlen = Z_STRSIZE_P(callable) - clen - 2; + mlen = Z_STRLEN_P(callable) - clen - 2; if (colon == Z_STRVAL_P(callable)) { if (error) zend_spprintf(error, 0, "invalid function name"); @@ -2826,7 +2806,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca mname = Z_STRVAL_P(callable) + clen + 2; } else if (ce_org) { /* Try to fetch find static method of given class. */ - mlen = Z_STRSIZE_P(callable); + mlen = Z_STRLEN_P(callable); mname = Z_STRVAL_P(callable); ftable = &ce_org->function_table; fcc->calling_scope = ce_org; @@ -3016,10 +2996,10 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca } /* }}} */ -ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint check_flags, char **callable_name, zend_str_size_int *callable_name_len, zend_fcall_info_cache *fcc, char **error TSRMLS_DC) /* {{{ */ +ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint check_flags, char **callable_name, int *callable_name_len, zend_fcall_info_cache *fcc, char **error TSRMLS_DC) /* {{{ */ { zend_bool ret; - zend_str_size callable_name_len_local; + int callable_name_len_local; zend_fcall_info_cache fcc_local; if (callable_name) { @@ -3059,17 +3039,17 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch if (callable_name) { char *ptr; - *callable_name_len = fcc->calling_scope->name_length + Z_STRSIZE_P(callable) + sizeof("::") - 1; + *callable_name_len = fcc->calling_scope->name_length + Z_STRLEN_P(callable) + sizeof("::") - 1; ptr = *callable_name = emalloc(*callable_name_len + 1); memcpy(ptr, fcc->calling_scope->name, fcc->calling_scope->name_length); ptr += fcc->calling_scope->name_length; memcpy(ptr, "::", sizeof("::") - 1); ptr += sizeof("::") - 1; - memcpy(ptr, Z_STRVAL_P(callable), Z_STRSIZE_P(callable) + 1); + memcpy(ptr, Z_STRVAL_P(callable), Z_STRLEN_P(callable) + 1); } } else if (callable_name) { - *callable_name = estrndup(Z_STRVAL_P(callable), Z_STRSIZE_P(callable)); - *callable_name_len = Z_STRSIZE_P(callable); + *callable_name = estrndup(Z_STRVAL_P(callable), Z_STRLEN_P(callable)); + *callable_name_len = Z_STRLEN_P(callable); } if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) { fcc->called_scope = fcc->calling_scope; @@ -3109,20 +3089,20 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch if (callable_name) { char *ptr; - *callable_name_len = Z_STRSIZE_PP(obj) + Z_STRSIZE_PP(method) + sizeof("::") - 1; + *callable_name_len = Z_STRLEN_PP(obj) + Z_STRLEN_PP(method) + sizeof("::") - 1; ptr = *callable_name = emalloc(*callable_name_len + 1); - memcpy(ptr, Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj)); - ptr += Z_STRSIZE_PP(obj); + memcpy(ptr, Z_STRVAL_PP(obj), Z_STRLEN_PP(obj)); + ptr += Z_STRLEN_PP(obj); memcpy(ptr, "::", sizeof("::") - 1); ptr += sizeof("::") - 1; - memcpy(ptr, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) + 1); + memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1); } if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) { return 1; } - if (!zend_is_callable_check_class(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), fcc, &strict_class, error TSRMLS_CC)) { + if (!zend_is_callable_check_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), fcc, &strict_class, error TSRMLS_CC)) { return 0; } @@ -3139,13 +3119,13 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch if (callable_name) { char *ptr; - *callable_name_len = fcc->calling_scope->name_length + Z_STRSIZE_PP(method) + sizeof("::") - 1; + *callable_name_len = fcc->calling_scope->name_length + Z_STRLEN_PP(method) + sizeof("::") - 1; ptr = *callable_name = emalloc(*callable_name_len + 1); memcpy(ptr, fcc->calling_scope->name, fcc->calling_scope->name_length); ptr += fcc->calling_scope->name_length; memcpy(ptr, "::", sizeof("::") - 1); ptr += sizeof("::") - 1; - memcpy(ptr, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) + 1); + memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1); } if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) { @@ -3207,8 +3187,8 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch int use_copy; zend_make_printable_zval(callable, &expr_copy, &use_copy); - *callable_name = estrndup(Z_STRVAL(expr_copy), Z_STRSIZE(expr_copy)); - *callable_name_len = Z_STRSIZE(expr_copy); + *callable_name = estrndup(Z_STRVAL(expr_copy), Z_STRLEN(expr_copy)); + *callable_name_len = Z_STRLEN(expr_copy); zval_dtor(&expr_copy); } if (error) zend_spprintf(error, 0, "no array or string given"); @@ -3426,7 +3406,7 @@ ZEND_API const char *zend_get_module_version(const char *module_name) /* {{{ */ } /* }}} */ -ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, zend_str_size_int name_length, zval *property, int access_type, const char *doc_comment, zend_str_size_int doc_comment_len TSRMLS_DC) /* {{{ */ +ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type, const char *doc_comment, int doc_comment_len TSRMLS_DC) /* {{{ */ { zend_property_info property_info, *property_info_ptr; const char *interned_name; @@ -3476,7 +3456,7 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, ze switch (access_type & ZEND_ACC_PPP_MASK) { case ZEND_ACC_PRIVATE: { char *priv_name; - zend_str_size priv_name_length; + int priv_name_length; zend_mangle_property_name(&priv_name, &priv_name_length, ce->name, ce->name_length, name, name_length, ce->type & ZEND_INTERNAL_CLASS); property_info.name = priv_name; @@ -3485,7 +3465,7 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, ze break; case ZEND_ACC_PROTECTED: { char *prot_name; - zend_str_size prot_name_length; + int prot_name_length; zend_mangle_property_name(&prot_name, &prot_name_length, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS); property_info.name = prot_name; @@ -3526,13 +3506,13 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, ze } /* }}} */ -ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, zend_str_size_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) /* {{{ */ { return zend_declare_property_ex(ce, name, name_length, property, access_type, NULL, 0 TSRMLS_CC); } /* }}} */ -ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, zend_str_size_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) /* {{{ */ { zval *property; @@ -3546,7 +3526,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, zend_str_size_int name_length, long value, int access_type TSRMLS_DC) /* {{{ */ +ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC) /* {{{ */ { zval *property; @@ -3561,7 +3541,7 @@ ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, } /* }}} */ -ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, zend_str_size_int name_length, long value, int access_type TSRMLS_DC) /* {{{ */ +ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC) /* {{{ */ { zval *property; @@ -3576,7 +3556,7 @@ ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, } /* }}} */ -ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, zend_str_size_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) /* {{{ */ { zval *property; @@ -3591,10 +3571,10 @@ ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name } /* }}} */ -ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, zend_str_size_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) /* {{{ */ { zval *property; - zend_str_size len = strlen(value); + int len = strlen(value); if (ce->type & ZEND_INTERNAL_CLASS) { ALLOC_PERMANENT_ZVAL(property); @@ -3608,7 +3588,7 @@ ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name } /* }}} */ -ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, zend_str_size_int name_length, const char *value, zend_str_size_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) /* {{{ */ { zval *property; @@ -3624,13 +3604,13 @@ ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *nam } /* }}} */ -ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, zend_str_size_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) /* {{{ */ { return zend_hash_update(&ce->constants_table, name, name_length+1, &value, sizeof(zval *), NULL); } /* }}} */ -ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, zend_str_size_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) /* {{{ */ { zval *constant; @@ -3645,7 +3625,7 @@ ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char * } /* }}} */ -ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, long value TSRMLS_DC) /* {{{ */ +ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, long value TSRMLS_DC) /* {{{ */ { zval *constant; @@ -3660,7 +3640,7 @@ ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char * } /* }}} */ -ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, zend_str_size_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) /* {{{ */ { zval *constant; @@ -3675,7 +3655,7 @@ ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char * } /* }}} */ -ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char *name, zend_str_size_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) /* {{{ */ { zval *constant; @@ -3690,7 +3670,7 @@ ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char } /* }}} */ -ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, const char *value, zend_str_size_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) /* {{{ */ { zval *constant; @@ -3706,13 +3686,13 @@ ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const cha } /* }}} */ -ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, const char *value TSRMLS_DC) /* {{{ */ +ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value TSRMLS_DC) /* {{{ */ { return zend_declare_class_constant_stringl(ce, name, name_length, value, strlen(value) TSRMLS_CC); } /* }}} */ -ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const char *name, zend_str_size_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) /* {{{ */ { zval *property; zend_class_entry *old_scope = EG(scope); @@ -3721,7 +3701,7 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const if (!Z_OBJ_HT_P(object)->write_property) { const char *class_name; - zend_str_size class_name_len; + zend_uint class_name_len; zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC); @@ -3736,7 +3716,7 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const } /* }}} */ -ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, const char *name, zend_str_size_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) /* {{{ */ { zval *tmp; @@ -3748,7 +3728,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, zend_str_size_int name_length, long value TSRMLS_DC) /* {{{ */ +ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3760,7 +3740,7 @@ ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, c } /* }}} */ -ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, long value TSRMLS_DC) /* {{{ */ +ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3772,7 +3752,7 @@ ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, c } /* }}} */ -ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, zend_str_size_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) /* {{{ */ { zval *tmp; @@ -3784,7 +3764,7 @@ ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, } /* }}} */ -ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, zend_str_size_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) /* {{{ */ { zval *tmp; @@ -3796,7 +3776,7 @@ ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, } /* }}} */ -ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, const char *value, zend_str_size_int value_len TSRMLS_DC) /* {{{ */ +ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3808,7 +3788,7 @@ 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, zend_str_size_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) /* {{{ */ { zval **property; zend_class_entry *old_scope = EG(scope); @@ -3845,7 +3825,7 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *na } /* }}} */ -ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, zend_str_size_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) /* {{{ */ { zval *tmp; @@ -3857,7 +3837,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, zend_str_size_int name_length, long value TSRMLS_DC) /* {{{ */ +ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3869,7 +3849,7 @@ ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const cha } /* }}} */ -ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, zend_str_size_int name_length, long value TSRMLS_DC) /* {{{ */ +ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3881,7 +3861,7 @@ ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const cha } /* }}} */ -ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, zend_str_size_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) /* {{{ */ { zval *tmp; @@ -3893,7 +3873,7 @@ ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const c } /* }}} */ -ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, zend_str_size_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) /* {{{ */ { zval *tmp; @@ -3905,7 +3885,7 @@ ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const c } /* }}} */ -ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, zend_str_size_int name_length, const char *value, zend_str_size_int value_len 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_len TSRMLS_DC) /* {{{ */ { zval *tmp; @@ -3917,7 +3897,7 @@ ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const } /* }}} */ -ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, zend_bool silent TSRMLS_DC) /* {{{ */ +ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_bool silent TSRMLS_DC) /* {{{ */ { zval *property, *value; zend_class_entry *old_scope = EG(scope); @@ -3926,7 +3906,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const c if (!Z_OBJ_HT_P(object)->read_property) { const char *class_name; - zend_str_size class_name_len; + zend_uint class_name_len; zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC); zend_error(E_CORE_ERROR, "Property %s of class %s cannot be read", name, class_name); @@ -3942,7 +3922,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const c } /* }}} */ -ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, zend_str_size_int name_length, zend_bool silent TSRMLS_DC) /* {{{ */ +ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, int name_length, zend_bool silent TSRMLS_DC) /* {{{ */ { zval **property; zend_class_entry *old_scope = EG(scope); @@ -3996,7 +3976,7 @@ ZEND_API void zend_restore_error_handling(zend_error_handling *saved TSRMLS_DC) } /* }}} */ -ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name, zend_str_size_uint len) /* {{{ */ +ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name, zend_uint len) /* {{{ */ { zend_trait_alias *alias, **alias_ptr; @@ -4033,7 +4013,7 @@ ZEND_API const char* zend_resolve_method_name(zend_class_entry *ce, zend_functio while (zend_hash_get_current_data_ex(function_table, (void **)&func, &iterator) == SUCCESS) { if (func == f) { char *name; - zend_str_size len; + uint len; ulong idx; if (zend_hash_get_current_key_ex(function_table, &name, &len, &idx, 0, &iterator) != HASH_KEY_IS_STRING) { diff --git a/Zend/zend_API.h b/Zend/zend_API.h index a7c21fb7e3041..ecc8d9acd9f43 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -28,7 +28,7 @@ #include "zend_operators.h" #include "zend_variables.h" #include "zend_execute.h" -#include "zend_types.h" + BEGIN_EXTERN_C() @@ -169,7 +169,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) \ { \ const char *cl_name = class_name; \ - zend_str_size _len = class_name_len; \ + int _len = class_name_len; \ class_container.name = zend_new_interned_string(cl_name, _len+1, 0 TSRMLS_CC); \ if (class_container.name == cl_name) { \ class_container.name = zend_strndup(cl_name, _len); \ @@ -278,15 +278,15 @@ ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *cla ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *orig_class_entry TSRMLS_DC); ZEND_API void zend_class_implements(zend_class_entry *class_entry TSRMLS_DC, int num_interfaces, ...); -ZEND_API int zend_register_class_alias_ex(const char *name, zend_str_size_int name_len, zend_class_entry *ce TSRMLS_DC); +ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, zend_class_entry *ce TSRMLS_DC); #define zend_register_class_alias(name, ce) \ zend_register_class_alias_ex(name, sizeof(name)-1, ce TSRMLS_CC) #define zend_register_ns_class_alias(ns, name, ce) \ zend_register_class_alias_ex(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, ce TSRMLS_CC) -ZEND_API int zend_disable_function(char *function_name, zend_str_size_uint function_name_length TSRMLS_DC); -ZEND_API int zend_disable_class(char *class_name, zend_str_size_uint class_name_length TSRMLS_DC); +ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC); +ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_DC); ZEND_API void zend_wrong_param_count(TSRMLS_D); @@ -297,51 +297,51 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D); #define IS_CALLABLE_STRICT (IS_CALLABLE_CHECK_IS_STATIC) -ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint check_flags, char **callable_name, zend_str_size_int *callable_name_len, zend_fcall_info_cache *fcc, char **error TSRMLS_DC); +ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint check_flags, char **callable_name, int *callable_name_len, zend_fcall_info_cache *fcc, char **error TSRMLS_DC); ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name TSRMLS_DC); ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC); ZEND_API const char *zend_get_module_version(const char *module_name); ZEND_API int zend_get_module_started(const char *module_name); -ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, zend_str_size_int name_length, zval *property, int access_type TSRMLS_DC); -ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, zend_str_size_int name_length, zval *property, int access_type, const char *doc_comment, zend_str_size_int doc_comment_len TSRMLS_DC); -ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, zend_str_size_int name_length, int access_type TSRMLS_DC); -ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, zend_str_size_int name_length, long value, int access_type TSRMLS_DC); -ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, zend_str_size_int name_length, long value, int access_type TSRMLS_DC); -ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, zend_str_size_int name_length, double value, int access_type TSRMLS_DC); -ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, zend_str_size_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, zend_str_size_int name_length, const char *value, zend_str_size_int value_len, int access_type TSRMLS_DC); - -ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, zval *value TSRMLS_DC); -ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length TSRMLS_DC); -ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, long value TSRMLS_DC); -ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, zend_bool value TSRMLS_DC); -ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, double value TSRMLS_DC); -ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, const char *value, zend_str_size_size_t value_length TSRMLS_DC); -ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, zend_str_size_size_t name_length, const char *value 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_ex(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type, const char *doc_comment, int doc_comment_len 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, long value, int access_type TSRMLS_DC); +ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC); +ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, int name_length, double value, int access_type TSRMLS_DC); +ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, int name_length, const char *value, int access_type TSRMLS_DC); +ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, int name_length, const char *value, int value_len, int access_type TSRMLS_DC); + +ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value TSRMLS_DC); +ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length TSRMLS_DC); +ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, const char *name, size_t name_length, long value TSRMLS_DC); +ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, const char *name, size_t name_length, zend_bool value TSRMLS_DC); +ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, const char *name, size_t name_length, double value TSRMLS_DC); +ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const char *name, size_t name_length, const char *value, size_t value_length TSRMLS_DC); +ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value 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, zend_str_size_int name_length, zval *value TSRMLS_DC); -ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length TSRMLS_DC); -ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, long value TSRMLS_DC); -ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, long value TSRMLS_DC); -ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, double value TSRMLS_DC); -ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, const char *value TSRMLS_DC); -ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, const char *value, zend_str_size_int value_length TSRMLS_DC); - -ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, zend_str_size_int name_length, zval *value TSRMLS_DC); -ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, zend_str_size_int name_length TSRMLS_DC); -ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, zend_str_size_int name_length, long value TSRMLS_DC); -ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, zend_str_size_int name_length, long value TSRMLS_DC); -ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, zend_str_size_int name_length, double value TSRMLS_DC); -ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, zend_str_size_int name_length, const char *value TSRMLS_DC); -ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, zend_str_size_int name_length, const char *value, zend_str_size_int value_length TSRMLS_DC); - -ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, zend_str_size_int name_length, zend_bool silent TSRMLS_DC); - -ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, zend_str_size_int name_length, zend_bool silent TSRMLS_DC); +ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zval *value TSRMLS_DC); +ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, const char *name, int name_length TSRMLS_DC); +ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, long value TSRMLS_DC); +ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, int name_length, 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_string(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value TSRMLS_DC); +ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value, int value_length 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_bool(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC); +ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC); +ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, int name_length, double value TSRMLS_DC); +ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, int name_length, const char *value TSRMLS_DC); +ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, int name_length, const char *value, int value_length TSRMLS_DC); + +ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_bool silent TSRMLS_DC); + +ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, int name_length, zend_bool silent TSRMLS_DC); ZEND_API zend_class_entry *zend_get_class_entry(const zval *zobject TSRMLS_DC); -ZEND_API int zend_get_object_classname(const zval *object, const char **class_name, zend_str_size_uint *class_name_len TSRMLS_DC); +ZEND_API int zend_get_object_classname(const zval *object, const char **class_name, zend_uint *class_name_len TSRMLS_DC); ZEND_API char *zend_get_type_by_const(int type); #define getThis() (this_ptr) @@ -373,14 +373,14 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro /* 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_long_ex(zval *arg, const char *key, zend_str_size_uint key_len, long n); -ZEND_API int add_assoc_null_ex(zval *arg, const char *key, zend_str_size_uint key_len); -ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, zend_str_size_uint key_len, int b); -ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, zend_str_size_uint key_len, int r); -ZEND_API int add_assoc_double_ex(zval *arg, const char *key, zend_str_size_uint key_len, double d); -ZEND_API int add_assoc_string_ex(zval *arg, const char *key, zend_str_size_uint key_len, char *str, int duplicate); -ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, zend_str_size_uint key_len, char *str, zend_str_size_uint length, int duplicate); -ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, zend_str_size_uint key_len, zval *value); +ZEND_API int add_assoc_long_ex(zval *arg, const char *key, uint key_len, long n); +ZEND_API int add_assoc_null_ex(zval *arg, const char *key, uint key_len); +ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, uint key_len, int b); +ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, int r); +ZEND_API int add_assoc_double_ex(zval *arg, const char *key, uint key_len, double d); +ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate); +ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate); +ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value); #define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n) #define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1) @@ -403,7 +403,7 @@ ZEND_API int add_index_bool(zval *arg, ulong idx, int b); ZEND_API int add_index_resource(zval *arg, ulong idx, int r); ZEND_API int add_index_double(zval *arg, ulong idx, double d); ZEND_API int add_index_string(zval *arg, ulong idx, const char *str, int duplicate); -ZEND_API int add_index_stringl(zval *arg, ulong idx, const char *str, zend_str_size_uint length, int duplicate); +ZEND_API int add_index_stringl(zval *arg, ulong idx, const char *str, uint length, int duplicate); ZEND_API int add_index_zval(zval *arg, ulong index, zval *value); ZEND_API int add_next_index_long(zval *arg, long n); @@ -412,11 +412,11 @@ ZEND_API int add_next_index_bool(zval *arg, int b); ZEND_API int add_next_index_resource(zval *arg, int r); ZEND_API int add_next_index_double(zval *arg, double d); ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate); -ZEND_API int add_next_index_stringl(zval *arg, const char *str, zend_str_size_uint length, int duplicate); +ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate); ZEND_API int add_next_index_zval(zval *arg, zval *value); -ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, zend_str_size_uint key_len, const char *str, void **dest, int duplicate); -ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, zend_str_size_uint key_len, const char *str, zend_str_size_uint length, void **dest, int duplicate); +ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, void **dest, int duplicate); +ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, void **dest, int duplicate); #define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate) #define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate) @@ -424,18 +424,18 @@ ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, zend_str_size_ ZEND_API int add_get_index_long(zval *arg, ulong idx, long l, void **dest); ZEND_API int add_get_index_double(zval *arg, ulong idx, double d, void **dest); ZEND_API int add_get_index_string(zval *arg, ulong idx, const char *str, void **dest, int duplicate); -ZEND_API int add_get_index_stringl(zval *arg, ulong idx, const char *str, zend_str_size_uint length, void **dest, int duplicate); +ZEND_API int add_get_index_stringl(zval *arg, ulong idx, const char *str, uint length, void **dest, int duplicate); ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value); -ZEND_API int add_property_long_ex(zval *arg, const char *key, zend_str_size_uint key_len, long l TSRMLS_DC); -ZEND_API int add_property_null_ex(zval *arg, const char *key, zend_str_size_uint key_len TSRMLS_DC); -ZEND_API int add_property_bool_ex(zval *arg, const char *key, zend_str_size_uint key_len, int b TSRMLS_DC); -ZEND_API int add_property_resource_ex(zval *arg, const char *key, zend_str_size_uint key_len, long r TSRMLS_DC); -ZEND_API int add_property_double_ex(zval *arg, const char *key, zend_str_size_uint key_len, double d TSRMLS_DC); -ZEND_API int add_property_string_ex(zval *arg, const char *key, zend_str_size_uint key_len, const char *str, int duplicate TSRMLS_DC); -ZEND_API int add_property_stringl_ex(zval *arg, const char *key, zend_str_size_uint key_len, const char *str, zend_str_size_uint length, int duplicate TSRMLS_DC); -ZEND_API int add_property_zval_ex(zval *arg, const char *key, zend_str_size_uint key_len, zval *value TSRMLS_DC); +ZEND_API int add_property_long_ex(zval *arg, const char *key, uint key_len, long l TSRMLS_DC); +ZEND_API int add_property_null_ex(zval *arg, const char *key, uint key_len TSRMLS_DC); +ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, int b TSRMLS_DC); +ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, long 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_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate TSRMLS_DC); +ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate TSRMLS_DC); +ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval *value TSRMLS_DC); #define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key)+1, __n TSRMLS_CC) #define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) + 1 TSRMLS_CC) @@ -509,19 +509,19 @@ ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *f ZEND_API int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TSRMLS_DC); -ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, zend_str_size_int name_length, zend_bool is_ref, int num_symbol_tables, ...); +ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, int name_length, zend_bool is_ref, int num_symbol_tables, ...); -ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const char *name, zend_str_size_int name_len, ulong hash_value TSRMLS_DC); +ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const char *name, int name_len, ulong hash_value TSRMLS_DC); -ZEND_API int zend_delete_global_variable(const char *name, zend_str_size_int name_len TSRMLS_DC); +ZEND_API int zend_delete_global_variable(const char *name, int name_len TSRMLS_DC); -ZEND_API int zend_delete_global_variable_ex(const char *name, zend_str_size_int name_len, ulong hash_value TSRMLS_DC); +ZEND_API int zend_delete_global_variable_ex(const char *name, int name_len, ulong hash_value TSRMLS_DC); ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC); ZEND_API void zend_rebuild_symbol_table(TSRMLS_D); -ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name, zend_str_size_uint len); +ZEND_API const char* zend_find_alias_name(zend_class_entry *ce, const char *name, zend_uint len); ZEND_API const char* zend_resolve_method_name(zend_class_entry *ce, zend_function *f); #define add_method(arg, key, method) add_assoc_function((arg), (key), (method)) @@ -532,15 +532,15 @@ END_EXTERN_C() #if ZEND_DEBUG #define CHECK_ZVAL_STRING(z) \ - if (Z_STRVAL_P(z)[ Z_STRSIZE_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", Z_STRVAL_P(z)); } + if (Z_STRVAL_P(z)[ Z_STRLEN_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s)", Z_STRVAL_P(z)); } #define CHECK_ZVAL_STRING_REL(z) \ - if (Z_STRVAL_P(z)[ Z_STRSIZE_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", Z_STRVAL_P(z) ZEND_FILE_LINE_RELAY_CC); } + if (Z_STRVAL_P(z)[ Z_STRLEN_P(z) ] != '\0') { zend_error(E_WARNING, "String is not zero-terminated (%s) (source: %s:%d)", Z_STRVAL_P(z) ZEND_FILE_LINE_RELAY_CC); } #else #define CHECK_ZVAL_STRING(z) #define CHECK_ZVAL_STRING_REL(z) #endif -#define CHECK_ZVAL_NULL_PATH(p) (Z_STRSIZE_P(p) != strlen(Z_STRVAL_P(p))) +#define CHECK_ZVAL_NULL_PATH(p) (Z_STRLEN_P(p) != strlen(Z_STRVAL_P(p))) #define CHECK_NULL_PATH(p, l) (strlen(p) != l) #define ZVAL_RESOURCE(z, l) do { \ @@ -574,22 +574,22 @@ END_EXTERN_C() #define ZVAL_STRING(z, s, duplicate) do { \ const char *__s=(s); \ zval *__z = (z); \ - Z_STRSIZE_P(__z) = (zend_str_size) strlen(__s); \ - Z_STRVAL_P(__z) = (duplicate?estrndup(__s, Z_STRSIZE_P(__z)):(char*)__s);\ + Z_STRLEN_P(__z) = strlen(__s); \ + Z_STRVAL_P(__z) = (duplicate?estrndup(__s, Z_STRLEN_P(__z)):(char*)__s);\ Z_TYPE_P(__z) = IS_STRING; \ } while (0) #define ZVAL_STRINGL(z, s, l, duplicate) do { \ - const char *__s=(s); zend_str_size __l= (zend_str_size) (l); \ + const char *__s=(s); int __l=l; \ zval *__z = (z); \ - Z_STRSIZE_P(__z) = __l; \ + Z_STRLEN_P(__z) = __l; \ Z_STRVAL_P(__z) = (duplicate?estrndup(__s, __l):(char*)__s);\ Z_TYPE_P(__z) = IS_STRING; \ } while (0) #define ZVAL_EMPTY_STRING(z) do { \ zval *__z = (z); \ - Z_STRSIZE_P(__z) = 0; \ + Z_STRLEN_P(__z) = 0; \ Z_STRVAL_P(__z) = STR_EMPTY_ALLOC();\ Z_TYPE_P(__z) = IS_STRING; \ } while (0) @@ -716,7 +716,7 @@ END_EXTERN_C() #define ZEND_DEFINE_PROPERTY(class_ptr, name, value, mask) \ { \ char *_name = (name); \ - zend_str_size namelen = strlen(_name); \ + int namelen = strlen(_name); \ zend_declare_property(class_ptr, _name, namelen, value, mask TSRMLS_CC); \ } diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 71bc420724371..c6aee57a73d96 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -433,7 +433,7 @@ struct _zend_mm_heap { int overflow; int internal; #if ZEND_MM_CACHE - size_t cached; + unsigned int cached; zend_mm_free_block *cache[ZEND_MM_NUM_BUCKETS]; #endif zend_mm_free_block *free_buckets[ZEND_MM_NUM_BUCKETS*2]; @@ -615,11 +615,11 @@ static unsigned int _zend_mm_cookie = 0; # define END_MAGIC_SIZE sizeof(unsigned int) # define ZEND_MM_SET_BLOCK_SIZE(block, __size) do { \ - char *__p; \ + char *p; \ ((zend_mm_block*)(block))->debug.size = (__size); \ - __p = ZEND_MM_END_MAGIC_PTR(block); \ + p = ZEND_MM_END_MAGIC_PTR(block); \ ((zend_mm_block*)(block))->debug.start_magic = _mem_block_start_magic; \ - memcpy(__p, &_mem_block_end_magic, END_MAGIC_SIZE); \ + memcpy(p, &_mem_block_end_magic, END_MAGIC_SIZE); \ } while (0) static unsigned int _mem_block_start_magic = 0; @@ -2465,7 +2465,7 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) size_t res = nmemb; unsigned long overflow = 0; - __asm__ ("mull %3\n\taddl %4,%0\n\tadcl $0,%1" + __asm__ ("mull %3\n\taddl %4,%0\n\tadcl %1,%1" : "=&a"(res), "=&d" (overflow) : "%0"(res), "rm"(size), @@ -2493,7 +2493,7 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) __asm__ ("mul" LP_SUFF " %3\n\t" "add %4,%0\n\t" - "adc $0,%1" + "adc %1,%1" : "=&a"(res), "=&d" (overflow) : "%0"(res), "rm"(size), @@ -2535,7 +2535,7 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset) size_t res; unsigned long 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,%1" : "=&r"(res), "=&r"(overflow) : "r"(nmemb), "r"(size), @@ -2619,7 +2619,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_str_size_int length; + int length; char *p; #ifdef ZEND_SIGNALS TSRMLS_FETCH(); @@ -2638,7 +2638,7 @@ ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) return p; } -ZEND_API char *_estrndup(const char *s, zend_str_size_uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) +ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) { char *p; #ifdef ZEND_SIGNALS @@ -2659,7 +2659,7 @@ ZEND_API char *_estrndup(const char *s, zend_str_size_uint length ZEND_FILE_LINE } -ZEND_API char *zend_strndup(const char *s, zend_str_size_uint length) +ZEND_API char *zend_strndup(const char *s, uint length) { char *p; #ifdef ZEND_SIGNALS diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index fbd424c333645..0b4e74d8971a2 100644 --- a/Zend/zend_alloc.h +++ b/Zend/zend_alloc.h @@ -26,7 +26,6 @@ #include "../TSRM/TSRM.h" #include "zend.h" -#include "zend_types.h" #ifndef ZEND_MM_ALIGNMENT # define ZEND_MM_ALIGNMENT 8 @@ -53,7 +52,7 @@ typedef struct _zend_leak_info { BEGIN_EXTERN_C() -ZEND_API char *zend_strndup(const char *s, zend_str_size_uint length) ZEND_ATTRIBUTE_MALLOC; +ZEND_API char *zend_strndup(const char *s, unsigned int length) ZEND_ATTRIBUTE_MALLOC; ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC ZEND_ATTRIBUTE_ALLOC_SIZE(1); ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; @@ -64,7 +63,7 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN ZEND_API void *_safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); ZEND_API void *_safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset); ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; -ZEND_API char *_estrndup(const char *s, zend_str_size_uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; +ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); /* Standard wrapper macros */ diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 83fcfa1e5d76e..47fb4d2d9b548 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -478,13 +478,13 @@ ZEND_FUNCTION(func_get_args) ZEND_FUNCTION(strlen) { char *s1; - zend_str_size s1_len; + int s1_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &s1, &s1_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &s1, &s1_len) == FAILURE) { return; } - RETVAL_LONG((long) s1_len); + RETVAL_LONG(s1_len); } /* }}} */ @@ -494,9 +494,9 @@ ZEND_FUNCTION(strlen) ZEND_FUNCTION(strcmp) { char *s1, *s2; - zend_str_size s1_len, s2_len; + int s1_len, s2_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &s1, &s1_len, &s2, &s2_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &s1, &s1_len, &s2, &s2_len) == FAILURE) { return; } @@ -510,10 +510,10 @@ ZEND_FUNCTION(strcmp) ZEND_FUNCTION(strncmp) { char *s1, *s2; - zend_str_size s1_len, s2_len; + int s1_len, s2_len; long len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSl", &s1, &s1_len, &s2, &s2_len, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl", &s1, &s1_len, &s2, &s2_len, &len) == FAILURE) { return; } @@ -532,9 +532,9 @@ ZEND_FUNCTION(strncmp) ZEND_FUNCTION(strcasecmp) { char *s1, *s2; - zend_str_size s1_len, s2_len; + int s1_len, s2_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &s1, &s1_len, &s2, &s2_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &s1, &s1_len, &s2, &s2_len) == FAILURE) { return; } @@ -548,10 +548,10 @@ ZEND_FUNCTION(strcasecmp) ZEND_FUNCTION(strncasecmp) { char *s1, *s2; - zend_str_size s1_len, s2_len; + int s1_len, s2_len; long len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSl", &s1, &s1_len, &s2, &s2_len, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl", &s1, &s1_len, &s2, &s2_len, &len) == FAILURE) { return; } @@ -571,7 +571,7 @@ ZEND_FUNCTION(each) { zval *array, *entry, **entry_ptr, *tmp; char *string_key; - zend_str_size string_key_len; + uint string_key_len; ulong num_key; zval **inserted_pointer; HashTable *target_hash; @@ -626,10 +626,10 @@ ZEND_FUNCTION(each) ZEND_FUNCTION(error_reporting) { char *err; - zend_str_size err_len; + int err_len; int old_error_reporting; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &err, &err_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &err, &err_len) == FAILURE) { return; } @@ -648,14 +648,14 @@ ZEND_FUNCTION(error_reporting) ZEND_FUNCTION(define) { char *name; - zend_str_size name_len; + int name_len; zval *val; zval *val_free = NULL; zend_bool non_cs = 0; int case_sensitive = CONST_CS; zend_constant c; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|b", &name, &name_len, &val, &non_cs) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|b", &name, &name_len, &val, &non_cs) == FAILURE) { return; } @@ -726,10 +726,10 @@ ZEND_FUNCTION(define) ZEND_FUNCTION(defined) { char *name; - zend_str_size name_len; + int name_len; zval c; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; } @@ -749,7 +749,7 @@ ZEND_FUNCTION(get_class) { zval *obj = NULL; const char *name = ""; - zend_str_size name_len = 0; + zend_uint name_len = 0; int dup; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|o!", &obj) == FAILURE) { @@ -797,7 +797,7 @@ ZEND_FUNCTION(get_parent_class) zval *arg; zend_class_entry *ce = NULL; const char *name; - zend_str_size name_length; + zend_uint name_length; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &arg) == FAILURE) { return; @@ -822,7 +822,7 @@ ZEND_FUNCTION(get_parent_class) } else if (Z_TYPE_P(arg) == IS_STRING) { zend_class_entry **pce; - if (zend_lookup_class(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), &pce TSRMLS_CC) == SUCCESS) { + if (zend_lookup_class(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &pce TSRMLS_CC) == SUCCESS) { ce = *pce; } } @@ -840,13 +840,13 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) { zval *obj; char *class_name; - zend_str_size class_name_len; + int class_name_len; zend_class_entry *instance_ce; zend_class_entry **ce; zend_bool allow_string = only_subclass; zend_bool retval; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS|b", &obj, &class_name, &class_name_len, &allow_string) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs|b", &obj, &class_name, &class_name_len, &allow_string) == FAILURE) { return; } /* @@ -858,7 +858,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) if (allow_string && Z_TYPE_P(obj) == IS_STRING) { zend_class_entry **the_ce; - if (zend_lookup_class(Z_STRVAL_P(obj), Z_STRSIZE_P(obj), &the_ce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(obj), Z_STRLEN_P(obj), &the_ce TSRMLS_CC) == FAILURE) { RETURN_FALSE; } instance_ce = *the_ce; @@ -907,7 +907,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value zend_property_info *prop_info; zval *prop, *prop_copy; char *key; - zend_str_size key_len; + uint key_len; ulong num_index; zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos); @@ -958,10 +958,10 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value ZEND_FUNCTION(get_class_vars) { char *class_name; - zend_str_size class_name_len; + int class_name_len; zend_class_entry **pce; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &class_name, &class_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &class_name, &class_name_len) == FAILURE) { return; } @@ -987,7 +987,7 @@ ZEND_FUNCTION(get_object_vars) HashPosition pos; char *key; const char *prop_name, *class_name; - zend_str_size key_len, prop_len; + uint key_len, prop_len; ulong num_index; zend_object *zobj; @@ -1025,7 +1025,7 @@ ZEND_FUNCTION(get_object_vars) } /* }}} */ -static int same_name(const char *key, const char *name, zend_str_size_uint name_len) +static int same_name(const char *key, const char *name, zend_uint name_len) { char *lcname = zend_str_tolower_dup(name, name_len); int ret = memcmp(lcname, key, name_len) == 0; @@ -1054,7 +1054,7 @@ ZEND_FUNCTION(get_class_methods) } ce = Z_OBJCE_P(klass); } else if (Z_TYPE_P(klass) == IS_STRING) { - if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRSIZE_P(klass), &pce TSRMLS_CC) == SUCCESS) { + if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRLEN_P(klass), &pce TSRMLS_CC) == SUCCESS) { ce = *pce; } } @@ -1074,9 +1074,9 @@ ZEND_FUNCTION(get_class_methods) || ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) && EG(scope) == mptr->common.scope)))) { char *key; - zend_str_size key_len; + uint key_len; ulong num_index; - zend_str_size len = strlen(mptr->common.function_name); + uint len = strlen(mptr->common.function_name); /* Do not display old-style inherited constructors */ if (zend_hash_get_current_key_ex(&ce->function_table, &key, &key_len, &num_index, 0, &pos) != HASH_KEY_IS_STRING) { @@ -1113,17 +1113,17 @@ ZEND_FUNCTION(method_exists) { zval *klass; char *method_name; - zend_str_size method_len; + int method_len; char *lcname; zend_class_entry * ce, **pce; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &klass, &method_name, &method_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &klass, &method_name, &method_len) == FAILURE) { return; } if (Z_TYPE_P(klass) == IS_OBJECT) { ce = Z_OBJCE_P(klass); } else if (Z_TYPE_P(klass) == IS_STRING) { - if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRSIZE_P(klass), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(klass), Z_STRLEN_P(klass), &pce TSRMLS_CC) == FAILURE) { RETURN_FALSE; } ce = *pce; @@ -1170,13 +1170,13 @@ ZEND_FUNCTION(property_exists) { zval *object; char *property; - zend_str_size property_len; + int property_len; zend_class_entry *ce, **pce; zend_property_info *property_info; zval property_z; ulong h; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &object, &property, &property_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &object, &property, &property_len) == FAILURE) { return; } @@ -1185,7 +1185,7 @@ ZEND_FUNCTION(property_exists) } if (Z_TYPE_P(object) == IS_STRING) { - if (zend_lookup_class(Z_STRVAL_P(object), Z_STRSIZE_P(object), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(object), Z_STRLEN_P(object), &pce TSRMLS_CC) == FAILURE) { RETURN_FALSE; } ce = *pce; @@ -1220,18 +1220,18 @@ ZEND_FUNCTION(class_exists) { char *class_name, *lc_name; zend_class_entry **ce; - zend_str_size class_name_len; + int class_name_len; int found; zend_bool autoload = 1; ALLOCA_FLAG(use_heap) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &class_name, &class_name_len, &autoload) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &class_name, &class_name_len, &autoload) == FAILURE) { return; } if (!autoload) { char *name; - zend_str_size len; + int len; lc_name = do_alloca(class_name_len + 1, use_heap); zend_str_tolower_copy(lc_name, class_name, class_name_len); @@ -1263,18 +1263,18 @@ ZEND_FUNCTION(interface_exists) { char *iface_name, *lc_name; zend_class_entry **ce; - zend_str_size iface_name_len; + int iface_name_len; int found; zend_bool autoload = 1; ALLOCA_FLAG(use_heap) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &iface_name, &iface_name_len, &autoload) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &iface_name, &iface_name_len, &autoload) == FAILURE) { return; } if (!autoload) { char *name; - zend_str_size len; + int len; lc_name = do_alloca(iface_name_len + 1, use_heap); zend_str_tolower_copy(lc_name, iface_name, iface_name_len); @@ -1306,18 +1306,18 @@ ZEND_FUNCTION(trait_exists) { char *trait_name, *lc_name; zend_class_entry **ce; - zend_str_size trait_name_len; + int trait_name_len; int found; zend_bool autoload = 1; ALLOCA_FLAG(use_heap) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &trait_name, &trait_name_len, &autoload) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &trait_name, &trait_name_len, &autoload) == FAILURE) { return; } if (!autoload) { char *name; - zend_str_size len; + int len; lc_name = do_alloca(trait_name_len + 1, use_heap); zend_str_tolower_copy(lc_name, trait_name, trait_name_len); @@ -1349,12 +1349,12 @@ ZEND_FUNCTION(trait_exists) ZEND_FUNCTION(function_exists) { char *name; - zend_str_size name_len; + int name_len; zend_function *func; char *lcname; zend_bool retval; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; } @@ -1390,12 +1390,12 @@ ZEND_FUNCTION(class_alias) { char *class_name, *lc_name, *alias_name; zend_class_entry **ce; - zend_str_size class_name_len, alias_name_len; + int class_name_len, alias_name_len; int found; zend_bool autoload = 1; ALLOCA_FLAG(use_heap) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|b", &class_name, &class_name_len, &alias_name, &alias_name_len, &autoload) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|b", &class_name, &class_name_len, &alias_name, &alias_name_len, &autoload) == FAILURE) { return; } @@ -1502,9 +1502,9 @@ ZEND_FUNCTION(trigger_error) { long error_type = E_USER_NOTICE; char *message; - zend_str_size message_len; + int message_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &message, &message_len, &error_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &message, &message_len, &error_type) == FAILURE) { return; } @@ -1794,11 +1794,11 @@ ZEND_FUNCTION(get_defined_vars) ZEND_FUNCTION(create_function) { char *eval_code, *function_name, *function_args, *function_code; - zend_str_size eval_code_length, function_name_length, function_args_len, function_code_len; + int eval_code_length, function_name_length, function_args_len, function_code_len; int retval; char *eval_name; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &function_args, &function_args_len, &function_code, &function_code_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &function_args, &function_args_len, &function_code, &function_code_len) == FAILURE) { return; } @@ -1911,11 +1911,6 @@ static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC) zval *name_array = (zval *)arg; zval *const_val; - if (!constant->name) { - /* skip special constants */ - return 0; - } - MAKE_STD_ZVAL(const_val); *const_val = constant->value; zval_copy_ctor(const_val); @@ -1983,16 +1978,11 @@ ZEND_FUNCTION(get_defined_constants) while (zend_hash_get_current_data_ex(EG(zend_constants), (void **) &val, &pos) != FAILURE) { zval *const_val; - if (!val->name) { - /* skip special constants */ - goto next_constant; - } - if (val->module_number == PHP_USER_CONSTANT) { module_number = i; } else if (val->module_number > i || val->module_number < 0) { /* should not happen */ - goto next_constant; + goto bad_module_id; } else { module_number = val->module_number; } @@ -2009,7 +1999,7 @@ ZEND_FUNCTION(get_defined_constants) INIT_PZVAL(const_val); add_assoc_zval_ex(modules[module_number], val->name, val->name_len, const_val); -next_constant: +bad_module_id: zend_hash_move_forward_ex(EG(zend_constants), &pos); } efree(module_names); @@ -2067,7 +2057,7 @@ void debug_print_backtrace_args(zval *arg_array TSRMLS_DC) ZEND_FUNCTION(debug_print_backtrace) { zend_execute_data *ptr, *skip; - zend_str_size lineno, frameno = 0; + int lineno, frameno = 0; const char *function_name; const char *filename; const char *class_name = NULL; @@ -2127,7 +2117,7 @@ ZEND_FUNCTION(debug_print_backtrace) if (ptr->function_state.function->common.scope) { class_name = ptr->function_state.function->common.scope->name; } else { - zend_str_size class_name_len; + zend_uint class_name_len; int dup; dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC); @@ -2235,7 +2225,7 @@ ZEND_FUNCTION(debug_print_backtrace) ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int limit TSRMLS_DC) { zend_execute_data *ptr, *skip; - zend_str_size lineno, frameno = 0; + int lineno, frameno = 0; const char *function_name; const char *filename; const char *class_name; @@ -2317,7 +2307,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int if (ptr->function_state.function->common.scope) { add_assoc_string_ex(stack_frame, "class", sizeof("class"), (char*)ptr->function_state.function->common.scope->name, 1); } else { - zend_str_size class_name_len; + zend_uint class_name_len; int dup; dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC); @@ -2381,7 +2371,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int MAKE_STD_ZVAL(arg_array); array_init(arg_array); - /* include_filename always points to the last filename of the last last called-function. + /* include_filename always points to the last filename of the last last called-fuction. if we have called include in the frame above - this is the file we have included. */ @@ -2422,10 +2412,10 @@ ZEND_FUNCTION(debug_backtrace) ZEND_FUNCTION(extension_loaded) { char *extension_name; - zend_str_size extension_name_len; + int extension_name_len; char *lcname; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &extension_name, &extension_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension_name, &extension_name_len) == FAILURE) { return; } @@ -2445,11 +2435,11 @@ ZEND_FUNCTION(extension_loaded) ZEND_FUNCTION(get_extension_funcs) { char *extension_name; - zend_str_size extension_name_len; + int extension_name_len; zend_module_entry *module; const zend_function_entry *func; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &extension_name, &extension_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension_name, &extension_name_len) == FAILURE) { return; } diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 6cca9e9befb8f..5faefbd2241a4 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -101,19 +101,19 @@ ZEND_METHOD(Closure, bind) ce = NULL; } else { char *class_name; - zend_str_size class_name_len; + int class_name_len; zval tmp_zval; INIT_ZVAL(tmp_zval); if (Z_TYPE_P(scope_arg) == IS_STRING) { class_name = Z_STRVAL_P(scope_arg); - class_name_len = Z_STRSIZE_P(scope_arg); + class_name_len = Z_STRLEN_P(scope_arg); } else { tmp_zval = *scope_arg; zval_copy_ctor(&tmp_zval); convert_to_string(&tmp_zval); class_name = Z_STRVAL(tmp_zval); - class_name_len = Z_STRSIZE(tmp_zval); + class_name_len = Z_STRLEN(tmp_zval); } if ((class_name_len == sizeof("static") - 1) && @@ -180,7 +180,7 @@ ZEND_API zval* zend_get_closure_this_ptr(zval *obj TSRMLS_DC) /* {{{ */ } /* }}} */ -static zend_function *zend_closure_get_method(zval **object_ptr, char *method_name, zend_str_size_int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */ +static zend_function *zend_closure_get_method(zval **object_ptr, char *method_name, int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */ { char *lc_name; ALLOCA_FLAG(use_heap) @@ -351,7 +351,7 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_ for (i = 0; i < closure->func.common.num_args; i++) { char *name, *info; - zend_str_size name_len, info_len; + int name_len, info_len; if (arg_info->name) { name_len = zend_spprintf(&name, 0, "%s$%s", arg_info->pass_by_reference ? "&" : "", diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index c61d1df1ed24d..faef3a9197d0b 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -64,7 +64,7 @@ if (IS_INTERNED(Z_STRVAL(CONSTANT(num)))) { \ Z_HASH_P(&CONSTANT(num)) = INTERNED_HASH(Z_STRVAL(CONSTANT(num))); \ } else { \ - Z_HASH_P(&CONSTANT(num)) = zend_hash_func(Z_STRVAL(CONSTANT(num)), Z_STRSIZE(CONSTANT(num))+1); \ + Z_HASH_P(&CONSTANT(num)) = zend_hash_func(Z_STRVAL(CONSTANT(num)), Z_STRLEN(CONSTANT(num))+1); \ } \ } while (0) @@ -139,10 +139,10 @@ static void zend_destroy_property_info_internal(zend_property_info *property_inf } /* }}} */ -static void build_runtime_defined_function_key(zval *result, const char *name, zend_str_size_int name_length TSRMLS_DC) /* {{{ */ +static void build_runtime_defined_function_key(zval *result, const char *name, int name_length TSRMLS_DC) /* {{{ */ { char char_pos_buf[32]; - zend_str_size char_pos_len; + uint char_pos_len; const char *filename; char_pos_len = zend_sprintf(char_pos_buf, "%p", LANG_SCNG(yy_text)); @@ -249,7 +249,7 @@ void shutdown_compiler(TSRMLS_D) /* {{{ */ ZEND_API char *zend_set_compiled_filename(const char *new_compiled_filename TSRMLS_DC) /* {{{ */ { char **pp, *p; - zend_str_size length = strlen(new_compiled_filename); + int length = strlen(new_compiled_filename); if (zend_hash_find(&CG(filenames_table), new_compiled_filename, length+1, (void **) &pp) == SUCCESS) { CG(compiled_filename) = *pp; @@ -274,7 +274,7 @@ ZEND_API char *zend_get_compiled_filename(TSRMLS_D) /* {{{ */ } /* }}} */ -ZEND_API zend_str_size_int zend_get_compiled_lineno(TSRMLS_D) /* {{{ */ +ZEND_API int zend_get_compiled_lineno(TSRMLS_D) /* {{{ */ { return CG(zend_lineno); } @@ -292,7 +292,7 @@ static zend_uint get_temporary_variable(zend_op_array *op_array) /* {{{ */ } /* }}} */ -static int lookup_cv(zend_op_array *op_array, char* name, zend_str_size_int name_len, ulong hash TSRMLS_DC) /* {{{ */ +static int lookup_cv(zend_op_array *op_array, char* name, int name_len, ulong hash TSRMLS_DC) /* {{{ */ { int i = 0; ulong hash_value = hash ? hash : zend_inline_hash_func(name, name_len+1); @@ -336,7 +336,7 @@ static inline void zend_insert_literal(zend_op_array *op_array, const zval *zv, { if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_CONSTANT) { zval *z = (zval*)zv; - Z_STRVAL_P(z) = (char*)zend_new_interned_string(Z_STRVAL_P(zv), Z_STRSIZE_P(zv) + 1, 1 TSRMLS_CC); + Z_STRVAL_P(z) = (char*)zend_new_interned_string(Z_STRVAL_P(zv), Z_STRLEN_P(zv) + 1, 1 TSRMLS_CC); } CONSTANT_EX(op_array, literal_position) = *zv; Z_SET_REFCOUNT(CONSTANT_EX(op_array, literal_position), 2); @@ -392,8 +392,8 @@ int zend_add_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC ret = zend_add_literal(op_array, zv TSRMLS_CC); } - lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv), Z_STRSIZE_P(zv)); - ZVAL_STRINGL(&c, lc_name, Z_STRSIZE_P(zv), 0); + lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv), Z_STRLEN_P(zv)); + ZVAL_STRINGL(&c, lc_name, Z_STRLEN_P(zv), 0); lc_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC); CALCULATE_LITERAL_HASH(lc_literal); @@ -406,7 +406,7 @@ int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS int ret; char *lc_name; const char *ns_separator; - zend_str_size lc_len; + int lc_len; zval c; int lc_literal; @@ -419,13 +419,13 @@ int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS ret = zend_add_literal(op_array, zv TSRMLS_CC); } - lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv), Z_STRSIZE_P(zv)); - ZVAL_STRINGL(&c, lc_name, Z_STRSIZE_P(zv), 0); + lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv), Z_STRLEN_P(zv)); + ZVAL_STRINGL(&c, lc_name, Z_STRLEN_P(zv), 0); lc_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC); CALCULATE_LITERAL_HASH(lc_literal); - ns_separator = (const char*)zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRSIZE_P(zv)) + 1; - lc_len = Z_STRSIZE_P(zv) - (ns_separator - Z_STRVAL_P(zv)); + ns_separator = (const char*)zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRLEN_P(zv)) + 1; + lc_len = Z_STRLEN_P(zv) - (ns_separator - Z_STRVAL_P(zv)); lc_name = zend_str_tolower_dup(ns_separator, lc_len); ZVAL_STRINGL(&c, lc_name, lc_len, 0); lc_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC); @@ -439,7 +439,7 @@ int zend_add_class_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_D { int ret; char *lc_name; - zend_str_size lc_len; + int lc_len; zval c; int lc_literal; @@ -453,10 +453,10 @@ int zend_add_class_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_D } if (Z_STRVAL_P(zv)[0] == '\\') { - lc_len = Z_STRSIZE_P(zv) - 1; + lc_len = Z_STRLEN_P(zv) - 1; lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv) + 1, lc_len); } else { - lc_len = Z_STRSIZE_P(zv); + lc_len = Z_STRLEN_P(zv); lc_name = zend_str_tolower_dup(Z_STRVAL_P(zv), lc_len); } ZVAL_STRINGL(&c, lc_name, lc_len, 0); @@ -474,7 +474,7 @@ int zend_add_const_name_literal(zend_op_array *op_array, const zval *zv, int unq int ret, tmp_literal; char *name, *tmp_name; const char *ns_separator; - zend_str_size name_len, ns_len; + int name_len, ns_len; zval c; if (op_array->last_literal > 0 && @@ -488,10 +488,10 @@ int zend_add_const_name_literal(zend_op_array *op_array, const zval *zv, int unq /* skip leading '\\' */ if (Z_STRVAL_P(zv)[0] == '\\') { - name_len = Z_STRSIZE_P(zv) - 1; + name_len = Z_STRLEN_P(zv) - 1; name = Z_STRVAL_P(zv) + 1; } else { - name_len = Z_STRSIZE_P(zv); + name_len = Z_STRLEN_P(zv); name = Z_STRVAL_P(zv); } ns_separator = zend_memrchr(name, '\\', name_len); @@ -722,7 +722,7 @@ void zend_do_fetch_static_member(znode *result, znode *class_name TSRMLS_DC) /* zend_op opline; if (class_name->op_type == IS_CONST && - ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant))) { + ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { zend_resolve_class_name(class_name, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); class_node = *class_name; } else { @@ -827,7 +827,7 @@ void fetch_array_dim(znode *result, const znode *parent, const znode *dim TSRMLS ulong index; int numeric = 0; - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline.op2.constant)), Z_STRSIZE(CONSTANT(opline.op2.constant))+1, index, numeric = 1); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline.op2.constant)), Z_STRLEN(CONSTANT(opline.op2.constant))+1, index, numeric = 1); if (numeric) { zval_dtor(&CONSTANT(opline.op2.constant)); ZVAL_LONG(&CONSTANT(opline.op2.constant), index); @@ -909,7 +909,7 @@ static zend_bool opline_is_fetch_this(const zend_op *opline TSRMLS_DC) /* {{{ */ if ((opline->opcode == ZEND_FETCH_W) && (opline->op1_type == IS_CONST) && (Z_TYPE(CONSTANT(opline->op1.constant)) == IS_STRING) && (Z_HASH_P(&CONSTANT(opline->op1.constant)) == THIS_HASHVAL) - && (Z_STRSIZE(CONSTANT(opline->op1.constant)) == (sizeof("this")-1)) + && (Z_STRLEN(CONSTANT(opline->op1.constant)) == (sizeof("this")-1)) && !memcmp(Z_STRVAL(CONSTANT(opline->op1.constant)), "this", sizeof("this"))) { return 1; } else { @@ -1317,7 +1317,7 @@ void zend_do_end_variable_parse(znode *variable, int type, int arg_offset TSRMLS this_var = opline_ptr->result.var; if (CG(active_op_array)->this_var == -1) { - CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), Z_STRVAL(CONSTANT(opline_ptr->op1.constant)), Z_STRSIZE(CONSTANT(opline_ptr->op1.constant)), Z_HASH_P(&CONSTANT(opline_ptr->op1.constant)) TSRMLS_CC); + CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), Z_STRVAL(CONSTANT(opline_ptr->op1.constant)), Z_STRLEN(CONSTANT(opline_ptr->op1.constant)), Z_HASH_P(&CONSTANT(opline_ptr->op1.constant)) TSRMLS_CC); Z_TYPE(CONSTANT(opline_ptr->op1.constant)) = IS_NULL; } else { zend_del_literal(CG(active_op_array), opline_ptr->op1.constant); @@ -1394,10 +1394,10 @@ void zend_do_add_string(znode *result, const znode *op1, znode *op2 TSRMLS_DC) / { zend_op *opline; - if (Z_STRSIZE(op2->u.constant) > 1) { + if (Z_STRLEN(op2->u.constant) > 1) { opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_ADD_STRING; - } else if (Z_STRSIZE(op2->u.constant) == 1) { + } else if (Z_STRLEN(op2->u.constant) == 1) { int ch = *Z_STRVAL(op2->u.constant); /* Free memory and use ZEND_ADD_CHAR in case of 1 character strings */ @@ -1527,8 +1527,8 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n { zend_op_array op_array; char *name = function_name->u.constant.value.str.val; - zend_str_size name_len = function_name->u.constant.value.str.len; - zend_str_size function_begin_line = function_token->u.op.opline_num; + int name_len = function_name->u.constant.value.str.len; + int function_begin_line = function_token->u.op.opline_num; zend_uint fn_flags; const char *lcname; zend_bool orig_interactive; @@ -1704,7 +1704,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n zval_copy_ctor(&tmp.u.constant); zend_do_build_namespace_name(&tmp, &tmp, function_name TSRMLS_CC); op_array.function_name = Z_STRVAL(tmp.u.constant); - name_len = Z_STRSIZE(tmp.u.constant); + name_len = Z_STRLEN(tmp.u.constant); lcname = zend_str_tolower_dup(Z_STRVAL(tmp.u.constant), name_len); } else { lcname = zend_str_tolower_dup(name, name_len); @@ -1714,12 +1714,12 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n opline->op1_type = IS_CONST; build_runtime_defined_function_key(&key, lcname, name_len TSRMLS_CC); opline->op1.constant = zend_add_literal(CG(active_op_array), &key TSRMLS_CC); - Z_HASH_P(&CONSTANT(opline->op1.constant)) = zend_hash_func(Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRSIZE(CONSTANT(opline->op1.constant))); + Z_HASH_P(&CONSTANT(opline->op1.constant)) = zend_hash_func(Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRLEN(CONSTANT(opline->op1.constant))); opline->op2_type = IS_CONST; LITERAL_STRINGL(opline->op2, lcname, name_len, 0); CALCULATE_LITERAL_HASH(opline->op2.constant); opline->extended_value = ZEND_DECLARE_FUNCTION; - zend_hash_quick_update(CG(function_table), Z_STRVAL(key), Z_STRSIZE(key), Z_HASH_P(&CONSTANT(opline->op1.constant)), &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)); + zend_hash_quick_update(CG(function_table), Z_STRVAL(key), Z_STRLEN(key), Z_HASH_P(&CONSTANT(opline->op1.constant)), &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)); zend_stack_push(&CG(context_stack), (void *) &CG(context), sizeof(CG(context))); zend_init_compiler_context(TSRMLS_C); } @@ -1734,7 +1734,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n } { - /* Push a separator to the switch stack */ + /* Push a seperator to the switch stack */ zend_switch_entry switch_entry; switch_entry.cond.op_type = IS_UNUSED; @@ -1803,7 +1803,7 @@ void zend_do_handle_exception(TSRMLS_D) /* {{{ */ void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC) /* {{{ */ { char lcname[16]; - zend_str_size name_len; + int name_len; zend_do_extended_info(TSRMLS_C); zend_do_return(NULL, 0 TSRMLS_CC); @@ -1828,7 +1828,7 @@ void zend_do_end_function_declaration(const znode *function_token TSRMLS_DC) /* CG(active_op_array) = function_token->u.op_array; - /* Pop the switch and foreach separators */ + /* Pop the switch and foreach seperators */ zend_stack_del_top(&CG(switch_cond_stack)); zend_stack_del_top(&CG(foreach_copy_stack)); } @@ -1842,14 +1842,14 @@ void zend_do_receive_arg(zend_uchar op, znode *varname, const znode *offset, con if (class_type->op_type == IS_CONST && Z_TYPE(class_type->u.constant) == IS_STRING && - Z_STRSIZE(class_type->u.constant) == 0) { + Z_STRLEN(class_type->u.constant) == 0) { /* Usage of namespace as class name not in namespace */ zval_dtor(&class_type->u.constant); zend_error(E_COMPILE_ERROR, "Cannot use 'namespace' as a class name"); return; } - if (zend_is_auto_global_quick(Z_STRVAL(varname->u.constant), Z_STRSIZE(varname->u.constant), 0 TSRMLS_CC)) { + if (zend_is_auto_global_quick(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant), 0 TSRMLS_CC)) { zend_error(E_COMPILE_ERROR, "Cannot re-assign auto-global variable %s", Z_STRVAL(varname->u.constant)); } else { var.op_type = IS_CV; @@ -1857,7 +1857,7 @@ void zend_do_receive_arg(zend_uchar op, znode *varname, const znode *offset, con Z_STRVAL(varname->u.constant) = (char*)CG(active_op_array)->vars[var.u.op.var].name; var.EA = 0; if (CG(active_op_array)->vars[var.u.op.var].hash_value == THIS_HASHVAL && - Z_STRSIZE(varname->u.constant) == sizeof("this")-1 && + Z_STRLEN(varname->u.constant) == sizeof("this")-1 && !memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this")-1)) { if (CG(active_op_array)->scope && (CG(active_op_array)->fn_flags & ZEND_ACC_STATIC) == 0) { @@ -1912,7 +1912,7 @@ void zend_do_receive_arg(zend_uchar op, znode *varname, const znode *offset, con } } else { cur_arg_info->type_hint = IS_OBJECT; - if (ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_type->u.constant), Z_STRSIZE(class_type->u.constant))) { + if (ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_type->u.constant), Z_STRLEN(class_type->u.constant))) { zend_resolve_class_name(class_type, opline->extended_value, 1 TSRMLS_CC); } Z_STRVAL(class_type->u.constant) = (char*)zend_new_interned_string(class_type->u.constant.value.str.val, class_type->u.constant.value.str.len + 1, 1 TSRMLS_CC); @@ -1935,7 +1935,7 @@ int zend_do_begin_function_call(znode *function_name, zend_bool check_namespace { zend_function *function; char *lcname; - char *is_compound = memchr(Z_STRVAL(function_name->u.constant), '\\', Z_STRSIZE(function_name->u.constant)); + char *is_compound = memchr(Z_STRVAL(function_name->u.constant), '\\', Z_STRLEN(function_name->u.constant)); zend_resolve_non_class_name(function_name, check_namespace TSRMLS_CC); @@ -1981,8 +1981,8 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) /* {{{ */ last_op_number = get_next_op_number(CG(active_op_array))-1; last_op = &CG(active_op_array)->opcodes[last_op_number]; - if ((last_op->op2_type == IS_CONST) && (Z_TYPE(CONSTANT(last_op->op2.constant)) == IS_STRING) && (Z_STRSIZE(CONSTANT(last_op->op2.constant)) == sizeof(ZEND_CLONE_FUNC_NAME)-1) - && !zend_binary_strcasecmp(Z_STRVAL(CONSTANT(last_op->op2.constant)), Z_STRSIZE(CONSTANT(last_op->op2.constant)), ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1)) { + if ((last_op->op2_type == IS_CONST) && (Z_TYPE(CONSTANT(last_op->op2.constant)) == IS_STRING) && (Z_STRLEN(CONSTANT(last_op->op2.constant)) == sizeof(ZEND_CLONE_FUNC_NAME)-1) + && !zend_binary_strcasecmp(Z_STRVAL(CONSTANT(last_op->op2.constant)), Z_STRLEN(CONSTANT(last_op->op2.constant)), ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1)) { zend_error(E_COMPILE_ERROR, "Cannot call __clone() method on objects - use 'clone $obj' instead"); } @@ -1994,7 +1994,7 @@ void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC) /* {{{ */ zend_error(E_COMPILE_ERROR, "Method name must be a string"); } if (!IS_INTERNED(Z_STRVAL(name))) { - Z_STRVAL(name) = estrndup(Z_STRVAL(name), Z_STRSIZE(name)); + Z_STRVAL(name) = estrndup(Z_STRVAL(name), Z_STRLEN(name)); } FREE_POLYMORPHIC_CACHE_SLOT(last_op->op2.constant); last_op->op2.constant = @@ -2079,14 +2079,14 @@ void zend_do_begin_dynamic_function_call(znode *function_name, int ns_call TSRML void zend_resolve_non_class_name(znode *element_name, zend_bool check_namespace TSRMLS_DC) /* {{{ */ { znode tmp; - zend_str_size len; + int len; zval **ns; - char *lcname, *compound = memchr(Z_STRVAL(element_name->u.constant), '\\', Z_STRSIZE(element_name->u.constant)); + char *lcname, *compound = memchr(Z_STRVAL(element_name->u.constant), '\\', Z_STRLEN(element_name->u.constant)); if (Z_STRVAL(element_name->u.constant)[0] == '\\') { /* name starts with \ so it is known and unambiguos, nothing to do here but shorten it */ - memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+1, Z_STRSIZE(element_name->u.constant)); - --Z_STRSIZE(element_name->u.constant); + memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+1, Z_STRLEN(element_name->u.constant)); + --Z_STRLEN(element_name->u.constant); return; } @@ -2104,8 +2104,8 @@ void zend_resolve_non_class_name(znode *element_name, zend_bool check_namespace tmp.u.constant = **ns; zval_copy_ctor(&tmp.u.constant); len += 1; - Z_STRSIZE(element_name->u.constant) -= len; - memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+len, Z_STRSIZE(element_name->u.constant)+1); + Z_STRLEN(element_name->u.constant) -= len; + memmove(Z_STRVAL(element_name->u.constant), Z_STRVAL(element_name->u.constant)+len, Z_STRLEN(element_name->u.constant)+1); zend_do_build_namespace_name(&tmp, &tmp, element_name TSRMLS_CC); *element_name = tmp; efree(lcname); @@ -2116,11 +2116,11 @@ void zend_resolve_non_class_name(znode *element_name, zend_bool check_namespace if (CG(current_namespace)) { tmp = *element_name; - Z_STRSIZE(tmp.u.constant) = sizeof("\\")-1 + Z_STRSIZE(element_name->u.constant) + Z_STRSIZE_P(CG(current_namespace)); - Z_STRVAL(tmp.u.constant) = (char *) emalloc(Z_STRSIZE(tmp.u.constant)+1); - memcpy(Z_STRVAL(tmp.u.constant), Z_STRVAL_P(CG(current_namespace)), Z_STRSIZE_P(CG(current_namespace))); - memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRSIZE_P(CG(current_namespace))]), "\\", sizeof("\\")-1); - memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRSIZE_P(CG(current_namespace)) + sizeof("\\")-1]), Z_STRVAL(element_name->u.constant), Z_STRSIZE(element_name->u.constant)+1); + Z_STRLEN(tmp.u.constant) = sizeof("\\")-1 + Z_STRLEN(element_name->u.constant) + Z_STRLEN_P(CG(current_namespace)); + Z_STRVAL(tmp.u.constant) = (char *) emalloc(Z_STRLEN(tmp.u.constant)+1); + memcpy(Z_STRVAL(tmp.u.constant), Z_STRVAL_P(CG(current_namespace)), Z_STRLEN_P(CG(current_namespace))); + memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN_P(CG(current_namespace))]), "\\", sizeof("\\")-1); + memcpy(&(Z_STRVAL(tmp.u.constant)[Z_STRLEN_P(CG(current_namespace)) + sizeof("\\")-1]), Z_STRVAL(element_name->u.constant), Z_STRLEN(element_name->u.constant)+1); STR_FREE(Z_STRVAL(element_name->u.constant)); *element_name = tmp; } @@ -2180,20 +2180,20 @@ void zend_resolve_class_name(znode *class_name, ulong fetch_type, int check_ns_n char *lcname; zval **ns; znode tmp; - zend_str_size len; + int len; - compound = memchr(Z_STRVAL(class_name->u.constant), '\\', Z_STRSIZE(class_name->u.constant)); + compound = memchr(Z_STRVAL(class_name->u.constant), '\\', Z_STRLEN(class_name->u.constant)); if (compound) { /* This is a compound class name that contains namespace prefix */ if (Z_STRVAL(class_name->u.constant)[0] == '\\') { /* The STRING name has "\" prefix */ - Z_STRSIZE(class_name->u.constant) -= 1; - memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+1, Z_STRSIZE(class_name->u.constant)+1); + Z_STRLEN(class_name->u.constant) -= 1; + memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+1, Z_STRLEN(class_name->u.constant)+1); Z_STRVAL(class_name->u.constant) = erealloc( Z_STRVAL(class_name->u.constant), - Z_STRSIZE(class_name->u.constant) + 1); + Z_STRLEN(class_name->u.constant) + 1); - if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant))) { + if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { zend_error(E_COMPILE_ERROR, "'\\%s' is an invalid class name", Z_STRVAL(class_name->u.constant)); } } else { @@ -2207,8 +2207,8 @@ void zend_resolve_class_name(znode *class_name, ulong fetch_type, int check_ns_n tmp.u.constant = **ns; zval_copy_ctor(&tmp.u.constant); len += 1; - Z_STRSIZE(class_name->u.constant) -= len; - memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+len, Z_STRSIZE(class_name->u.constant)+1); + Z_STRLEN(class_name->u.constant) -= len; + memmove(Z_STRVAL(class_name->u.constant), Z_STRVAL(class_name->u.constant)+len, Z_STRLEN(class_name->u.constant)+1); zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC); *class_name = tmp; efree(lcname); @@ -2227,10 +2227,10 @@ void zend_resolve_class_name(znode *class_name, ulong fetch_type, int check_ns_n } } else if (CG(current_import) || CG(current_namespace)) { /* this is a plain name (without \) */ - lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant)); + lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant)); if (CG(current_import) && - zend_hash_find(CG(current_import), lcname, Z_STRSIZE(class_name->u.constant)+1, (void**)&ns) == SUCCESS) { + zend_hash_find(CG(current_import), lcname, Z_STRLEN(class_name->u.constant)+1, (void**)&ns) == SUCCESS) { /* The given name is an import name. Substitute it. */ zval_dtor(&class_name->u.constant); class_name->u.constant = **ns; @@ -2255,7 +2255,7 @@ void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC) /* {{{ */ if (class_name->op_type == IS_CONST && Z_TYPE(class_name->u.constant) == IS_STRING && - Z_STRSIZE(class_name->u.constant) == 0) { + Z_STRLEN(class_name->u.constant) == 0) { /* Usage of namespace as class name not in namespace */ zval_dtor(&class_name->u.constant); zend_error(E_COMPILE_ERROR, "Cannot use 'namespace' as a class name"); @@ -2310,7 +2310,7 @@ void zend_do_label(znode *label TSRMLS_DC) /* {{{ */ dest.brk_cont = CG(context).current_brk_cont; dest.opline_num = get_next_op_number(CG(active_op_array)); - if (zend_hash_add(CG(context).labels, Z_STRVAL(label->u.constant), Z_STRSIZE(label->u.constant) + 1, (void**)&dest, sizeof(zend_label), NULL) == FAILURE) { + if (zend_hash_add(CG(context).labels, Z_STRVAL(label->u.constant), Z_STRLEN(label->u.constant) + 1, (void**)&dest, sizeof(zend_label), NULL) == FAILURE) { zend_error(E_COMPILE_ERROR, "Label '%s' already defined", Z_STRVAL(label->u.constant)); } @@ -2331,7 +2331,7 @@ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2 label = &CONSTANT_EX(op_array, opline->op2.constant); } if (CG(context).labels == NULL || - zend_hash_find(CG(context).labels, Z_STRVAL_P(label), Z_STRSIZE_P(label)+1, (void**)&dest) == FAILURE) { + zend_hash_find(CG(context).labels, Z_STRVAL_P(label), Z_STRLEN_P(label)+1, (void**)&dest) == FAILURE) { if (pass2) { CG(in_compilation) = 1; @@ -2410,7 +2410,7 @@ void zend_release_labels(int temporary TSRMLS_DC) /* {{{ */ void zend_do_build_full_name(znode *result, znode *prefix, znode *name, int is_class_member TSRMLS_DC) /* {{{ */ { - zend_str_size length; + zend_uint length; if (!result) { result = prefix; @@ -2447,8 +2447,8 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na if (Z_TYPE(method_name->u.constant) != IS_STRING) { zend_error(E_COMPILE_ERROR, "Method name must be a string"); } - lcname = zend_str_tolower_dup(Z_STRVAL(method_name->u.constant), Z_STRSIZE(method_name->u.constant)); - if ((sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRSIZE(method_name->u.constant) && + lcname = zend_str_tolower_dup(Z_STRVAL(method_name->u.constant), Z_STRLEN(method_name->u.constant)); + if ((sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == Z_STRLEN(method_name->u.constant) && memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == 0) { zval_dtor(&method_name->u.constant); method_name->op_type = IS_UNUSED; @@ -2457,7 +2457,7 @@ int zend_do_begin_class_member_function_call(znode *class_name, znode *method_na } if (class_name->op_type == IS_CONST && - ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant))) { + ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { zend_resolve_class_name(class_name, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); class_node = *class_name; opline = get_next_op(CG(active_op_array) TSRMLS_CC); @@ -2671,7 +2671,7 @@ static int generate_free_foreach_copy(const zend_op *foreach_copy TSRMLS_DC) /* { zend_op *opline; - /* If we reach the separator then stop applying the stack */ + /* If we reach the seperator then stop applying the stack */ if (foreach_copy->result_type == IS_UNUSED && foreach_copy->op1_type == IS_UNUSED) { return 1; } @@ -2895,7 +2895,7 @@ void zend_do_begin_catch(znode *catch_token, znode *class_name, znode *catch_var znode catch_class; if (class_name->op_type == IS_CONST && - ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant))) { + ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant))) { zend_resolve_class_name(class_name, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); catch_class = *class_name; } else { @@ -3165,7 +3165,7 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c if (fe->common.arg_info[i].class_name) { const char *fe_class_name, *proto_class_name; - zend_str_size fe_class_name_len, proto_class_name_len; + zend_uint fe_class_name_len, proto_class_name_len; if (!strcasecmp(fe->common.arg_info[i].class_name, "parent") && proto->common.scope) { fe_class_name = proto->common.scope->name; @@ -3244,7 +3244,7 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{{ */ { char *offset, *buf; - zend_str_size length = 1024; + zend_uint length = 1024; offset = buf = (char *)emalloc(length * sizeof(char)); if (fptr->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE) { @@ -3275,7 +3275,7 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{ for (i = 0; i < fptr->common.num_args;) { if (arg_info->class_name) { const char *class_name; - zend_str_size class_name_len; + zend_uint class_name_len; if (!strcasecmp(arg_info->class_name, "self") && fptr->common.scope ) { class_name = fptr->common.scope->name; class_name_len = fptr->common.scope->name_length; @@ -3291,7 +3291,7 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{ offset += class_name_len; *(offset++) = ' '; } else if (arg_info->type_hint) { - zend_str_size type_name_len; + zend_uint type_name_len; char *type_name = zend_get_type_by_const(arg_info->type_hint); type_name_len = strlen(type_name); REALLOC_BUF_IF_EXCEED(buf, offset, length, type_name_len); @@ -3360,10 +3360,10 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{ offset += 4; } else if (Z_TYPE_P(zv) == IS_STRING) { *(offset++) = '\''; - REALLOC_BUF_IF_EXCEED(buf, offset, length, MIN(Z_STRSIZE_P(zv), 10)); - memcpy(offset, Z_STRVAL_P(zv), MIN(Z_STRSIZE_P(zv), 10)); - offset += MIN(Z_STRSIZE_P(zv), 10); - if (Z_STRSIZE_P(zv) > 10) { + REALLOC_BUF_IF_EXCEED(buf, offset, length, MIN(Z_STRLEN_P(zv), 10)); + memcpy(offset, Z_STRVAL_P(zv), MIN(Z_STRLEN_P(zv), 10)); + offset += MIN(Z_STRLEN_P(zv), 10); + if (Z_STRLEN_P(zv) > 10) { *(offset++) = '.'; *(offset++) = '.'; *(offset++) = '.'; @@ -3374,9 +3374,9 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{ offset += 5; } else { zend_make_printable_zval(zv, &zv_copy, &use_copy); - REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRSIZE(zv_copy)); - memcpy(offset, Z_STRVAL(zv_copy), Z_STRSIZE(zv_copy)); - offset += Z_STRSIZE(zv_copy); + REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRLEN(zv_copy)); + memcpy(offset, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy)); + offset += Z_STRLEN(zv_copy); if (use_copy) { zval_dtor(&zv_copy); } @@ -3838,7 +3838,7 @@ static zend_bool zend_traits_method_compatibility_check(zend_function *fn, zend_ } /* }}} */ -static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, zend_str_size_uint mname_len, zend_function* fe TSRMLS_DC) /* {{{ */ +static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint mname_len, zend_function* fe TSRMLS_DC) /* {{{ */ { if (!strncmp(mname, ZEND_CLONE_FUNC_NAME, mname_len)) { ce->clone = fe; fe->common.fn_flags |= ZEND_ACC_CLONE; @@ -3879,7 +3879,7 @@ static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, zend } /* }}} */ -static void zend_add_trait_method(zend_class_entry *ce, const char *name, const char *arKey, zend_str_size_uint nKeyLength, zend_function *fn, HashTable **overriden TSRMLS_DC) /* {{{ */ +static void zend_add_trait_method(zend_class_entry *ce, const char *name, const char *arKey, uint nKeyLength, zend_function *fn, HashTable **overriden TSRMLS_DC) /* {{{ */ { zend_function *existing_fn = NULL; ulong h = zend_hash_func(arKey, nKeyLength); @@ -3976,7 +3976,7 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args, zend_trait_alias *alias, **alias_ptr; HashTable *exclude_table; char *lcname; - zend_str_size fnname_len; + unsigned int fnname_len; zend_function fn_copy; void *dummy; @@ -4108,13 +4108,13 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* /** With the other traits, we are more permissive. We do not give errors for those. This allows to be more defensive in such definitions. - However, we want to make sure that the insteadof declaration + However, we want to make sure that the insteadof declartion is consistent in itself. */ j = 0; while (cur_precedence->exclude_from_classes[j]) { char* class_name = (char*)cur_precedence->exclude_from_classes[j]; - zend_str_size name_length = strlen(class_name); + zend_uint name_length = strlen(class_name); if (!(cur_precedence->exclude_from_classes[j] = zend_fetch_class(class_name, name_length, ZEND_FETCH_CLASS_TRAIT |ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC))) { zend_error(E_COMPILE_ERROR, "Could not find trait %s", class_name); @@ -4180,7 +4180,7 @@ static void zend_traits_compile_exclude_table(HashTable* exclude_table, zend_tra j = 0; while (precedences[i]->exclude_from_classes[j]) { if (precedences[i]->exclude_from_classes[j] == trait) { - zend_str_size lcname_len = precedences[i]->trait_method->mname_len; + zend_uint lcname_len = precedences[i]->trait_method->mname_len; char *lcname = zend_str_tolower_dup(precedences[i]->trait_method->method_name, lcname_len); if (zend_hash_add(exclude_table, lcname, lcname_len, NULL, 0, NULL) == FAILURE) { @@ -4229,7 +4229,7 @@ static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{ } /* }}} */ -static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t current_trait, const char* prop_name, zend_str_size_int prop_name_length, ulong prop_hash, zend_class_entry *coliding_ce) /* {{{ */ +static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t current_trait, const char* prop_name, int prop_name_length, ulong prop_hash, zend_class_entry *coliding_ce) /* {{{ */ { size_t i; @@ -4252,7 +4252,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* { zend_property_info *coliding_prop; zval compare_result; const char* prop_name; - zend_str_size prop_name_length; + int prop_name_length; ulong prop_hash; const char* class_name_unused; zend_bool not_compatible; @@ -4438,12 +4438,12 @@ ZEND_API int do_bind_function(const zend_op_array *op_array, zend_op *opline, Ha op2 = opline->op2.zv; } - zend_hash_quick_find(function_table, Z_STRVAL_P(op1), Z_STRSIZE_P(op1), Z_HASH_P(op1), (void *) &function); - if (zend_hash_quick_add(function_table, Z_STRVAL_P(op2), Z_STRSIZE_P(op2)+1, Z_HASH_P(op2), function, sizeof(zend_function), NULL)==FAILURE) { + zend_hash_quick_find(function_table, Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_HASH_P(op1), (void *) &function); + if (zend_hash_quick_add(function_table, Z_STRVAL_P(op2), Z_STRLEN_P(op2)+1, Z_HASH_P(op2), function, sizeof(zend_function), NULL)==FAILURE) { int error_level = compile_time ? E_COMPILE_ERROR : E_ERROR; zend_function *old_function; - if (zend_hash_quick_find(function_table, Z_STRVAL_P(op2), Z_STRSIZE_P(op2)+1, Z_HASH_P(op2), (void *) &old_function)==SUCCESS + if (zend_hash_quick_find(function_table, Z_STRVAL_P(op2), Z_STRLEN_P(op2)+1, Z_HASH_P(op2), (void *) &old_function)==SUCCESS && old_function->type == ZEND_USER_FUNCTION && old_function->op_array.last > 0) { zend_error(error_level, "Cannot redeclare %s() (previously declared in %s:%d)", @@ -4472,14 +4472,14 @@ void zend_prepare_reference(znode *result, znode *class_name, znode *method_name if (class_name) { zend_resolve_class_name(class_name, ZEND_FETCH_CLASS_GLOBAL, 1 TSRMLS_CC); method_ref->class_name = Z_STRVAL(class_name->u.constant); - method_ref->cname_len = Z_STRSIZE(class_name->u.constant); + method_ref->cname_len = Z_STRLEN(class_name->u.constant); } else { method_ref->class_name = NULL; method_ref->cname_len = 0; } method_ref->method_name = Z_STRVAL(method_name->u.constant); - method_ref->mname_len = Z_STRSIZE(method_name->u.constant); + method_ref->mname_len = Z_STRLEN(method_name->u.constant); result->u.op.ptr = method_ref; result->op_type = IS_TMP_VAR; @@ -4507,7 +4507,7 @@ void zend_add_trait_alias(znode *method_reference, znode *modifiers, znode *alia trait_alias->modifiers = Z_LVAL(modifiers->u.constant); if (alias) { trait_alias->alias = Z_STRVAL(alias->u.constant); - trait_alias->alias_len = Z_STRSIZE(alias->u.constant); + trait_alias->alias_len = Z_STRLEN(alias->u.constant); } else { trait_alias->alias = NULL; } @@ -4539,14 +4539,14 @@ ZEND_API zend_class_entry *do_bind_class(const zend_op_array* op_array, const ze op1 = opline->op1.zv; op2 = opline->op2.zv; } - if (zend_hash_quick_find(class_table, Z_STRVAL_P(op1), Z_STRSIZE_P(op1), Z_HASH_P(op1), (void **) &pce)==FAILURE) { + if (zend_hash_quick_find(class_table, Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_HASH_P(op1), (void **) &pce)==FAILURE) { zend_error(E_COMPILE_ERROR, "Internal Zend error - Missing class information for %s", Z_STRVAL_P(op1)); return NULL; } else { ce = *pce; } ce->refcount++; - if (zend_hash_quick_add(class_table, Z_STRVAL_P(op2), Z_STRSIZE_P(op2)+1, Z_HASH_P(op2), &ce, sizeof(zend_class_entry *), NULL)==FAILURE) { + if (zend_hash_quick_add(class_table, Z_STRVAL_P(op2), Z_STRLEN_P(op2)+1, Z_HASH_P(op2), &ce, sizeof(zend_class_entry *), NULL)==FAILURE) { ce->refcount--; if (!compile_time) { /* If we're in compile time, in practice, it's quite possible @@ -4580,7 +4580,7 @@ ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array op2 = opline->op2.zv; } - found_ce = zend_hash_quick_find(class_table, Z_STRVAL_P(op1), Z_STRSIZE_P(op1), Z_HASH_P(op1), (void **) &pce); + found_ce = zend_hash_quick_find(class_table, Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_HASH_P(op1), (void **) &pce); if (found_ce == FAILURE) { if (!compile_time) { @@ -4607,7 +4607,7 @@ ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array ce->refcount++; /* Register the derived class */ - if (zend_hash_quick_add(class_table, Z_STRVAL_P(op2), Z_STRSIZE_P(op2)+1, Z_HASH_P(op2), pce, sizeof(zend_class_entry *), NULL)==FAILURE) { + if (zend_hash_quick_add(class_table, Z_STRVAL_P(op2), Z_STRLEN_P(op2)+1, Z_HASH_P(op2), pce, sizeof(zend_class_entry *), NULL)==FAILURE) { zend_error(E_COMPILE_ERROR, "Cannot redeclare class %s", ce->name); } return ce; @@ -4643,7 +4643,7 @@ void zend_do_early_binding(TSRMLS_D) /* {{{ */ zend_class_entry **pce; parent_name = &CONSTANT(fetch_class_opline->op2.constant); - if ((zend_lookup_class(Z_STRVAL_P(parent_name), Z_STRSIZE_P(parent_name), &pce TSRMLS_CC) == FAILURE) || + if ((zend_lookup_class(Z_STRVAL_P(parent_name), Z_STRLEN_P(parent_name), &pce TSRMLS_CC) == FAILURE) || ((CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES) && ((*pce)->type == ZEND_INTERNAL_CLASS))) { if (CG(compiler_options) & ZEND_COMPILE_DELAYED_BINDING) { @@ -4681,7 +4681,7 @@ void zend_do_early_binding(TSRMLS_D) /* {{{ */ return; } - zend_hash_quick_del(table, Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRSIZE(CONSTANT(opline->op1.constant)), Z_HASH_P(&CONSTANT(opline->op1.constant))); + zend_hash_quick_del(table, Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRLEN(CONSTANT(opline->op1.constant)), Z_HASH_P(&CONSTANT(opline->op1.constant))); zend_del_literal(CG(active_op_array), opline->op1.constant); zend_del_literal(CG(active_op_array), opline->op2.constant); MAKE_NOP(opline); @@ -4697,7 +4697,7 @@ ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array TSRMLS CG(in_compilation) = 1; while (opline_num != -1) { - if (zend_lookup_class(Z_STRVAL_P(op_array->opcodes[opline_num-1].op2.zv), Z_STRSIZE_P(op_array->opcodes[opline_num-1].op2.zv), &pce TSRMLS_CC) == SUCCESS) { + if (zend_lookup_class(Z_STRVAL_P(op_array->opcodes[opline_num-1].op2.zv), Z_STRLEN_P(op_array->opcodes[opline_num-1].op2.zv), &pce TSRMLS_CC) == SUCCESS) { do_bind_inherited_class(op_array, &op_array->opcodes[opline_num], EG(class_table), *pce, 0 TSRMLS_CC); } opline_num = op_array->opcodes[opline_num].result.opline_num; @@ -4982,7 +4982,7 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name /* Class name must not conflict with import names */ if (CG(current_import) && - zend_hash_find(CG(current_import), lcname, Z_STRSIZE(class_name->u.constant)+1, (void**)&ns_name) == SUCCESS) { + zend_hash_find(CG(current_import), lcname, Z_STRLEN(class_name->u.constant)+1, (void**)&ns_name) == SUCCESS) { error = 1; } @@ -4996,14 +4996,14 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC); *class_name = tmp; efree(lcname); - lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant)); + lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant)); } if (error) { - char *tmp = zend_str_tolower_dup(Z_STRVAL_PP(ns_name), Z_STRSIZE_PP(ns_name)); + char *tmp = zend_str_tolower_dup(Z_STRVAL_PP(ns_name), Z_STRLEN_PP(ns_name)); - if (Z_STRSIZE_PP(ns_name) != Z_STRSIZE(class_name->u.constant) || - memcmp(tmp, lcname, Z_STRSIZE(class_name->u.constant))) { + if (Z_STRLEN_PP(ns_name) != Z_STRLEN(class_name->u.constant) || + memcmp(tmp, lcname, Z_STRLEN(class_name->u.constant))) { zend_error(E_COMPILE_ERROR, "Cannot declare class %s because the name is already in use", Z_STRVAL(class_name->u.constant)); } efree(tmp); @@ -5011,8 +5011,8 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name new_class_entry = emalloc(sizeof(zend_class_entry)); new_class_entry->type = ZEND_USER_CLASS; - new_class_entry->name = zend_new_interned_string(Z_STRVAL(class_name->u.constant), Z_STRSIZE(class_name->u.constant) + 1, 1 TSRMLS_CC); - new_class_entry->name_length = Z_STRSIZE(class_name->u.constant); + new_class_entry->name = zend_new_interned_string(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant) + 1, 1 TSRMLS_CC); + new_class_entry->name_length = Z_STRLEN(class_name->u.constant); zend_initialize_class_data(new_class_entry, 1 TSRMLS_CC); new_class_entry->info.user.filename = zend_get_compiled_filename(TSRMLS_C); @@ -5040,7 +5040,7 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name opline->op1_type = IS_CONST; build_runtime_defined_function_key(&key, lcname, new_class_entry->name_length TSRMLS_CC); opline->op1.constant = zend_add_literal(CG(active_op_array), &key TSRMLS_CC); - Z_HASH_P(&CONSTANT(opline->op1.constant)) = zend_hash_func(Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRSIZE(CONSTANT(opline->op1.constant))); + Z_HASH_P(&CONSTANT(opline->op1.constant)) = zend_hash_func(Z_STRVAL(CONSTANT(opline->op1.constant)), Z_STRLEN(CONSTANT(opline->op1.constant))); opline->op2_type = IS_CONST; @@ -5059,7 +5059,7 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name LITERAL_STRINGL(opline->op2, lcname, new_class_entry->name_length, 0); CALCULATE_LITERAL_HASH(opline->op2.constant); - zend_hash_quick_update(CG(class_table), Z_STRVAL(key), Z_STRSIZE(key), Z_HASH_P(&CONSTANT(opline->op1.constant)), &new_class_entry, sizeof(zend_class_entry *), NULL); + zend_hash_quick_update(CG(class_table), Z_STRVAL(key), Z_STRLEN(key), Z_HASH_P(&CONSTANT(opline->op1.constant)), &new_class_entry, sizeof(zend_class_entry *), NULL); CG(active_class_entry) = new_class_entry; opline->result.var = get_temporary_variable(CG(active_op_array)); @@ -5158,7 +5158,7 @@ void zend_do_implements_interface(znode *interface_name TSRMLS_DC) /* {{{ */ CG(active_class_entry)->name); } - switch (zend_get_class_fetch_type(Z_STRVAL(interface_name->u.constant), Z_STRSIZE(interface_name->u.constant))) { + switch (zend_get_class_fetch_type(Z_STRVAL(interface_name->u.constant), Z_STRLEN(interface_name->u.constant))) { case ZEND_FETCH_CLASS_SELF: case ZEND_FETCH_CLASS_PARENT: case ZEND_FETCH_CLASS_STATIC: @@ -5190,7 +5190,7 @@ void zend_do_use_trait(znode *trait_name TSRMLS_DC) /* {{{ */ } - switch (zend_get_class_fetch_type(Z_STRVAL(trait_name->u.constant), Z_STRSIZE(trait_name->u.constant))) { + switch (zend_get_class_fetch_type(Z_STRVAL(trait_name->u.constant), Z_STRLEN(trait_name->u.constant))) { case ZEND_FETCH_CLASS_SELF: case ZEND_FETCH_CLASS_PARENT: case ZEND_FETCH_CLASS_STATIC: @@ -5211,10 +5211,10 @@ void zend_do_use_trait(znode *trait_name TSRMLS_DC) /* {{{ */ } /* }}} */ -ZEND_API void zend_mangle_property_name(char **dest, zend_str_size_int *dest_length, const char *src1, zend_str_size_int src1_length, const char *src2, zend_str_size_int src2_length, int internal) /* {{{ */ +ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, const char *src1, int src1_length, const char *src2, int src2_length, int internal) /* {{{ */ { char *prop_name; - zend_str_size_int prop_name_length; + int prop_name_length; prop_name_length = 1 + src1_length + 1 + src2_length; prop_name = pemalloc(prop_name_length + 1, internal); @@ -5227,17 +5227,17 @@ ZEND_API void zend_mangle_property_name(char **dest, zend_str_size_int *dest_len } /* }}} */ -static zend_str_size_int zend_strnlen(const char* s, zend_str_size_int maxlen) /* {{{ */ +static int zend_strnlen(const char* s, int maxlen) /* {{{ */ { - zend_str_size_int len = 0; + int len = 0; while (*s++ && maxlen--) len++; return len; } /* }}} */ -ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, zend_str_size_int len, const char **class_name, const char **prop_name, zend_str_size_int *prop_len) /* {{{ */ +ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, int len, const char **class_name, const char **prop_name, int *prop_len) /* {{{ */ { - zend_str_size class_name_len; + int class_name_len; *class_name = NULL; @@ -5280,7 +5280,7 @@ void zend_do_declare_property(const znode *var_name, const znode *value, zend_ui zval *property; zend_property_info *existing_property_info; char *comment = NULL; - zend_str_size comment_len = 0; + int comment_len = 0; if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) { zend_error(E_COMPILE_ERROR, "Interfaces may not include member variables"); @@ -5437,7 +5437,7 @@ void zend_do_halt_compiler_register(TSRMLS_D) /* {{{ */ { char *name, *cfilename; char haltoff[] = "__COMPILER_HALT_OFFSET__"; - zend_str_size len, clen; + int len, clen; if (CG(has_bracketed_namespaces) && CG(in_namespace)) { zend_error(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope"); @@ -5511,10 +5511,10 @@ static zend_constant* zend_get_ct_const(const zval *const_name, int all_internal zend_constant *c = NULL; if (Z_STRVAL_P(const_name)[0] == '\\') { - if (zend_hash_find(EG(zend_constants), Z_STRVAL_P(const_name)+1, Z_STRSIZE_P(const_name), (void **) &c) == FAILURE) { - char *lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name)+1, Z_STRSIZE_P(const_name)-1); + if (zend_hash_find(EG(zend_constants), Z_STRVAL_P(const_name)+1, Z_STRLEN_P(const_name), (void **) &c) == FAILURE) { + char *lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name)+1, Z_STRLEN_P(const_name)-1); - if (zend_hash_find(EG(zend_constants), lookup_name, Z_STRSIZE_P(const_name), (void **) &c)==SUCCESS) { + if (zend_hash_find(EG(zend_constants), lookup_name, Z_STRLEN_P(const_name), (void **) &c)==SUCCESS) { if ((c->flags & CONST_CT_SUBST) && !(c->flags & CONST_CS)) { efree(lookup_name); return c; @@ -5523,10 +5523,10 @@ static zend_constant* zend_get_ct_const(const zval *const_name, int all_internal efree(lookup_name); return NULL; } - } else if (zend_hash_find(EG(zend_constants), Z_STRVAL_P(const_name), Z_STRSIZE_P(const_name)+1, (void **) &c) == FAILURE) { - char *lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name), Z_STRSIZE_P(const_name)); + } else if (zend_hash_find(EG(zend_constants), Z_STRVAL_P(const_name), Z_STRLEN_P(const_name)+1, (void **) &c) == FAILURE) { + char *lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name), Z_STRLEN_P(const_name)); - if (zend_hash_find(EG(zend_constants), lookup_name, Z_STRSIZE_P(const_name)+1, (void **) &c)==SUCCESS) { + if (zend_hash_find(EG(zend_constants), lookup_name, Z_STRLEN_P(const_name)+1, (void **) &c)==SUCCESS) { if ((c->flags & CONST_CT_SUBST) && !(c->flags & CONST_CS)) { efree(lookup_name); return c; @@ -5577,7 +5577,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con switch (mode) { case ZEND_CT: /* this is a class constant */ - type = zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRSIZE(constant_container->u.constant)); + type = zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRLEN(constant_container->u.constant)); if (ZEND_FETCH_CLASS_STATIC == type) { zend_error(E_ERROR, "\"static::\" is not allowed in compile-time constants"); @@ -5590,7 +5590,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con break; case ZEND_RT: if (constant_container->op_type == IS_CONST && - ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRSIZE(constant_container->u.constant))) { + ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRLEN(constant_container->u.constant))) { zend_resolve_class_name(constant_container, fetch_type, 1 TSRMLS_CC); } else { zend_do_fetch_class(&tmp, constant_container TSRMLS_CC); @@ -5622,7 +5622,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con /* only one that did not contain \ from the start can be converted to string if unknown */ switch (mode) { case ZEND_CT: - compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRSIZE(constant_name->u.constant)); + compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRLEN(constant_name->u.constant)); /* this is a namespace constant, or an unprefixed constant */ if (zend_constant_ct_subst(result, &constant_name->u.constant, 0 TSRMLS_CC)) { @@ -5639,7 +5639,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con result->u.constant.type = IS_CONSTANT | fetch_type; break; case ZEND_RT: - compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRSIZE(constant_name->u.constant)); + compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRLEN(constant_name->u.constant)); zend_resolve_non_class_name(constant_name, check_namespace TSRMLS_CC); @@ -5730,7 +5730,7 @@ void zend_do_init_array(znode *result, const znode *expr, const znode *offset, z ulong index; int numeric = 0; - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline->op2.constant)), Z_STRSIZE(CONSTANT(opline->op2.constant))+1, index, numeric = 1); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline->op2.constant)), Z_STRLEN(CONSTANT(opline->op2.constant))+1, index, numeric = 1); if (numeric) { zval_dtor(&CONSTANT(opline->op2.constant)); ZVAL_LONG(&CONSTANT(opline->op2.constant), index); @@ -5762,7 +5762,7 @@ void zend_do_add_array_element(znode *result, const znode *expr, const znode *of ulong index; int numeric = 0; - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline->op2.constant)), Z_STRSIZE(CONSTANT(opline->op2.constant))+1, index, numeric = 1); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline->op2.constant)), Z_STRLEN(CONSTANT(opline->op2.constant))+1, index, numeric = 1); if (numeric) { zval_dtor(&CONSTANT(opline->op2.constant)); ZVAL_LONG(&CONSTANT(opline->op2.constant), index); @@ -5788,10 +5788,10 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const znode case IS_CONSTANT: /* Ugly hack to denote that this value has a constant index */ Z_TYPE_P(element) |= IS_CONSTANT_INDEX; - Z_STRVAL(offset->u.constant) = erealloc(Z_STRVAL(offset->u.constant), Z_STRSIZE(offset->u.constant)+3); - Z_STRVAL(offset->u.constant)[Z_STRSIZE(offset->u.constant)+1] = Z_TYPE(offset->u.constant); - Z_STRVAL(offset->u.constant)[Z_STRSIZE(offset->u.constant)+2] = 0; - zend_symtable_update(result->u.constant.value.ht, Z_STRVAL(offset->u.constant), Z_STRSIZE(offset->u.constant)+3, &element, sizeof(zval *), NULL); + Z_STRVAL(offset->u.constant) = erealloc(Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3); + Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+1] = Z_TYPE(offset->u.constant); + Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+2] = 0; + zend_symtable_update(result->u.constant.value.ht, Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3, &element, sizeof(zval *), NULL); zval_dtor(&offset->u.constant); break; case IS_STRING: @@ -6014,7 +6014,7 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC) { znode value; - if (Z_STRSIZE(varname->u.constant) == sizeof("this") - 1 && + if (Z_STRLEN(varname->u.constant) == sizeof("this") - 1 && memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this") - 1) == 0) { zend_error(E_COMPILE_ERROR, "Cannot use $this as lexical variable"); return; @@ -6710,7 +6710,7 @@ void zend_do_ticks(TSRMLS_D) /* {{{ */ } /* }}} */ -zend_bool zend_is_auto_global_quick(const char *name, zend_str_size_uint name_len, ulong hashval TSRMLS_DC) /* {{{ */ +zend_bool zend_is_auto_global_quick(const char *name, uint name_len, ulong hashval TSRMLS_DC) /* {{{ */ { zend_auto_global *auto_global; ulong hash = hashval ? hashval : zend_hash_func(name, name_len+1); @@ -6725,13 +6725,13 @@ zend_bool zend_is_auto_global_quick(const char *name, zend_str_size_uint name_le } /* }}} */ -zend_bool zend_is_auto_global(const char *name, zend_str_size_uint name_len TSRMLS_DC) /* {{{ */ +zend_bool zend_is_auto_global(const char *name, uint name_len TSRMLS_DC) /* {{{ */ { return zend_is_auto_global_quick(name, name_len, 0 TSRMLS_CC); } /* }}} */ -int zend_register_auto_global(const char *name, zend_str_size_uint name_len, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC) /* {{{ */ +int zend_register_auto_global(const char *name, uint name_len, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC) /* {{{ */ { zend_auto_global auto_global; @@ -6874,7 +6874,7 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify } /* }}} */ -int zend_get_class_fetch_type(const char *class_name, zend_str_size_uint class_name_len) /* {{{ */ +int zend_get_class_fetch_type(const char *class_name, uint class_name_len) /* {{{ */ { if ((class_name_len == sizeof("self")-1) && !strncasecmp(class_name, "self", sizeof("self")-1)) { @@ -6891,7 +6891,7 @@ int zend_get_class_fetch_type(const char *class_name, zend_str_size_uint class_n } /* }}} */ -ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, zend_str_size_int* name_len) /* {{{ */ +ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, int* name_len) /* {{{ */ { if (name_len) { *name_len = op_array->vars[var].name_len; @@ -6905,7 +6905,7 @@ void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRM if (prefix) { *result = *prefix; if (Z_TYPE(result->u.constant) == IS_STRING && - Z_STRSIZE(result->u.constant) == 0) { + Z_STRLEN(result->u.constant) == 0) { /* namespace\ */ if (CG(current_namespace)) { znode tmp; @@ -6921,7 +6921,7 @@ void zend_do_build_namespace_name(znode *result, znode *prefix, znode *name TSRM result->op_type = IS_CONST; Z_TYPE(result->u.constant) = IS_STRING; Z_STRVAL(result->u.constant) = NULL; - Z_STRSIZE(result->u.constant) = 0; + Z_STRLEN(result->u.constant) = 0; } /* prefix = result */ zend_do_build_full_name(NULL, result, name, 0 TSRMLS_CC); @@ -6968,10 +6968,10 @@ void zend_do_begin_namespace(const znode *name, zend_bool with_bracket TSRMLS_DC } if (name) { - lcname = zend_str_tolower_dup(Z_STRVAL(name->u.constant), Z_STRSIZE(name->u.constant)); - if (((Z_STRSIZE(name->u.constant) == sizeof("self")-1) && + lcname = zend_str_tolower_dup(Z_STRVAL(name->u.constant), Z_STRLEN(name->u.constant)); + if (((Z_STRLEN(name->u.constant) == sizeof("self")-1) && !memcmp(lcname, "self", sizeof("self")-1)) || - ((Z_STRSIZE(name->u.constant) == sizeof("parent")-1) && + ((Z_STRLEN(name->u.constant) == sizeof("parent")-1) && !memcmp(lcname, "parent", sizeof("parent")-1))) { zend_error(E_COMPILE_ERROR, "Cannot use '%s' as namespace name", Z_STRVAL(name->u.constant)); } @@ -7027,7 +7027,7 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ /* The form "use A\B" is eqivalent to "use A\B as B". So we extract the last part of compound name to use as a new_name */ name = &tmp; - p = zend_memrchr(Z_STRVAL_P(ns), '\\', Z_STRSIZE_P(ns)); + p = zend_memrchr(Z_STRVAL_P(ns), '\\', Z_STRLEN_P(ns)); if (p) { ZVAL_STRING(name, p+1, 1); } else { @@ -7037,45 +7037,45 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{ } } - lcname = zend_str_tolower_dup(Z_STRVAL_P(name), Z_STRSIZE_P(name)); + lcname = zend_str_tolower_dup(Z_STRVAL_P(name), Z_STRLEN_P(name)); - if (((Z_STRSIZE_P(name) == sizeof("self")-1) && + if (((Z_STRLEN_P(name) == sizeof("self")-1) && !memcmp(lcname, "self", sizeof("self")-1)) || - ((Z_STRSIZE_P(name) == sizeof("parent")-1) && + ((Z_STRLEN_P(name) == sizeof("parent")-1) && !memcmp(lcname, "parent", sizeof("parent")-1))) { zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because '%s' is a special class name", Z_STRVAL_P(ns), Z_STRVAL_P(name), Z_STRVAL_P(name)); } if (CG(current_namespace)) { /* Prefix import name with current namespace name to avoid conflicts with classes */ - char *c_ns_name = emalloc(Z_STRSIZE_P(CG(current_namespace)) + 1 + Z_STRSIZE_P(name) + 1); + char *c_ns_name = emalloc(Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name) + 1); - zend_str_tolower_copy(c_ns_name, Z_STRVAL_P(CG(current_namespace)), Z_STRSIZE_P(CG(current_namespace))); - c_ns_name[Z_STRSIZE_P(CG(current_namespace))] = '\\'; - memcpy(c_ns_name+Z_STRSIZE_P(CG(current_namespace))+1, lcname, Z_STRSIZE_P(name)+1); - if (zend_hash_exists(CG(class_table), c_ns_name, Z_STRSIZE_P(CG(current_namespace)) + 1 + Z_STRSIZE_P(name)+1)) { - char *tmp2 = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRSIZE_P(ns)); + zend_str_tolower_copy(c_ns_name, Z_STRVAL_P(CG(current_namespace)), Z_STRLEN_P(CG(current_namespace))); + c_ns_name[Z_STRLEN_P(CG(current_namespace))] = '\\'; + memcpy(c_ns_name+Z_STRLEN_P(CG(current_namespace))+1, lcname, Z_STRLEN_P(name)+1); + if (zend_hash_exists(CG(class_table), c_ns_name, Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name)+1)) { + char *tmp2 = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns)); - if (Z_STRSIZE_P(ns) != Z_STRSIZE_P(CG(current_namespace)) + 1 + Z_STRSIZE_P(name) || - memcmp(tmp2, c_ns_name, Z_STRSIZE_P(ns))) { + if (Z_STRLEN_P(ns) != Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name) || + memcmp(tmp2, c_ns_name, Z_STRLEN_P(ns))) { zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); } efree(tmp2); } efree(c_ns_name); - } else if (zend_hash_find(CG(class_table), lcname, Z_STRSIZE_P(name)+1, (void**)&pce) == SUCCESS && + } else if (zend_hash_find(CG(class_table), lcname, Z_STRLEN_P(name)+1, (void**)&pce) == SUCCESS && (*pce)->type == ZEND_USER_CLASS && (*pce)->info.user.filename == CG(compiled_filename)) { - char *c_tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRSIZE_P(ns)); + char *c_tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), Z_STRLEN_P(ns)); - if (Z_STRSIZE_P(ns) != Z_STRSIZE_P(name) || - memcmp(c_tmp, lcname, Z_STRSIZE_P(ns))) { + if (Z_STRLEN_P(ns) != Z_STRLEN_P(name) || + memcmp(c_tmp, lcname, Z_STRLEN_P(ns))) { zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); } efree(c_tmp); } - if (zend_hash_add(CG(current_import), lcname, Z_STRSIZE_P(name)+1, &ns, sizeof(zval*), NULL) != SUCCESS) { + if (zend_hash_add(CG(current_import), lcname, Z_STRLEN_P(name)+1, &ns, sizeof(zval*), NULL) != SUCCESS) { zend_error(E_COMPILE_ERROR, "Cannot use %s as %s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name)); } if (warn) { @@ -7107,7 +7107,7 @@ void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* {{{ */ tmp.op_type = IS_CONST; tmp.u.constant = *CG(current_namespace); - Z_STRVAL(tmp.u.constant) = zend_str_tolower_dup(Z_STRVAL(tmp.u.constant), Z_STRSIZE(tmp.u.constant)); + Z_STRVAL(tmp.u.constant) = zend_str_tolower_dup(Z_STRVAL(tmp.u.constant), Z_STRLEN(tmp.u.constant)); zend_do_build_namespace_name(&tmp, &tmp, name TSRMLS_CC); *name = tmp; } @@ -7156,7 +7156,7 @@ void zend_do_end_compilation(TSRMLS_D) /* {{{ */ ZEND_API size_t zend_dirname(char *path, size_t len) { register char *end = path + len - 1; - zend_str_size len_adjust = 0; + unsigned int len_adjust = 0; #ifdef PHP_WIN32 /* Note that on Win32 CWD is per drive (heritage from CP/M). diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 292f533d1e30a..9c55b5ebe8812 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -112,7 +112,7 @@ struct _zend_op { znode_op op2; znode_op result; ulong extended_value; - zend_str_size_uint lineno; + uint lineno; zend_uchar opcode; zend_uchar op1_type; zend_uchar op2_type; @@ -230,9 +230,9 @@ typedef struct _zend_property_info { typedef struct _zend_arg_info { const char *name; - zend_str_size_uint name_len; + zend_uint name_len; const char *class_name; - zend_str_size_uint class_name_len; + zend_uint class_name_len; zend_uchar type_hint; zend_bool allow_null; zend_bool pass_by_reference; @@ -244,9 +244,9 @@ typedef struct _zend_arg_info { */ typedef struct _zend_internal_function_info { const char *_name; - zend_str_size_uint _name_len; + zend_uint _name_len; const char *_class_name; - zend_str_size_uint required_num_args; + zend_uint required_num_args; zend_uchar _type_hint; zend_bool return_reference; zend_bool pass_rest_by_reference; @@ -254,7 +254,7 @@ typedef struct _zend_internal_function_info { typedef struct _zend_compiled_variable { const char *name; - zend_str_size_int name_len; + int name_len; ulong hash_value; } zend_compiled_variable; @@ -296,10 +296,10 @@ struct _zend_op_array { zend_uint this_var; const char *filename; - zend_str_size_uint line_start; - zend_str_size_uint line_end; + zend_uint line_start; + zend_uint line_end; const char *doc_comment; - zend_str_size_uint doc_comment_len; + zend_uint doc_comment_len; zend_uint early_binding; /* the linked list of delayed declarations */ zend_literal *literals; @@ -434,12 +434,12 @@ void shutdown_scanner(TSRMLS_D); ZEND_API char *zend_set_compiled_filename(const char *new_compiled_filename TSRMLS_DC); ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename TSRMLS_DC); ZEND_API char *zend_get_compiled_filename(TSRMLS_D); -ZEND_API zend_str_size_int zend_get_compiled_lineno(TSRMLS_D); +ZEND_API int zend_get_compiled_lineno(TSRMLS_D); ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D); void zend_resolve_non_class_name(znode *element_name, zend_bool check_namespace TSRMLS_DC); void zend_resolve_class_name(znode *class_name, ulong fetch_type, int check_ns_name TSRMLS_DC); -ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, zend_str_size_int* name_len); +ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, int* name_len); #ifdef ZTS const char *zend_get_zendtext(TSRMLS_D); @@ -672,10 +672,10 @@ ZEND_API void zend_function_dtor(zend_function *function); ZEND_API void destroy_zend_class(zend_class_entry **pce); void zend_class_add_ref(zend_class_entry **ce); -ZEND_API void zend_mangle_property_name(char **dest, zend_str_size_int *dest_length, const char *src1, zend_str_size_int src1_length, const char *src2, zend_str_size_int src2_length, int internal); +ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, const char *src1, int src1_length, const char *src2, int src2_length, int internal); #define zend_unmangle_property_name(mangled_property, mangled_property_len, class_name, prop_name) \ zend_unmangle_property_name_ex(mangled_property, mangled_property_len, class_name, prop_name, NULL) -ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, zend_str_size_int mangled_property_len, const char **class_name, const char **prop_name, zend_str_size_int *prop_len); +ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, int mangled_property_len, const char **class_name, const char **prop_name, int *prop_len); #define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor #define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class @@ -693,9 +693,9 @@ void zend_do_mark_last_catch(const znode *first_catch, const znode *last_additio ZEND_API zend_bool zend_is_compiling(TSRMLS_D); ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC); ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC); -int zend_get_class_fetch_type(const char *class_name, zend_str_size_uint class_name_len); +int zend_get_class_fetch_type(const char *class_name, uint class_name_len); -typedef zend_bool (*zend_auto_global_callback)(const char *name, zend_str_size_uint name_len TSRMLS_DC); +typedef zend_bool (*zend_auto_global_callback)(const char *name, uint name_len TSRMLS_DC); typedef struct _zend_auto_global { const char *name; uint name_len; @@ -704,10 +704,10 @@ typedef struct _zend_auto_global { zend_bool armed; } zend_auto_global; -ZEND_API int zend_register_auto_global(const char *name, zend_str_size_uint name_len, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC); +ZEND_API int zend_register_auto_global(const char *name, uint name_len, zend_bool jit, zend_auto_global_callback auto_global_callback TSRMLS_DC); ZEND_API void zend_activate_auto_globals(TSRMLS_D); -ZEND_API zend_bool zend_is_auto_global(const char *name, zend_str_size_uint name_len TSRMLS_DC); -ZEND_API zend_bool zend_is_auto_global_quick(const char *name, zend_str_size_uint name_len, ulong hashval TSRMLS_DC); +ZEND_API zend_bool zend_is_auto_global(const char *name, uint name_len TSRMLS_DC); +ZEND_API zend_bool zend_is_auto_global_quick(const char *name, uint name_len, ulong hashval TSRMLS_DC); ZEND_API size_t zend_dirname(char *path, size_t len); int zendlex(znode *zendlval TSRMLS_DC); diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 7a799a7ad1c8c..21580d3d5f607 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -25,7 +25,7 @@ #include "zend_variables.h" #include "zend_operators.h" #include "zend_globals.h" -#include "zend_API.h" + void free_zend_constant(zend_constant *c) { @@ -119,12 +119,42 @@ void zend_register_standard_constants(TSRMLS_D) REGISTER_MAIN_LONG_CONSTANT("DEBUG_BACKTRACE_IGNORE_ARGS", DEBUG_BACKTRACE_IGNORE_ARGS, CONST_PERSISTENT | CONST_CS); /* true/false constants */ { - REGISTER_MAIN_BOOL_CONSTANT("TRUE", 1, CONST_PERSISTENT | CONST_CT_SUBST); - REGISTER_MAIN_BOOL_CONSTANT("FALSE", 0, CONST_PERSISTENT | CONST_CT_SUBST); - REGISTER_MAIN_BOOL_CONSTANT("ZEND_THREAD_SAFE", ZTS_V, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_BOOL_CONSTANT("ZEND_DEBUG_BUILD", ZEND_DEBUG, CONST_PERSISTENT | CONST_CS); + zend_constant c; + + c.flags = CONST_PERSISTENT | CONST_CT_SUBST; + c.module_number = 0; + + c.name = zend_strndup(ZEND_STRL("TRUE")); + c.name_len = sizeof("TRUE"); + c.value.value.lval = 1; + c.value.type = IS_BOOL; + zend_register_constant(&c TSRMLS_CC); + + c.name = zend_strndup(ZEND_STRL("FALSE")); + c.name_len = sizeof("FALSE"); + c.value.value.lval = 0; + c.value.type = IS_BOOL; + zend_register_constant(&c TSRMLS_CC); + + c.name = zend_strndup(ZEND_STRL("NULL")); + c.name_len = sizeof("NULL"); + c.value.type = IS_NULL; + zend_register_constant(&c TSRMLS_CC); + + c.flags = CONST_PERSISTENT | CONST_CS; + + c.name = zend_strndup(ZEND_STRL("ZEND_THREAD_SAFE")); + c.name_len = sizeof("ZEND_THREAD_SAFE"); + c.value.value.lval = ZTS_V; + c.value.type = IS_BOOL; + zend_register_constant(&c TSRMLS_CC); + + c.name = zend_strndup(ZEND_STRL("ZEND_DEBUG_BUILD")); + c.name_len = sizeof("ZEND_DEBUG_BUILD"); + c.value.value.lval = ZEND_DEBUG; + c.value.type = IS_BOOL; + zend_register_constant(&c TSRMLS_CC); } - REGISTER_MAIN_NULL_CONSTANT("NULL", CONST_PERSISTENT | CONST_CT_SUBST); } @@ -145,35 +175,13 @@ void clean_non_persistent_constants(TSRMLS_D) } } -ZEND_API void zend_register_null_constant(const char *name, uint name_len, int flags, int module_number TSRMLS_DC) -{ - zend_constant c; - - ZVAL_NULL(&c.value); - c.flags = flags; - c.name = zend_strndup(name, name_len-1); - c.name_len = name_len; - c.module_number = module_number; - zend_register_constant(&c TSRMLS_CC); -} - -ZEND_API void zend_register_bool_constant(const char *name, uint name_len, zend_bool bval, int flags, int module_number TSRMLS_DC) -{ - zend_constant c; - - ZVAL_BOOL(&c.value, bval); - c.flags = flags; - c.name = zend_strndup(name, name_len-1); - c.name_len = name_len; - c.module_number = module_number; - zend_register_constant(&c TSRMLS_CC); -} -ZEND_API void zend_register_long_constant(const char *name, zend_str_size_uint name_len, long lval, int flags, int module_number TSRMLS_DC) +ZEND_API void zend_register_long_constant(const char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC) { zend_constant c; - ZVAL_LONG(&c.value, lval); + c.value.type = IS_LONG; + c.value.value.lval = lval; c.flags = flags; c.name = zend_strndup(name, name_len-1); c.name_len = name_len; @@ -182,11 +190,12 @@ ZEND_API void zend_register_long_constant(const char *name, zend_str_size_uint n } -ZEND_API void zend_register_double_constant(const char *name, zend_str_size_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_constant c; - ZVAL_DOUBLE(&c.value, dval); + c.value.type = IS_DOUBLE; + c.value.value.dval = dval; c.flags = flags; c.name = zend_strndup(name, name_len-1); c.name_len = name_len; @@ -195,11 +204,13 @@ ZEND_API void zend_register_double_constant(const char *name, zend_str_size_uint } -ZEND_API void zend_register_stringl_constant(const char *name, zend_str_size_uint name_len, char *strval, zend_str_size_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_constant c; - ZVAL_STRINGL(&c.value, strval, strlen, 0); + c.value.type = IS_STRING; + c.value.value.str.val = strval; + c.value.value.str.len = strlen; c.flags = flags; c.name = zend_strndup(name, name_len-1); c.name_len = name_len; @@ -208,12 +219,12 @@ ZEND_API void zend_register_stringl_constant(const char *name, zend_str_size_uin } -ZEND_API void zend_register_string_constant(const char *name, zend_str_size_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_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number TSRMLS_CC); } -static int zend_get_special_constant(const char *name, zend_str_size_uint name_len, zend_constant **c TSRMLS_DC) +static int zend_get_special_constant(const char *name, uint name_len, zend_constant **c TSRMLS_DC) { int ret; static char haltoff[] = "__COMPILER_HALT_OFFSET__"; @@ -226,7 +237,7 @@ static int zend_get_special_constant(const char *name, zend_str_size_uint name_l /* Returned constants may be cached, so they have to be stored */ if (EG(scope) && EG(scope)->name) { - zend_str_size const_name_len; + int const_name_len; char *const_name; ALLOCA_FLAG(use_heap) @@ -238,7 +249,7 @@ static int zend_get_special_constant(const char *name, zend_str_size_uint name_l zend_hash_add(EG(zend_constants), const_name, const_name_len, (void*)&tmp, sizeof(zend_constant), (void**)c); memset(*c, 0, sizeof(zend_constant)); Z_STRVAL((**c).value) = estrndup(EG(scope)->name, EG(scope)->name_length); - Z_STRSIZE((**c).value) = EG(scope)->name_length; + Z_STRLEN((**c).value) = EG(scope)->name_length; Z_TYPE((**c).value) = IS_STRING; } free_alloca(const_name, use_heap); @@ -247,7 +258,7 @@ static int zend_get_special_constant(const char *name, zend_str_size_uint name_l zend_hash_add(EG(zend_constants), "\0__CLASS__", sizeof("\0__CLASS__"), (void*)&tmp, sizeof(zend_constant), (void**)c); memset(*c, 0, sizeof(zend_constant)); Z_STRVAL((**c).value) = estrndup("", 0); - Z_STRSIZE((**c).value) = 0; + Z_STRLEN((**c).value) = 0; Z_TYPE((**c).value) = IS_STRING; } } @@ -256,7 +267,7 @@ static int zend_get_special_constant(const char *name, zend_str_size_uint name_l !memcmp(name, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1)) { const char *cfilename; char *haltname; - zend_str_size len, clen; + int len, clen; cfilename = zend_get_executed_filename(TSRMLS_C); clen = strlen(cfilename); @@ -272,7 +283,7 @@ static int zend_get_special_constant(const char *name, zend_str_size_uint name_l } -ZEND_API int zend_get_constant(const char *name, zend_str_size_uint name_len, zval *result TSRMLS_DC) +ZEND_API int zend_get_constant(const char *name, uint name_len, zval *result TSRMLS_DC) { zend_constant *c; int retval = 1; @@ -301,7 +312,7 @@ ZEND_API int zend_get_constant(const char *name, zend_str_size_uint name_len, zv return retval; } -ZEND_API int zend_get_constant_ex(const char *name, zend_str_size_uint name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC) +ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC) { zend_constant *c; int retval = 1; @@ -319,8 +330,8 @@ ZEND_API int zend_get_constant_ex(const char *name, zend_str_size_uint name_len, if ((colon = zend_memrchr(name, ':', name_len)) && colon > name && (*(colon - 1) == ':')) { - zend_str_size class_name_len = colon - name - 1; - zend_str_size const_name_len = name_len - class_name_len - 2; + int class_name_len = colon - name - 1; + int const_name_len = name_len - class_name_len - 2; const char *constant_name = colon + 1; char *lcname; @@ -382,8 +393,8 @@ ZEND_API int zend_get_constant_ex(const char *name, zend_str_size_uint name_len, /* non-class constant */ if ((colon = zend_memrchr(name, '\\', name_len)) != NULL) { /* compound constant name */ - zend_str_size prefix_len = colon - name; - zend_str_size const_name_len = name_len - prefix_len - 1; + int prefix_len = colon - name; + int const_name_len = name_len - prefix_len - 1; const char *constant_name = colon + 1; char *lcname; int found_const = 0; @@ -441,26 +452,26 @@ zend_constant *zend_quick_get_constant(const zend_literal *key, ulong flags TSRM { zend_constant *c; - if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRSIZE(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE) { + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE) { key++; - if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRSIZE(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE || + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE || (c->flags & CONST_CS) != 0) { if ((flags & (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) == (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) { key++; - if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRSIZE(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE) { + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE) { key++; - if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRSIZE(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE || + if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE || (c->flags & CONST_CS) != 0) { key--; - if (!zend_get_special_constant(Z_STRVAL(key->constant), Z_STRSIZE(key->constant), &c TSRMLS_CC)) { + if (!zend_get_special_constant(Z_STRVAL(key->constant), Z_STRLEN(key->constant), &c TSRMLS_CC)) { return NULL; } } } } else { key--; - if (!zend_get_special_constant(Z_STRVAL(key->constant), Z_STRSIZE(key->constant), &c TSRMLS_CC)) { + if (!zend_get_special_constant(Z_STRVAL(key->constant), Z_STRLEN(key->constant), &c TSRMLS_CC)) { return NULL; } } diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h index d353ab27c402c..c7261946c826f 100644 --- a/Zend/zend_constants.h +++ b/Zend/zend_constants.h @@ -34,26 +34,20 @@ typedef struct _zend_constant { zval value; int flags; char *name; - zend_str_size_uint name_len; + uint name_len; int module_number; } zend_constant; -#define REGISTER_NULL_CONSTANT(name, flags) zend_register_null_constant((name), sizeof(name), (flags), module_number TSRMLS_CC) -#define REGISTER_BOOL_CONSTANT(name, bval, flags) zend_register_bool_constant((name), sizeof(name), (bval), (flags), module_number TSRMLS_CC) #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), module_number TSRMLS_CC) #define REGISTER_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name), (dval), (flags), module_number TSRMLS_CC) #define REGISTER_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), module_number TSRMLS_CC) #define REGISTER_STRINGL_CONSTANT(name, str, len, flags) zend_register_stringl_constant((name), sizeof(name), (str), (len), (flags), module_number TSRMLS_CC) -#define REGISTER_NS_NULL_CONSTANT(ns, name, flags) zend_register_null_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (flags), module_number TSRMLS_CC) -#define REGISTER_NS_BOOL_CONSTANT(ns, name, bval, flags) zend_register_bool_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (bval), (flags), module_number TSRMLS_CC) #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (lval), (flags), module_number TSRMLS_CC) #define REGISTER_NS_DOUBLE_CONSTANT(ns, name, dval, flags) zend_register_double_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (dval), (flags), module_number TSRMLS_CC) #define REGISTER_NS_STRING_CONSTANT(ns, name, str, flags) zend_register_string_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (str), (flags), module_number TSRMLS_CC) #define REGISTER_NS_STRINGL_CONSTANT(ns, name, str, len, flags) zend_register_stringl_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (str), (len), (flags), module_number TSRMLS_CC) -#define REGISTER_MAIN_NULL_CONSTANT(name, flags) zend_register_null_constant((name), sizeof(name), (flags), 0 TSRMLS_CC) -#define REGISTER_MAIN_BOOL_CONSTANT(name, bval, flags) zend_register_bool_constant((name), sizeof(name), (bval), (flags), 0 TSRMLS_CC) #define REGISTER_MAIN_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), 0 TSRMLS_CC) #define REGISTER_MAIN_DOUBLE_CONSTANT(name, dval, flags) zend_register_double_constant((name), sizeof(name), (dval), (flags), 0 TSRMLS_CC) #define REGISTER_MAIN_STRING_CONSTANT(name, str, flags) zend_register_string_constant((name), sizeof(name), (str), (flags), 0 TSRMLS_CC) @@ -66,14 +60,12 @@ int zend_startup_constants(TSRMLS_D); int zend_shutdown_constants(TSRMLS_D); void zend_register_standard_constants(TSRMLS_D); void clean_non_persistent_constants(TSRMLS_D); -ZEND_API int zend_get_constant(const char *name, zend_str_size_uint name_len, zval *result TSRMLS_DC); -ZEND_API int zend_get_constant_ex(const char *name, zend_str_size_uint name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC); -ZEND_API void zend_register_bool_constant(const char *name, zend_str_size_uint name_len, zend_bool bval, int flags, int module_number TSRMLS_DC); -ZEND_API void zend_register_null_constant(const char *name, zend_str_size_uint name_len, int flags, int module_number TSRMLS_DC); -ZEND_API void zend_register_long_constant(const char *name, zend_str_size_uint name_len, long lval, int flags, int module_number TSRMLS_DC); -ZEND_API void zend_register_double_constant(const char *name, zend_str_size_uint name_len, double dval, int flags, int module_number TSRMLS_DC); -ZEND_API void zend_register_string_constant(const char *name, zend_str_size_uint name_len, char *strval, int flags, int module_number TSRMLS_DC); -ZEND_API void zend_register_stringl_constant(const char *name, zend_str_size_uint name_len, char *strval, zend_str_size_uint strlen, int flags, int module_number TSRMLS_DC); +ZEND_API int zend_get_constant(const char *name, uint name_len, zval *result TSRMLS_DC); +ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC); +ZEND_API void zend_register_long_constant(const char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC); +ZEND_API void zend_register_double_constant(const char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC); +ZEND_API void zend_register_string_constant(const char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC); +ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC); ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC); void zend_copy_constants(HashTable *target, HashTable *sourc); void copy_zend_constant(zend_constant *c); diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 6477a10060dc8..f07c1135f0dea 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -86,7 +86,7 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */ #ifdef HAVE_DTRACE if (DTRACE_EXCEPTION_THROWN_ENABLED()) { char *classname; - zend_str_size name_len; + int name_len; if (exception != NULL) { zend_get_object_classname(exception, &classname, &name_len TSRMLS_CC); @@ -196,10 +196,9 @@ ZEND_METHOD(exception, __construct) char *message = NULL; long code = 0; zval *object, *previous = NULL; - int argc = ZEND_NUM_ARGS(); - zend_str_size message_len; + int argc = ZEND_NUM_ARGS(), message_len; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|SlO!", &message, &message_len, &code, &previous, default_exception_ce) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|slO!", &message, &message_len, &code, &previous, default_exception_ce) == FAILURE) { zend_error(E_ERROR, "Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]])"); } @@ -226,10 +225,9 @@ ZEND_METHOD(error_exception, __construct) char *message = NULL, *filename = NULL; long code = 0, severity = E_ERROR, lineno; zval *object, *previous = NULL; - int argc = ZEND_NUM_ARGS(); - zend_str_size message_len, filename_len; + int argc = ZEND_NUM_ARGS(), message_len, filename_len; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|SllSlO!", &message, &message_len, &code, &severity, &filename, &filename_len, &lineno, &previous, default_exception_ce) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|sllslO!", &message, &message_len, &code, &severity, &filename, &filename_len, &lineno, &previous, default_exception_ce) == FAILURE) { zend_error(E_ERROR, "Wrong parameters for ErrorException([string $exception [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Exception $previous = NULL]]]]]])"); } @@ -264,7 +262,7 @@ ZEND_METHOD(error_exception, __construct) return; \ } -static void _default_exception_get_entry(zval *object, char *name, zend_str_size_int name_len, zval *return_value TSRMLS_DC) /* {{{ */ +static void _default_exception_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC) /* {{{ */ { zval *value; @@ -343,7 +341,7 @@ ZEND_METHOD(error_exception, getSeverity) #define TRACE_APPEND_STRL(val, vallen) \ { \ - zend_str_size l = vallen; \ + int l = vallen; \ *str = (char*)erealloc(*str, *len + l + 1); \ memcpy((*str) + *len, val, l); \ *len += l; \ @@ -358,7 +356,7 @@ ZEND_METHOD(error_exception, getSeverity) zend_error(E_WARNING, "Value for %s is no string", key); \ TRACE_APPEND_STR("[unknown]"); \ } else { \ - TRACE_APPEND_STRL(Z_STRVAL_PP(tmp), Z_STRSIZE_PP(tmp)); \ + TRACE_APPEND_STRL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); \ } \ } @@ -367,10 +365,10 @@ ZEND_METHOD(error_exception, getSeverity) static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { char **str; - zend_str_size *len; + int *len; str = va_arg(args, char**); - len = va_arg(args, zend_str_size*); + len = va_arg(args, int*); /* the trivial way would be to do: * conver_to_string_ex(arg); @@ -383,14 +381,14 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z TRACE_APPEND_STR("NULL, "); break; case IS_STRING: { - zend_str_size l_added; + int l_added; TRACE_APPEND_CHR('\''); - if (Z_STRSIZE_PP(arg) > 15) { + if (Z_STRLEN_PP(arg) > 15) { TRACE_APPEND_STRL(Z_STRVAL_PP(arg), 15); TRACE_APPEND_STR("...', "); l_added = 15 + 6 + 1; /* +1 because of while (--l_added) */ } else { - l_added = Z_STRSIZE_PP(arg); + l_added = Z_STRLEN_PP(arg); TRACE_APPEND_STRL(Z_STRVAL_PP(arg), l_added); TRACE_APPEND_STR("', "); l_added += 3 + 1; @@ -415,7 +413,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z case IS_LONG: { long lval = Z_LVAL_PP(arg); char s_tmp[MAX_LENGTH_OF_LONG + 1]; - zend_str_size l_tmp = zend_sprintf(s_tmp, "%ld", lval); /* SAFE */ + int l_tmp = zend_sprintf(s_tmp, "%ld", lval); /* SAFE */ TRACE_APPEND_STRL(s_tmp, l_tmp); TRACE_APPEND_STR(", "); break; @@ -423,7 +421,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z case IS_DOUBLE: { double dval = Z_DVAL_PP(arg); char *s_tmp; - zend_str_size l_tmp; + int l_tmp; s_tmp = emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1); l_tmp = zend_sprintf(s_tmp, "%.*G", (int) EG(precision), dval); /* SAFE */ @@ -438,7 +436,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z break; case IS_OBJECT: { const char *class_name; - zend_str_size class_name_len; + zend_uint class_name_len; int dup; TRACE_APPEND_STR("Object("); @@ -463,7 +461,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { char *s_tmp, **str; - zend_str_size *len, *num; + int *len, *num; long line; HashTable *ht = Z_ARRVAL_PP(frame); zval **file, **tmp; @@ -474,8 +472,8 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg } str = va_arg(args, char**); - len = va_arg(args, zend_str_size*); - num = va_arg(args, zend_str_size*); + len = va_arg(args, int*); + num = va_arg(args, int*); s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 1 + 1); sprintf(s_tmp, "#%d ", (*num)++); @@ -496,7 +494,7 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg } else { line = 0; } - s_tmp = emalloc(Z_STRSIZE_PP(file) + MAX_LENGTH_OF_LONG + 4 + 1); + s_tmp = emalloc(Z_STRLEN_PP(file) + MAX_LENGTH_OF_LONG + 4 + 1); sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_PP(file), line); TRACE_APPEND_STRL(s_tmp, strlen(s_tmp)); efree(s_tmp); @@ -530,7 +528,7 @@ ZEND_METHOD(exception, getTraceAsString) { zval *trace; char *res, **str, *s_tmp; - zend_str_size res_len = 0, *len = &res_len, num = 0; + int res_len = 0, *len = &res_len, num = 0; DEFAULT_0_PARAMS; @@ -562,10 +560,10 @@ ZEND_METHOD(exception, getPrevious) RETURN_ZVAL(previous, 1, 0); } -zend_str_size_int zend_spprintf(char **message, zend_str_size_int max_len, char *format, ...) /* {{{ */ +int zend_spprintf(char **message, int max_len, char *format, ...) /* {{{ */ { va_list arg; - zend_str_size len; + int len; va_start(arg, format); len = zend_vspprintf(message, max_len, format, arg); @@ -580,7 +578,7 @@ ZEND_METHOD(exception, __toString) { zval message, file, line, *trace, *exception; char *str, *prev_str; - zend_str_size len = 0; + int len = 0; zend_fcall_info fci; zval fname; @@ -618,15 +616,15 @@ ZEND_METHOD(exception, __toString) trace = NULL; } - if (Z_STRSIZE(message) > 0) { + if (Z_STRLEN(message) > 0) { len = zend_spprintf(&str, 0, "exception '%s' with message '%s' in %s:%ld\nStack trace:\n%s%s%s", Z_OBJCE_P(exception)->name, Z_STRVAL(message), Z_STRVAL(file), Z_LVAL(line), - (trace && Z_STRSIZE_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n", + (trace && Z_STRLEN_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n", len ? "\n\nNext " : "", prev_str); } else { len = zend_spprintf(&str, 0, "exception '%s' in %s:%ld\nStack trace:\n%s%s%s", Z_OBJCE_P(exception)->name, Z_STRVAL(file), Z_LVAL(line), - (trace && Z_STRSIZE_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n", + (trace && Z_STRLEN_P(trace)) ? Z_STRVAL_P(trace) : "#0 {main}\n", len ? "\n\nNext " : "", prev_str); } efree(prev_str); @@ -785,7 +783,7 @@ ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, char } /* }}} */ -static void zend_error_va(int type, const char *file, zend_str_size_uint lineno, const char *format, ...) /* {{{ */ +static void zend_error_va(int type, const char *file, uint lineno, const char *format, ...) /* {{{ */ { va_list args; @@ -821,7 +819,7 @@ ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* { line = zend_read_property(default_exception_ce, EG(exception), "line", sizeof("line")-1, 1 TSRMLS_CC); convert_to_string(file); - file = (Z_STRSIZE_P(file) > 0) ? file : NULL; + file = (Z_STRLEN_P(file) > 0) ? file : NULL; line = (Z_TYPE_P(line) == IS_LONG) ? line : NULL; } else { file = NULL; @@ -838,7 +836,7 @@ ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* { convert_to_string(file); convert_to_long(line); - zend_error_va(severity, (Z_STRSIZE_P(file) > 0) ? Z_STRVAL_P(file) : NULL, Z_LVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str)); + zend_error_va(severity, (Z_STRLEN_P(file) > 0) ? Z_STRVAL_P(file) : NULL, Z_LVAL_P(line), "Uncaught %s\n thrown", Z_STRVAL_P(str)); } else { zend_error(severity, "Uncaught exception '%s'", ce_exception->name); } diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h index e0c56053bd66d..82633530d61ad 100644 --- a/Zend/zend_exceptions.h +++ b/Zend/zend_exceptions.h @@ -53,7 +53,7 @@ extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC); ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC); /* do not export, in php it's available thru spprintf directly */ -zend_str_size_int zend_spprintf(char **message, zend_str_size_int max_len, char *format, ...); +int zend_spprintf(char **message, int max_len, char *format, ...); END_EXTERN_C() diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 50c19adc4a365..3c3dd8e3b0b57 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -566,7 +566,7 @@ static inline void make_real_object(zval **object_ptr TSRMLS_DC) { if (Z_TYPE_PP(object_ptr) == IS_NULL || (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr) == 0) - || (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRSIZE_PP(object_ptr) == 0) + || (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRLEN_PP(object_ptr) == 0) ) { SEPARATE_ZVAL_IF_NOT_REF(object_ptr); zval_dtor(*object_ptr); @@ -684,7 +684,7 @@ static inline void zend_assign_to_object(zval **retval, zval **object_ptr, zval } if (Z_TYPE_P(object) == IS_NULL || (Z_TYPE_P(object) == IS_BOOL && Z_LVAL_P(object) == 0) || - (Z_TYPE_P(object) == IS_STRING && Z_STRSIZE_P(object) == 0)) { + (Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0)) { SEPARATE_ZVAL_IF_NOT_REF(object_ptr); object = *object_ptr; Z_ADDREF_P(object); @@ -774,24 +774,24 @@ static inline int zend_assign_to_string_offset(const temp_variable *T, const zva return 0; } - if (T->str_offset.offset >= Z_STRSIZE_P(T->str_offset.str)) { + if (T->str_offset.offset >= Z_STRLEN_P(T->str_offset.str)) { if (IS_INTERNED(Z_STRVAL_P(T->str_offset.str))) { char *tmp = (char *) emalloc(T->str_offset.offset+1+1); - memcpy(tmp, Z_STRVAL_P(T->str_offset.str), Z_STRSIZE_P(T->str_offset.str)+1); + memcpy(tmp, Z_STRVAL_P(T->str_offset.str), Z_STRLEN_P(T->str_offset.str)+1); Z_STRVAL_P(T->str_offset.str) = tmp; } else { Z_STRVAL_P(T->str_offset.str) = (char *) erealloc(Z_STRVAL_P(T->str_offset.str), T->str_offset.offset+1+1); } - memset(Z_STRVAL_P(T->str_offset.str) + Z_STRSIZE_P(T->str_offset.str), + memset(Z_STRVAL_P(T->str_offset.str) + Z_STRLEN_P(T->str_offset.str), ' ', - T->str_offset.offset - Z_STRSIZE_P(T->str_offset.str)); + T->str_offset.offset - Z_STRLEN_P(T->str_offset.str)); Z_STRVAL_P(T->str_offset.str)[T->str_offset.offset+1] = 0; - Z_STRSIZE_P(T->str_offset.str) = T->str_offset.offset+1; + Z_STRLEN_P(T->str_offset.str) = T->str_offset.offset+1; } else if (IS_INTERNED(Z_STRVAL_P(T->str_offset.str))) { - char *tmp = (char *) emalloc(Z_STRSIZE_P(T->str_offset.str) + 1); + char *tmp = (char *) emalloc(Z_STRLEN_P(T->str_offset.str) + 1); - memcpy(tmp, Z_STRVAL_P(T->str_offset.str), Z_STRSIZE_P(T->str_offset.str) + 1); + memcpy(tmp, Z_STRVAL_P(T->str_offset.str), Z_STRLEN_P(T->str_offset.str) + 1); Z_STRVAL_P(T->str_offset.str) = tmp; } @@ -1148,7 +1148,7 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container case IS_STRING: { zval tmp; - if (type != BP_VAR_UNSET && Z_STRSIZE_P(container)==0) { + if (type != BP_VAR_UNSET && Z_STRLEN_P(container)==0) { goto convert_to_array; } if (dim == NULL) { @@ -1164,7 +1164,7 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container switch(Z_TYPE_P(dim)) { /* case IS_LONG: */ case IS_STRING: - if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRSIZE_P(dim), NULL, NULL, -1)) { + if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) { break; } if (type != BP_VAR_UNSET) { @@ -1284,7 +1284,7 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval **cont switch(Z_TYPE_P(dim)) { /* case IS_LONG: */ case IS_STRING: - if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRSIZE_P(dim), NULL, NULL, -1)) { + if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) { break; } if (type != BP_VAR_IS) { @@ -1313,17 +1313,17 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval **cont INIT_PZVAL(ptr); Z_TYPE_P(ptr) = IS_STRING; - if (Z_LVAL_P(dim) < 0 || Z_STRSIZE_P(container) <= Z_LVAL_P(dim)) { + if (Z_LVAL_P(dim) < 0 || Z_STRLEN_P(container) <= Z_LVAL_P(dim)) { if (type != BP_VAR_IS) { zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim)); } Z_STRVAL_P(ptr) = STR_EMPTY_ALLOC(); - Z_STRSIZE_P(ptr) = 0; + Z_STRLEN_P(ptr) = 0; } else { Z_STRVAL_P(ptr) = (char*)emalloc(2); Z_STRVAL_P(ptr)[0] = Z_STRVAL_P(container)[Z_LVAL_P(dim)]; Z_STRVAL_P(ptr)[1] = 0; - Z_STRSIZE_P(ptr) = 1; + Z_STRLEN_P(ptr) = 1; } AI_SET_PTR(result, ptr); return; @@ -1378,7 +1378,7 @@ static void zend_fetch_property_address(temp_variable *result, zval **container_ if (type != BP_VAR_UNSET && ((Z_TYPE_P(container) == IS_NULL || (Z_TYPE_P(container) == IS_BOOL && Z_LVAL_P(container)==0) || - (Z_TYPE_P(container) == IS_STRING && Z_STRSIZE_P(container)==0)))) { + (Z_TYPE_P(container) == IS_STRING && Z_STRLEN_P(container)==0)))) { if (!PZVAL_IS_REF(container)) { SEPARATE_ZVAL(container_ptr); container = *container_ptr; diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index a7c3c59e9dcdd..a17f10b312e53 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -37,7 +37,7 @@ typedef union _temp_variable { struct { zval **ptr_ptr; /* shared with var.ptr_ptr */ zval *str; - zend_str_size_uint offset; + zend_uint offset; } str_offset; struct { zval **ptr_ptr; /* shared with var.ptr_ptr */ @@ -61,12 +61,12 @@ ZEND_API void zend_execute(zend_op_array *op_array TSRMLS_DC); ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC); ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, struct _zend_fcall_info *fci, int return_value_used TSRMLS_DC); ZEND_API int zend_is_true(zval *op); -ZEND_API int zend_lookup_class(const char *name, zend_str_size_int name_length, zend_class_entry ***ce TSRMLS_DC); -ZEND_API int zend_lookup_class_ex(const char *name, zend_str_size_int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC); +ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC); +ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC); ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC); -ZEND_API int zend_eval_stringl(char *str, zend_str_size_int str_len, zval *retval_ptr, char *string_name TSRMLS_DC); +ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *string_name 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, zend_str_size_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, ulong fetch_type, const char **class_name, zend_class_entry **pce TSRMLS_DC); ZEND_API int 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 TSRMLS_DC); @@ -108,8 +108,8 @@ static zend_always_inline int i_zend_is_true(zval *op) result = (Z_DVAL_P(op) ? 1 : 0); break; case IS_STRING: - if (Z_STRSIZE_P(op) == 0 - || (Z_STRSIZE_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { + if (Z_STRLEN_P(op) == 0 + || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { result = 0; } else { result = 1; @@ -198,7 +198,7 @@ static zend_always_inline void zend_vm_stack_destroy(TSRMLS_D) } } -static zend_always_inline void zend_vm_stack_extend(size_t count TSRMLS_DC) +static zend_always_inline void zend_vm_stack_extend(int count TSRMLS_DC) { zend_vm_stack p = zend_vm_stack_new_page(count >= ZEND_VM_STACK_PAGE_SIZE ? count : ZEND_VM_STACK_PAGE_SIZE); p->prev = EG(argument_stack); @@ -342,14 +342,14 @@ void execute_new_code(TSRMLS_D); ZEND_API const char *get_active_class_name(const char **space TSRMLS_DC); ZEND_API const char *get_active_function_name(TSRMLS_D); ZEND_API const char *zend_get_executed_filename(TSRMLS_D); -ZEND_API zend_str_size_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 void zend_set_timeout(long seconds, int reset_signals); ZEND_API void zend_unset_timeout(TSRMLS_D); ZEND_API void zend_timeout(int dummy); -ZEND_API zend_class_entry *zend_fetch_class(const char *class_name, zend_str_size_uint class_name_len, int fetch_type TSRMLS_DC); -ZEND_API zend_class_entry *zend_fetch_class_by_name(const char *class_name, zend_str_size_uint class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC); +ZEND_API zend_class_entry *zend_fetch_class(const char *class_name, uint class_name_len, int fetch_type TSRMLS_DC); +ZEND_API zend_class_entry *zend_fetch_class_by_name(const char *class_name, uint class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC); void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC); #ifdef ZEND_WIN32 diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index dbcc07729f4d0..d831b107a1a38 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -401,7 +401,7 @@ ZEND_API const char *zend_get_executed_filename(TSRMLS_D) /* {{{ */ } /* }}} */ -ZEND_API zend_str_size_uint zend_get_executed_lineno(TSRMLS_D) /* {{{ */ +ZEND_API uint zend_get_executed_lineno(TSRMLS_D) /* {{{ */ { if(EG(exception) && EG(opline_ptr) && active_opline->opcode == ZEND_HANDLE_EXCEPTION && active_opline->lineno == 0 && EG(opline_before_exception)) { @@ -492,11 +492,11 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco if (!zend_get_constant_ex(p->value.str.val, p->value.str.len, &const_value, scope, Z_REAL_TYPE_P(p) TSRMLS_CC)) { 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)))) { zend_error(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(p)); - Z_STRSIZE_P(p) -= ((colon - Z_STRVAL_P(p)) + 1); + Z_STRLEN_P(p) -= ((colon - Z_STRVAL_P(p)) + 1); if (inline_change) { - colon = estrndup(colon, Z_STRSIZE_P(p)); + colon = estrndup(colon, Z_STRLEN_P(p)); str_efree(Z_STRVAL_P(p)); Z_STRVAL_P(p) = colon; } else { @@ -504,20 +504,20 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco } } else { char *save = actual, *slash; - zend_str_size actual_len = Z_STRSIZE_P(p); + int actual_len = Z_STRLEN_P(p); if ((Z_TYPE_P(p) & IS_CONSTANT_UNQUALIFIED) && (slash = (char *)zend_memrchr(actual, '\\', actual_len))) { actual = slash + 1; actual_len -= (actual - Z_STRVAL_P(p)); if (inline_change) { actual = estrndup(actual, actual_len); Z_STRVAL_P(p) = actual; - Z_STRSIZE_P(p) = actual_len; + Z_STRLEN_P(p) = actual_len; } } if (actual[0] == '\\') { if (inline_change) { - memmove(Z_STRVAL_P(p), Z_STRVAL_P(p)+1, Z_STRSIZE_P(p)); - --Z_STRSIZE_P(p); + memmove(Z_STRVAL_P(p), Z_STRVAL_P(p)+1, Z_STRLEN_P(p)); + --Z_STRLEN_P(p); } else { ++actual; } @@ -545,7 +545,7 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco p->type = IS_STRING; if (!inline_change) { Z_STRVAL_P(p) = actual; - Z_STRSIZE_P(p) = actual_len; + Z_STRLEN_P(p) = actual_len; zval_copy_ctor(p); } } @@ -561,7 +561,7 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco } else if (Z_TYPE_P(p) == IS_CONSTANT_ARRAY) { zval **element, *new_val; char *str_index; - zend_str_size str_index_len; + uint str_index_len; ulong num_index; int ret; @@ -636,7 +636,7 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco switch (Z_TYPE(const_value)) { case IS_STRING: - ret = zend_symtable_update_current_key(Z_ARRVAL_P(p), Z_STRVAL(const_value), Z_STRSIZE(const_value) + 1, HASH_UPDATE_KEY_IF_BEFORE); + ret = zend_symtable_update_current_key(Z_ARRVAL_P(p), Z_STRVAL(const_value), Z_STRLEN(const_value) + 1, HASH_UPDATE_KEY_IF_BEFORE); break; case IS_BOOL: case IS_LONG: @@ -1010,14 +1010,13 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS } /* }}} */ -ZEND_API int zend_lookup_class_ex(const char *name, zend_str_size_int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC) /* {{{ */ +ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC) /* {{{ */ { zval **args[1]; zval autoload_function; zval *class_name_ptr; zval *retval_ptr = NULL; - int retval; - zend_str_size lc_length; + int retval, lc_length; char *lc_name; char *lc_free; zend_fcall_info fcall_info; @@ -1028,7 +1027,7 @@ ZEND_API int zend_lookup_class_ex(const char *name, zend_str_size_int name_lengt if (key) { lc_name = Z_STRVAL(key->constant); - lc_length = Z_STRSIZE(key->constant) + 1; + lc_length = Z_STRLEN(key->constant) + 1; hash = key->hash_value; } else { if (name == NULL || !name_length) { @@ -1055,7 +1054,7 @@ ZEND_API int zend_lookup_class_ex(const char *name, zend_str_size_int name_lengt } /* The compiler is not-reentrant. Make sure we __autoload() only during run-time - * (doesn't impact functionality of __autoload() + * (doesn't impact fuctionality of __autoload() */ if (!use_autoload || zend_is_compiling(TSRMLS_C)) { if (!key) { @@ -1128,13 +1127,13 @@ ZEND_API int zend_lookup_class_ex(const char *name, zend_str_size_int name_lengt } /* }}} */ -ZEND_API int zend_lookup_class(const char *name, zend_str_size_int name_length, zend_class_entry ***ce TSRMLS_DC) /* {{{ */ +ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC) /* {{{ */ { return zend_lookup_class_ex(name, name_length, NULL, 1, ce TSRMLS_CC); } /* }}} */ -ZEND_API int zend_eval_stringl(char *str, zend_str_size_int str_len, zval *retval_ptr, char *string_name TSRMLS_DC) /* {{{ */ +ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *string_name TSRMLS_DC) /* {{{ */ { zval pv; zend_op_array *new_op_array; @@ -1143,14 +1142,14 @@ ZEND_API int zend_eval_stringl(char *str, zend_str_size_int str_len, zval *retva int retval; if (retval_ptr) { - Z_STRSIZE(pv) = str_len + sizeof("return ;") - 1; - Z_STRVAL(pv) = emalloc(Z_STRSIZE(pv) + 1); + Z_STRLEN(pv) = str_len + sizeof("return ;") - 1; + Z_STRVAL(pv) = emalloc(Z_STRLEN(pv) + 1); memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1); memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, str, str_len); - Z_STRVAL(pv)[Z_STRSIZE(pv) - 1] = ';'; - Z_STRVAL(pv)[Z_STRSIZE(pv)] = '\0'; + Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';'; + Z_STRVAL(pv)[Z_STRLEN(pv)] = '\0'; } else { - Z_STRSIZE(pv) = str_len; + Z_STRLEN(pv) = str_len; Z_STRVAL(pv) = str; } Z_TYPE(pv) = IS_STRING; @@ -1220,7 +1219,7 @@ ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSR } /* }}} */ -ZEND_API int zend_eval_stringl_ex(char *str, zend_str_size_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) /* {{{ */ { int result; @@ -1525,7 +1524,7 @@ void zend_unset_timeout(TSRMLS_D) /* {{{ */ } /* }}} */ -zend_class_entry *zend_fetch_class(const char *class_name, zend_str_size_uint class_name_len, int fetch_type TSRMLS_DC) /* {{{ */ +zend_class_entry *zend_fetch_class(const char *class_name, uint class_name_len, int fetch_type TSRMLS_DC) /* {{{ */ { zend_class_entry **pce; int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0; @@ -1580,7 +1579,7 @@ zend_class_entry *zend_fetch_class(const char *class_name, zend_str_size_uint cl } /* }}} */ -zend_class_entry *zend_fetch_class_by_name(const char *class_name, zend_str_size_uint class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC) /* {{{ */ +zend_class_entry *zend_fetch_class_by_name(const char *class_name, uint class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC) /* {{{ */ { zend_class_entry **pce; int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0; @@ -1675,7 +1674,7 @@ ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC) /* {{{ */ } /* }}} */ -ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const char *name, zend_str_size_int name_len, ulong hash_value TSRMLS_DC) /* {{{ */ +ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const char *name, int name_len, ulong hash_value TSRMLS_DC) /* {{{ */ { if (zend_hash_quick_del(ht, name, name_len, hash_value) == SUCCESS) { name_len--; @@ -1698,7 +1697,7 @@ ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const c } /* }}} */ -ZEND_API int zend_delete_global_variable_ex(const char *name, zend_str_size_int name_len, ulong hash_value TSRMLS_DC) /* {{{ */ +ZEND_API int zend_delete_global_variable_ex(const char *name, int name_len, ulong hash_value TSRMLS_DC) /* {{{ */ { zend_execute_data *ex; @@ -1723,7 +1722,7 @@ ZEND_API int zend_delete_global_variable_ex(const char *name, zend_str_size_int } /* }}} */ -ZEND_API int zend_delete_global_variable(const char *name, zend_str_size_int name_len TSRMLS_DC) /* {{{ */ +ZEND_API int zend_delete_global_variable(const char *name, int name_len TSRMLS_DC) /* {{{ */ { return zend_delete_global_variable_ex(name, name_len, zend_inline_hash_func(name, name_len + 1) TSRMLS_CC); } diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 1a805bbd6d61c..4b22eb242e0ee 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -55,7 +55,7 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished zval_ptr_dtor(&execute_data->current_this); } - /* A fatal error / die occurred during the generator execution. Trying to clean + /* A fatal error / die occured during the generator execution. Trying to clean * up the stack may not be safe in this case. */ if (CG(unclean_shutdown)) { return; diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index b9a5b39914a6c..800bdc7f66bcf 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -302,7 +302,7 @@ struct _zend_php_scanner_globals { unsigned char *script_filtered; size_t script_filtered_size; - /* input/output filters */ + /* input/ouput filters */ zend_encoding_filter input_filter; zend_encoding_filter output_filter; const zend_encoding *script_encoding; diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index fff735c288751..c4cd8421cc78c 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -49,7 +49,7 @@ #define HT_DESTROYED 2 #define HT_CLEANING 3 -static void _zend_is_inconsistent(const HashTable *ht, const char *file, zend_str_size_int line) +static void _zend_is_inconsistent(const HashTable *ht, const char *file, int line) { if (ht->inconsistent==HT_OK) { return; @@ -98,7 +98,7 @@ static void _zend_is_inconsistent(const HashTable *ht, const char *file, zend_st static void zend_hash_do_resize(HashTable *ht); -ZEND_API ulong zend_hash_func(const char *arKey, zend_str_size_uint nKeyLength) +ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength) { return zend_inline_hash_func(arKey, nKeyLength); } @@ -188,7 +188,7 @@ ZEND_API void zend_hash_set_apply_protection(HashTable *ht, zend_bool bApplyProt -ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) { ulong h; uint nIndex; @@ -265,7 +265,7 @@ ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, zend_str return SUCCESS; } -ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) { uint nIndex; Bucket *p; @@ -340,7 +340,7 @@ ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, ze } -ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength) +ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, uint nKeyLength) { void *dummy = (void *) 1; @@ -459,7 +459,7 @@ ZEND_API int zend_hash_rehash(HashTable *ht) return SUCCESS; } -ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, ulong h, int flag) +ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, int flag) { uint nIndex; Bucket *p; @@ -876,7 +876,7 @@ ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor } -ZEND_API ulong zend_get_hash_value(const char *arKey, zend_str_size_uint nKeyLength) +ZEND_API ulong zend_get_hash_value(const char *arKey, uint nKeyLength) { return zend_inline_hash_func(arKey, nKeyLength); } @@ -886,7 +886,7 @@ ZEND_API ulong zend_get_hash_value(const char *arKey, zend_str_size_uint nKeyLen * data is returned in pData. The reason is that there's no reason * someone using the hash table might not want to have NULL data */ -ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, void **pData) +ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, uint nKeyLength, void **pData) { ulong h; uint nIndex; @@ -910,7 +910,7 @@ ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, zend_str_siz } -ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, ulong h, void **pData) +ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void **pData) { uint nIndex; Bucket *p; @@ -936,7 +936,7 @@ ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, zend_s } -ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength) +ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, uint nKeyLength) { ulong h; uint nIndex; @@ -959,7 +959,7 @@ ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, zend_str_s } -ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, ulong h) +ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h) { uint nIndex; Bucket *p; @@ -1120,7 +1120,7 @@ ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos) /* This function should be made binary safe */ -ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, zend_str_size_uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos) +ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos) { Bucket *p; @@ -1144,7 +1144,7 @@ ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, return HASH_KEY_IS_LONG; } } - return HASH_KEY_NON_EXISTENT; + return HASH_KEY_NON_EXISTANT; } ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos) { @@ -1159,7 +1159,7 @@ ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, } else if (p->nKeyLength) { Z_TYPE_P(key) = IS_STRING; Z_STRVAL_P(key) = estrndup(p->arKey, p->nKeyLength - 1); - Z_STRSIZE_P(key) = p->nKeyLength - 1; + Z_STRLEN_P(key) = p->nKeyLength - 1; } else { Z_TYPE_P(key) = IS_LONG; Z_LVAL_P(key) = p->h; @@ -1181,7 +1181,7 @@ ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos) return HASH_KEY_IS_LONG; } } - return HASH_KEY_NON_EXISTENT; + return HASH_KEY_NON_EXISTANT; } @@ -1204,7 +1204,7 @@ ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosi /* This function changes key of current element without changing elements' * order. If element with target key already exists, it will be deleted first. */ -ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, zend_str_size_uint str_length, ulong num_index, int mode, HashPosition *pos) +ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, uint str_length, ulong num_index, int mode, HashPosition *pos) { Bucket *p, *q; ulong h; diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 28b7a3e51e676..a0c147f39782a 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -27,8 +27,7 @@ #define HASH_KEY_IS_STRING 1 #define HASH_KEY_IS_LONG 2 -#define HASH_KEY_NON_EXISTENT 3 -#define HASH_KEY_NON_EXISTANT HASH_KEY_NON_EXISTENT /* Keeping old define (with typo) for backward compatibility */ +#define HASH_KEY_NON_EXISTANT 3 #define HASH_UPDATE (1<<0) #define HASH_ADD (1<<1) @@ -43,7 +42,7 @@ #define HASH_UPDATE_KEY_IF_AFTER 2 #define HASH_UPDATE_KEY_ANYWAY 3 -typedef ulong (*hash_func_t)(const char *arKey, zend_str_size_uint nKeyLength); +typedef ulong (*hash_func_t)(const char *arKey, uint nKeyLength); typedef int (*compare_func_t)(const void *, const void * TSRMLS_DC); typedef void (*sort_func_t)(void *, size_t, register size_t, compare_func_t TSRMLS_DC); typedef void (*dtor_func_t)(void *pDest); @@ -54,7 +53,7 @@ struct _hashtable; typedef struct bucket { ulong h; /* Used for numeric indexing */ - zend_str_size_uint nKeyLength; + uint nKeyLength; void *pData; void *pDataPtr; struct bucket *pListNext; @@ -85,7 +84,7 @@ typedef struct _hashtable { typedef struct _zend_hash_key { const char *arKey; - zend_str_size_uint nKeyLength; + uint nKeyLength; ulong h; } zend_hash_key; @@ -105,13 +104,13 @@ ZEND_API void zend_hash_clean(HashTable *ht); #define zend_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, bApplyProtection) _zend_hash_init_ex((ht), (nSize), (pHashFunction), (pDestructor), (persistent), (bApplyProtection) ZEND_FILE_LINE_CC) /* additions/updates/changes */ -ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); +ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); #define zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \ _zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC) #define zend_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) \ _zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD ZEND_FILE_LINE_CC) -ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); +ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); #define zend_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \ _zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC) #define zend_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \ @@ -123,7 +122,7 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void #define zend_hash_next_index_insert(ht, pData, nDataSize, pDest) \ _zend_hash_index_update_or_next_insert(ht, 0, pData, nDataSize, pDest, HASH_NEXT_INSERT ZEND_FILE_LINE_CC) -ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength); +ZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, uint nKeyLength); #define ZEND_HASH_APPLY_KEEP 0 @@ -150,7 +149,7 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR /* Deletes */ -ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, ulong h, int flag); +ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint nKeyLength, ulong h, int flag); #define zend_hash_del(ht, arKey, nKeyLength) \ zend_hash_del_key_or_index(ht, arKey, nKeyLength, 0, HASH_DEL_KEY) #define zend_hash_quick_del(ht, arKey, nKeyLength, h) \ @@ -158,31 +157,31 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, zend_s #define zend_hash_index_del(ht, h) \ zend_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX) -ZEND_API ulong zend_get_hash_value(const char *arKey, zend_str_size_uint nKeyLength); +ZEND_API ulong zend_get_hash_value(const char *arKey, uint nKeyLength); /* Data retreival */ -ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, void **pData); -ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, ulong h, void **pData); +ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, uint nKeyLength, void **pData); +ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h, void **pData); ZEND_API int zend_hash_index_find(const HashTable *ht, ulong h, void **pData); /* Misc */ -ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength); -ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, ulong h); +ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, uint nKeyLength); +ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, uint nKeyLength, ulong h); ZEND_API int zend_hash_index_exists(const HashTable *ht, ulong h); ZEND_API ulong zend_hash_next_free_element(const HashTable *ht); /* traversing */ #define zend_hash_has_more_elements_ex(ht, pos) \ - (zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTENT ? FAILURE : SUCCESS) + (zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTANT ? FAILURE : SUCCESS) ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos); ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos); -ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, zend_str_size_uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos); +ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos); ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos); ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos); ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos); ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos); ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos); -ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, zend_str_size_uint str_length, ulong num_index, int mode, HashPosition *pos); +ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const char *str_index, uint str_length, ulong num_index, int mode, HashPosition *pos); typedef struct _HashPointer { HashPosition pos; @@ -261,7 +260,7 @@ ZEND_API int zend_hash_rehash(HashTable *ht); * -- Ralf S. Engelschall */ -static inline ulong zend_inline_hash_func(const char *arKey, zend_str_size_uint nKeyLength) +static inline ulong zend_inline_hash_func(const char *arKey, uint nKeyLength) { register ulong hash = 5381; @@ -291,7 +290,7 @@ EMPTY_SWITCH_DEFAULT_CASE() } -ZEND_API ulong zend_hash_func(const char *arKey, zend_str_size_uint nKeyLength); +ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength); #if ZEND_DEBUG /* debug */ @@ -348,34 +347,34 @@ END_EXTERN_C() ZEND_HANDLE_NUMERIC_EX(key, length, idx, return func); \ } while (0) -static inline int zend_symtable_update(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, void *pData, uint nDataSize, void **pDest) \ +static inline int zend_symtable_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) \ { ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest)); return zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest); } -static inline int zend_symtable_del(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength) +static inline int zend_symtable_del(HashTable *ht, const char *arKey, uint nKeyLength) { ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_del(ht, idx)); return zend_hash_del(ht, arKey, nKeyLength); } -static inline int zend_symtable_find(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, void **pData) +static inline int zend_symtable_find(HashTable *ht, const char *arKey, uint nKeyLength, void **pData) { ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_find(ht, idx, pData)); return zend_hash_find(ht, arKey, nKeyLength, pData); } -static inline int zend_symtable_exists(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength) +static inline int zend_symtable_exists(HashTable *ht, const char *arKey, uint nKeyLength) { ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx)); return zend_hash_exists(ht, arKey, nKeyLength); } -static inline int zend_symtable_update_current_key_ex(HashTable *ht, const char *arKey, zend_str_size_uint nKeyLength, int mode, HashPosition *pos) +static inline int zend_symtable_update_current_key_ex(HashTable *ht, const char *arKey, uint nKeyLength, int mode, HashPosition *pos) { ZEND_HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_update_current_key_ex(ht, HASH_KEY_IS_LONG, NULL, 0, idx, mode, pos)); return zend_hash_update_current_key_ex(ht, HASH_KEY_IS_STRING, arKey, nKeyLength, 0, mode, pos); diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c index aab7804094f4e..c789cb719a01b 100644 --- a/Zend/zend_highlight.c +++ b/Zend/zend_highlight.c @@ -54,7 +54,7 @@ ZEND_API void zend_html_putc(char c) } -ZEND_API void zend_html_puts(const char *s, zend_str_size_uint len TSRMLS_DC) +ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC) { const unsigned char *ptr = (const unsigned char*)s, *end = ptr + len; unsigned char *filtered; diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h index 087ad33fb70f8..20adf349ae200 100644 --- a/Zend/zend_highlight.h +++ b/Zend/zend_highlight.h @@ -44,7 +44,7 @@ ZEND_API void zend_strip(TSRMLS_D); ZEND_API int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini TSRMLS_DC); ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name TSRMLS_DC); ZEND_API void zend_html_putc(char c); -ZEND_API void zend_html_puts(const char *s, zend_str_size_uint len TSRMLS_DC); +ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC); END_EXTERN_C() extern zend_syntax_highlighter_ini syntax_highlighter_ini; diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 3afb67b2f3026..2c74f20f6a426 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -145,7 +145,7 @@ ZEND_API int zend_copy_ini_directives(TSRMLS_D) /* {{{ */ /* }}} */ #endif -static zend_str_size_int ini_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ +static int ini_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ { const Bucket *f; const Bucket *s; @@ -205,9 +205,9 @@ ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int modu hashed_ini_entry->module_number = module_number; if ((zend_get_configuration_directive(p->name, p->name_length, &default_value)) == SUCCESS) { if (!hashed_ini_entry->on_modify - || hashed_ini_entry->on_modify(hashed_ini_entry, Z_STRVAL(default_value), Z_STRSIZE(default_value), hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC) == SUCCESS) { + || hashed_ini_entry->on_modify(hashed_ini_entry, Z_STRVAL(default_value), Z_STRLEN(default_value), hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC) == SUCCESS) { hashed_ini_entry->value = Z_STRVAL(default_value); - hashed_ini_entry->value_length = Z_STRSIZE(default_value); + hashed_ini_entry->value_length = Z_STRLEN(default_value); config_directive_success = 1; } } @@ -244,7 +244,7 @@ ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) /* {{{ */ /* }}} */ #endif -ZEND_API int zend_alter_ini_entry(char *name, zend_str_size_uint name_length, char *new_value, zend_str_size_uint new_value_length, int modify_type, int stage) /* {{{ */ +ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage) /* {{{ */ { TSRMLS_FETCH(); @@ -252,7 +252,7 @@ ZEND_API int zend_alter_ini_entry(char *name, zend_str_size_uint name_length, ch } /* }}} */ -ZEND_API int zend_alter_ini_entry_ex(char *name, zend_str_size_uint name_length, char *new_value, zend_str_size_uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC) /* {{{ */ +ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC) /* {{{ */ { zend_ini_entry *ini_entry; char *duplicate; @@ -306,7 +306,7 @@ ZEND_API int zend_alter_ini_entry_ex(char *name, zend_str_size_uint name_length, } /* }}} */ -ZEND_API int zend_restore_ini_entry(char *name, zend_str_size_uint name_length, int stage) /* {{{ */ +ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); @@ -328,7 +328,7 @@ ZEND_API int zend_restore_ini_entry(char *name, zend_str_size_uint name_length, } /* }}} */ -ZEND_API int zend_ini_register_displayer(char *name, zend_str_size_uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) /* {{{ */ +ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) /* {{{ */ { zend_ini_entry *ini_entry; @@ -345,7 +345,7 @@ ZEND_API int zend_ini_register_displayer(char *name, zend_str_size_uint name_len * Data retrieval */ -ZEND_API long zend_ini_long(char *name, zend_str_size_uint name_length, int orig) /* {{{ */ +ZEND_API long zend_ini_long(char *name, uint name_length, int orig) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); @@ -362,7 +362,7 @@ ZEND_API long zend_ini_long(char *name, zend_str_size_uint name_length, int orig } /* }}} */ -ZEND_API double zend_ini_double(char *name, zend_str_size_uint name_length, int orig) /* {{{ */ +ZEND_API double zend_ini_double(char *name, uint name_length, int orig) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); @@ -379,7 +379,7 @@ ZEND_API double zend_ini_double(char *name, zend_str_size_uint name_length, int } /* }}} */ -ZEND_API char *zend_ini_string_ex(char *name, zend_str_size_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) /* {{{ */ { zend_ini_entry *ini_entry; TSRMLS_FETCH(); @@ -403,7 +403,7 @@ ZEND_API char *zend_ini_string_ex(char *name, zend_str_size_uint name_length, in } /* }}} */ -ZEND_API char *zend_ini_string(char *name, zend_str_size_uint name_length, int orig) /* {{{ */ +ZEND_API char *zend_ini_string(char *name, uint name_length, int orig) /* {{{ */ { zend_bool exists = 1; char *return_value; @@ -425,7 +425,7 @@ static void zend_ini_displayer_cb(zend_ini_entry *ini_entry, int type) /* {{{ */ ini_entry->displayer(ini_entry, type); } else { char *display_string; - zend_str_size_uint display_string_length; + uint display_string_length; if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { if (ini_entry->orig_value) { diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h index 42bd7990fbca9..b27d3d4adde7c 100644 --- a/Zend/zend_ini.h +++ b/Zend/zend_ini.h @@ -57,24 +57,24 @@ #endif -#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, char *new_value, zend_str_size_int new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage TSRMLS_DC) +#define ZEND_INI_MH(name) int name(zend_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage TSRMLS_DC) #define ZEND_INI_DISP(name) void name(zend_ini_entry *ini_entry, int type) struct _zend_ini_entry { int module_number; int modifiable; char *name; - zend_str_size_uint name_length; + uint name_length; ZEND_INI_MH((*on_modify)); void *mh_arg1; void *mh_arg2; void *mh_arg3; char *value; - zend_str_size_uint value_length; + uint value_length; char *orig_value; - zend_str_size_uint orig_value_length; + uint orig_value_length; int orig_modifiable; int modified; @@ -94,17 +94,17 @@ ZEND_API void zend_ini_sort_entries(TSRMLS_D); ZEND_API int zend_register_ini_entries(const zend_ini_entry *ini_entry, int module_number TSRMLS_DC); ZEND_API void zend_unregister_ini_entries(int module_number TSRMLS_DC); ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC); -ZEND_API int zend_alter_ini_entry(char *name, zend_str_size_uint name_length, char *new_value, zend_str_size_uint new_value_length, int modify_type, int stage); -ZEND_API int zend_alter_ini_entry_ex(char *name, zend_str_size_uint name_length, char *new_value, zend_str_size_uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC); -ZEND_API int zend_restore_ini_entry(char *name, zend_str_size_uint name_length, int stage); +ZEND_API int zend_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage); +ZEND_API int zend_alter_ini_entry_ex(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage, int force_change TSRMLS_DC); +ZEND_API int zend_restore_ini_entry(char *name, uint name_length, int stage); ZEND_API void display_ini_entries(zend_module_entry *module); -ZEND_API long zend_ini_long(char *name, zend_str_size_uint name_length, int orig); -ZEND_API double zend_ini_double(char *name, zend_str_size_uint name_length, int orig); -ZEND_API char *zend_ini_string(char *name, zend_str_size_uint name_length, int orig); -ZEND_API char *zend_ini_string_ex(char *name, zend_str_size_uint name_length, int orig, zend_bool *exists); +ZEND_API long zend_ini_long(char *name, uint name_length, int orig); +ZEND_API double zend_ini_double(char *name, uint name_length, int orig); +ZEND_API char *zend_ini_string(char *name, uint name_length, int orig); +ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_bool *exists); -ZEND_API int zend_ini_register_displayer(char *name, zend_str_size_uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)); +ZEND_API int zend_ini_register_displayer(char *name, uint name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)); ZEND_API ZEND_INI_DISP(zend_ini_boolean_displayer_cb); ZEND_API ZEND_INI_DISP(zend_ini_color_displayer_cb); diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y index 1fa70c6b541cc..901babad60aef 100644 --- a/Zend/zend_ini_parser.y +++ b/Zend/zend_ini_parser.y @@ -81,10 +81,10 @@ static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2) break; } - Z_STRSIZE_P(result) = zend_sprintf(str_result, "%d", i_result); - Z_STRVAL_P(result) = (char *) malloc(Z_STRSIZE_P(result)+1); - memcpy(Z_STRVAL_P(result), str_result, Z_STRSIZE_P(result)); - Z_STRVAL_P(result)[Z_STRSIZE_P(result)] = 0; + Z_STRLEN_P(result) = zend_sprintf(str_result, "%d", i_result); + Z_STRVAL_P(result) = (char *) malloc(Z_STRLEN_P(result)+1); + memcpy(Z_STRVAL_P(result), str_result, Z_STRLEN_P(result)); + Z_STRVAL_P(result)[Z_STRLEN_P(result)] = 0; Z_TYPE_P(result) = IS_STRING; } /* }}} */ @@ -95,7 +95,7 @@ static void zend_ini_init_string(zval *result) { Z_STRVAL_P(result) = malloc(1); Z_STRVAL_P(result)[0] = 0; - Z_STRSIZE_P(result) = 0; + Z_STRLEN_P(result) = 0; Z_TYPE_P(result) = IS_STRING; } /* }}} */ @@ -104,12 +104,12 @@ static void zend_ini_init_string(zval *result) */ static void zend_ini_add_string(zval *result, zval *op1, zval *op2) { - zend_str_size length = Z_STRSIZE_P(op1) + Z_STRSIZE_P(op2); + int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); Z_STRVAL_P(result) = (char *) realloc(Z_STRVAL_P(op1), length+1); - memcpy(Z_STRVAL_P(result)+Z_STRSIZE_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op2)); + memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); Z_STRVAL_P(result)[length] = 0; - Z_STRSIZE_P(result) = length; + Z_STRLEN_P(result) = length; Z_TYPE_P(result) = IS_STRING; } /* }}} */ @@ -121,12 +121,12 @@ static void zend_ini_get_constant(zval *result, zval *name TSRMLS_DC) zval z_constant; /* If name contains ':' it is not a constant. Bug #26893. */ - if (!memchr(Z_STRVAL_P(name), ':', Z_STRSIZE_P(name)) - && zend_get_constant(Z_STRVAL_P(name), Z_STRSIZE_P(name), &z_constant TSRMLS_CC)) { + if (!memchr(Z_STRVAL_P(name), ':', Z_STRLEN_P(name)) + && zend_get_constant(Z_STRVAL_P(name), Z_STRLEN_P(name), &z_constant TSRMLS_CC)) { /* z_constant is emalloc()'d */ convert_to_string(&z_constant); - Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(z_constant), Z_STRSIZE(z_constant)); - Z_STRSIZE_P(result) = Z_STRSIZE(z_constant); + Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(z_constant), Z_STRLEN(z_constant)); + Z_STRLEN_P(result) = Z_STRLEN(z_constant); Z_TYPE_P(result) = Z_TYPE(z_constant); zval_dtor(&z_constant); free(Z_STRVAL_P(name)); @@ -144,14 +144,14 @@ static void zend_ini_get_var(zval *result, zval *name TSRMLS_DC) char *envvar; /* Fetch configuration option value */ - if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRSIZE_P(name)+1, &curval) == SUCCESS) { - Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(curval), Z_STRSIZE(curval)); - Z_STRSIZE_P(result) = Z_STRSIZE(curval); + if (zend_get_configuration_directive(Z_STRVAL_P(name), Z_STRLEN_P(name)+1, &curval) == SUCCESS) { + Z_STRVAL_P(result) = zend_strndup(Z_STRVAL(curval), Z_STRLEN(curval)); + Z_STRLEN_P(result) = Z_STRLEN(curval); /* ..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) { Z_STRVAL_P(result) = strdup(envvar); - Z_STRSIZE_P(result) = strlen(envvar); + Z_STRLEN_P(result) = strlen(envvar); } else { zend_ini_init_string(result); } @@ -163,7 +163,7 @@ static void zend_ini_get_var(zval *result, zval *name TSRMLS_DC) static void ini_error(char *msg) { char *error_buf; - zend_str_size error_buf_len; + int error_buf_len; char *currently_parsed_filename; TSRMLS_FETCH(); diff --git a/Zend/zend_ini_scanner.c b/Zend/zend_ini_scanner.c index 792110254821c..87ba664312712 100644 --- a/Zend/zend_ini_scanner.c +++ b/Zend/zend_ini_scanner.c @@ -57,7 +57,7 @@ #define yytext ((char*)SCNG(yy_text)) #define yyleng SCNG(yy_leng) #define yyless(x) do { YYCURSOR = (unsigned char*)yytext + x; \ - yyleng = (zend_str_size)x; } while(0) + yyleng = (unsigned int)x; } while(0) /* #define yymore() goto yymore_restart */ @@ -135,7 +135,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals; #define zend_ini_copy_value(retval, str, len) { \ Z_STRVAL_P(retval) = zend_strndup(str, len); \ - Z_STRSIZE_P(retval) = len; \ + Z_STRLEN_P(retval) = len; \ Z_TYPE_P(retval) = IS_STRING; \ } @@ -263,7 +263,7 @@ int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC) /* {{{ zend_ini_escape_string() */ -static void zend_ini_escape_string(zval *lval, char *str, zend_str_size_int len, char quote_type TSRMLS_DC) +static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type TSRMLS_DC) { register char *s, *t; char *end; @@ -272,7 +272,7 @@ static void zend_ini_escape_string(zval *lval, char *str, zend_str_size_int len, /* convert escape sequences */ s = t = Z_STRVAL_P(lval); - end = s + Z_STRSIZE_P(lval); + end = s + Z_STRLEN_P(lval); while (s < end) { if (*s == '\\') { @@ -291,7 +291,7 @@ static void zend_ini_escape_string(zval *lval, char *str, zend_str_size_int len, case '\\': case '$': *t++ = *s; - Z_STRSIZE_P(lval)--; + Z_STRLEN_P(lval)--; break; default: *t++ = '\\'; diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index cb59b5b4d259d..92fb08f02d837 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -55,7 +55,7 @@ #define yytext ((char*)SCNG(yy_text)) #define yyleng SCNG(yy_leng) #define yyless(x) do { YYCURSOR = (unsigned char*)yytext + x; \ - yyleng = (zend_str_size)x; } while(0) + yyleng = (unsigned int)x; } while(0) /* #define yymore() goto yymore_restart */ @@ -133,7 +133,7 @@ ZEND_API zend_ini_scanner_globals ini_scanner_globals; #define zend_ini_copy_value(retval, str, len) { \ Z_STRVAL_P(retval) = zend_strndup(str, len); \ - Z_STRSIZE_P(retval) = len; \ + Z_STRLEN_P(retval) = len; \ Z_TYPE_P(retval) = IS_STRING; \ } @@ -261,7 +261,7 @@ int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC) /* {{{ zend_ini_escape_string() */ -static void zend_ini_escape_string(zval *lval, char *str, zend_str_size_int len, char quote_type TSRMLS_DC) +static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type TSRMLS_DC) { register char *s, *t; char *end; @@ -270,7 +270,7 @@ static void zend_ini_escape_string(zval *lval, char *str, zend_str_size_int len, /* convert escape sequences */ s = t = Z_STRVAL_P(lval); - end = s + Z_STRSIZE_P(lval); + end = s + Z_STRLEN_P(lval); while (s < end) { if (*s == '\\') { @@ -289,7 +289,7 @@ static void zend_ini_escape_string(zval *lval, char *str, zend_str_size_int len, case '\\': case '$': *t++ = *s; - Z_STRSIZE_P(lval)--; + Z_STRLEN_P(lval)--; break; default: *t++ = '\\'; diff --git a/Zend/zend_ini_scanner_defs.h b/Zend/zend_ini_scanner_defs.h index 287d7bc1fbb9f..57239549783be 100644 --- a/Zend/zend_ini_scanner_defs.h +++ b/Zend/zend_ini_scanner_defs.h @@ -1,13 +1,13 @@ -/* Generated by re2c 0.13.5 */ -#line 3 "Zend/zend_ini_scanner_defs.h" - -enum YYCONDTYPE { - yycINITIAL, - yycST_OFFSET, - yycST_SECTION_VALUE, - yycST_VALUE, - yycST_SECTION_RAW, - yycST_DOUBLE_QUOTES, - yycST_VARNAME, - yycST_RAW, -}; +/* Generated by re2c 0.13.5 */ +#line 3 "Zend/zend_ini_scanner_defs.h" + +enum YYCONDTYPE { + yycINITIAL, + yycST_OFFSET, + yycST_SECTION_VALUE, + yycST_VALUE, + yycST_SECTION_RAW, + yycST_DOUBLE_QUOTES, + yycST_VARNAME, + yycST_RAW, +}; diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 129c6851eac48..16751549b46c2 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -31,7 +31,7 @@ ZEND_API zend_class_entry *zend_ce_serializable; /* {{{ zend_call_method Only returns the returned zval if retval_ptr != NULL */ -ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, zend_str_size_int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC) +ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC) { int result; zend_fcall_info fci; @@ -397,7 +397,7 @@ static int zend_implement_arrayaccess(zend_class_entry *interface, zend_class_en /* }}}*/ /* {{{ zend_user_serialize */ -ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_str_size_uint *buf_len, zend_serialize_data *data TSRMLS_DC) +ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) { zend_class_entry * ce = Z_OBJCE_P(object); zval *retval; @@ -415,8 +415,8 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_str_ zval_ptr_dtor(&retval); return FAILURE; case IS_STRING: - *buffer = (unsigned char*)estrndup(Z_STRVAL_P(retval), Z_STRSIZE_P(retval)); - *buf_len = Z_STRSIZE_P(retval); + *buffer = (unsigned char*)estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); + *buf_len = Z_STRLEN_P(retval); result = SUCCESS; break; default: /* failure */ @@ -434,7 +434,7 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_str_ /* }}} */ /* {{{ zend_user_unserialize */ -ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_str_size_uint buf_len, zend_unserialize_data *data TSRMLS_DC) +ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) { zval * zdata; @@ -455,7 +455,7 @@ ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const un } /* }}} */ -ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_str_size_uint *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */ +ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(object); zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Serialization of '%s' is not allowed", ce->name); @@ -463,7 +463,7 @@ ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zen } /* }}} */ -ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_str_size_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */ +ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */ { zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Unserialization of '%s' is not allowed", ce->name); return FAILURE; diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h index ec6dd515abda5..ba4bc6ccb6d98 100644 --- a/Zend/zend_interfaces.h +++ b/Zend/zend_interfaces.h @@ -38,7 +38,7 @@ typedef struct _zend_user_iterator { zval *value; } zend_user_iterator; -ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, zend_str_size_int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC); +ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC); #define zend_call_method_with_0_params(obj, obj_ce, fn_proxy, function_name, retval) \ zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 0, NULL, NULL TSRMLS_CC) @@ -61,11 +61,11 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c ZEND_API void zend_register_interfaces(TSRMLS_D); -ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_str_size_uint *buf_len, zend_serialize_data *data TSRMLS_DC); -ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_str_size_uint buf_len, zend_unserialize_data *data TSRMLS_DC); +ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC); +ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC); -ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_str_size_uint *buf_len, zend_serialize_data *data TSRMLS_DC); -ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_str_size_uint buf_len, zend_unserialize_data *data TSRMLS_DC); +ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC); +ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC); END_EXTERN_C() diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 534d178d89612..6a9a24a87ea72 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -872,13 +872,13 @@ class_name: T_STATIC { $$.op_type = IS_CONST; ZVAL_STRINGL(&$$.u.constant, "static", sizeof("static")-1, 1);} | namespace_name { $$ = $1; } | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRSIZE($2.u.constant); $$ = $2; } + | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); $$ = $2; } ; fully_qualified_class_name: namespace_name { $$ = $1; } | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRSIZE($2.u.constant); $$ = $2; } + | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); $$ = $2; } ; @@ -947,7 +947,7 @@ static_scalar: /* compile-time evaluated scalars */ | static_class_name_scalar { $$ = $1; } | namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT, 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_CT, 0 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRSIZE($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0 TSRMLS_CC); } + | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_CT, 0 TSRMLS_CC); } | '+' static_scalar { ZVAL_LONG(&$1.u.constant, 0); add_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } | '-' static_scalar { ZVAL_LONG(&$1.u.constant, 0); sub_function(&$2.u.constant, &$1.u.constant, &$2.u.constant TSRMLS_CC); $$ = $2; } | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; Z_TYPE($$.u.constant) = IS_CONSTANT_ARRAY; } @@ -966,7 +966,7 @@ scalar: | class_constant { $$ = $1; } | namespace_name { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 TSRMLS_CC); } | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING(&$$.u.constant); zend_do_build_namespace_name(&$$, &$$, &$3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant(&$$, NULL, &$3, ZEND_RT, 0 TSRMLS_CC); } - | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRSIZE($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); } + | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); } | common_scalar { $$ = $1; } | '"' encaps_list '"' { $$ = $2; } | T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; } @@ -1231,7 +1231,7 @@ static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr) if (CG(parse_error) == 0) { char buffer[120]; const unsigned char *end, *str, *tok1 = NULL, *tok2 = NULL; - zend_str_size len = 0, toklen = 0, yystr_len; + unsigned int len = 0, toklen = 0, yystr_len; CG(parse_error) = 1; diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h index 2e5914f1b20a0..03ca911262c95 100644 --- a/Zend/zend_language_scanner.h +++ b/Zend/zend_language_scanner.h @@ -45,7 +45,7 @@ typedef struct _zend_lex_state { unsigned char *script_filtered; size_t script_filtered_size; - /* input/output filters */ + /* input/ouput filters */ zend_encoding_filter input_filter; zend_encoding_filter output_filter; const zend_encoding *script_encoding; diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 8040730ac79ce..921e0d798a069 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -280,7 +280,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui if (UNEXPECTED(Z_STRVAL_P(member)[0] == '\0')) { if (!silent) { - if (Z_STRSIZE_P(member) == 0) { + if (Z_STRLEN_P(member) == 0) { zend_error_noreturn(E_ERROR, "Cannot access empty property"); } else { zend_error_noreturn(E_ERROR, "Cannot access property started with '\\0'"); @@ -289,8 +289,8 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui return NULL; } property_info = NULL; - h = key ? key->hash_value : zend_get_hash_value(Z_STRVAL_P(member), Z_STRSIZE_P(member) + 1); - if (zend_hash_quick_find(&ce->properties_info, Z_STRVAL_P(member), Z_STRSIZE_P(member)+1, h, (void **) &property_info)==SUCCESS) { + h = key ? key->hash_value : zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member) + 1); + if (zend_hash_quick_find(&ce->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &property_info)==SUCCESS) { if (UNEXPECTED((property_info->flags & ZEND_ACC_SHADOW) != 0)) { /* if it's a shadow - go to access it's private */ property_info = NULL; @@ -320,7 +320,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui if (EG(scope) != ce && EG(scope) && is_derived_class(ce, EG(scope)) - && zend_hash_quick_find(&EG(scope)->properties_info, Z_STRVAL_P(member), Z_STRSIZE_P(member)+1, h, (void **) &scope_property_info)==SUCCESS + && zend_hash_quick_find(&EG(scope)->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &scope_property_info)==SUCCESS && scope_property_info->flags & ZEND_ACC_PRIVATE) { if (key) { CACHE_POLYMORPHIC_PTR(key->cache_slot, ce, scope_property_info); @@ -342,7 +342,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui } else { EG(std_property_info).flags = ZEND_ACC_PUBLIC; EG(std_property_info).name = Z_STRVAL_P(member); - EG(std_property_info).name_length = Z_STRSIZE_P(member); + EG(std_property_info).name_length = Z_STRLEN_P(member); EG(std_property_info).h = h; EG(std_property_info).ce = ce; EG(std_property_info).offset = -1; @@ -358,12 +358,12 @@ ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce } /* }}} */ -ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info_name, zend_str_size_int prop_info_name_len TSRMLS_DC) /* {{{ */ +ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info_name, int prop_info_name_len TSRMLS_DC) /* {{{ */ { zend_property_info *property_info; const char *class_name, *prop_name; zval member; - zend_str_size prop_name_len; + int prop_name_len; zend_unmangle_property_name_ex(prop_info_name, prop_info_name_len, &class_name, &prop_name, &prop_name_len); ZVAL_STRINGL(&member, prop_name, prop_name_len, 0); @@ -392,8 +392,8 @@ static int zend_get_property_guard(zend_object *zobj, zend_property_info *proper if (!property_info) { property_info = &info; info.name = Z_STRVAL_P(member); - info.name_length = Z_STRSIZE_P(member); - info.h = zend_get_hash_value(Z_STRVAL_P(member), Z_STRSIZE_P(member) + 1); + info.name_length = Z_STRLEN_P(member); + info.h = zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member) + 1); } else if(property_info->name[0] == '\0'){ const char *class_name = NULL, *prop_name = NULL; zend_unmangle_property_name(property_info->name, property_info->name_length, &class_name, &prop_name); @@ -498,7 +498,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, const zend_li } else { if (zobj->ce->__get && guard && guard->in_get == 1) { if (Z_STRVAL_P(member)[0] == '\0') { - if (Z_STRSIZE_P(member) == 0) { + if (Z_STRLEN_P(member) == 0) { zend_error(E_ERROR, "Cannot access empty property"); } else { zend_error(E_ERROR, "Cannot access property started with '\\0'"); @@ -616,7 +616,7 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, c } } else if (zobj->ce->__set && guard && guard->in_set == 1) { if (Z_STRVAL_P(member)[0] == '\0') { - if (Z_STRSIZE_P(member) == 0) { + if (Z_STRLEN_P(member) == 0) { zend_error(E_ERROR, "Cannot access empty property"); } else { zend_error(E_ERROR, "Cannot access property started with '\\0'"); @@ -834,7 +834,7 @@ static void zend_std_unset_property(zval *object, zval *member, const zend_liter zval_ptr_dtor(&object); } else if (zobj->ce->__unset && guard && guard->in_unset == 1) { if (Z_STRVAL_P(member)[0] == '\0') { - if (Z_STRSIZE_P(member) == 0) { + if (Z_STRLEN_P(member) == 0) { zend_error(E_ERROR, "Cannot access empty property"); } else { zend_error(E_ERROR, "Cannot access property started with '\\0'"); @@ -916,7 +916,7 @@ ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ * Returns the function address that should be called, or NULL * if no such function exists. */ -static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, zend_str_size_int function_name_strlen, ulong hash_value TSRMLS_DC) /* {{{ */ +static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen, ulong hash_value TSRMLS_DC) /* {{{ */ { if (!ce) { return 0; @@ -951,7 +951,7 @@ static inline zend_function *zend_check_private_int(zend_function *fbc, zend_cla } /* }}} */ -ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, zend_str_size_int function_name_strlen TSRMLS_DC) /* {{{ */ +ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) /* {{{ */ { return zend_check_private_int(fbc, ce, function_name_strval, function_name_strlen, zend_hash_func(function_name_strval, function_name_strlen+1) TSRMLS_CC) != NULL; } @@ -986,7 +986,7 @@ ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope) } /* }}} */ -static inline union _zend_function *zend_get_user_call_function(zend_class_entry *ce, const char *method_name, zend_str_size_int method_len) /* {{{ */ +static inline union _zend_function *zend_get_user_call_function(zend_class_entry *ce, const char *method_name, int method_len) /* {{{ */ { zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function)); call_user_call->type = ZEND_INTERNAL_FUNCTION; @@ -1002,7 +1002,7 @@ static inline union _zend_function *zend_get_user_call_function(zend_class_entry } /* }}} */ -static union _zend_function *zend_std_get_method(zval **object_ptr, char *method_name, zend_str_size_int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */ +static union _zend_function *zend_std_get_method(zval **object_ptr, char *method_name, int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */ { zend_function *fbc; zval *object = *object_ptr; @@ -1147,7 +1147,7 @@ static inline union _zend_function *zend_get_user_callstatic_function(zend_class /* This is not (yet?) in the API, but it belongs in the built-in objects callbacks */ -ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, zend_str_size_int function_name_strlen, const zend_literal *key TSRMLS_DC) /* {{{ */ +ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, int function_name_strlen, const zend_literal *key TSRMLS_DC) /* {{{ */ { zend_function *fbc = NULL; char *lc_class_name, *lc_function_name = NULL; @@ -1236,7 +1236,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const c } /* }}} */ -ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, zend_str_size_int property_name_len, zend_bool silent, const zend_literal *key TSRMLS_DC) /* {{{ */ +ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, zend_bool silent, const zend_literal *key TSRMLS_DC) /* {{{ */ { zend_property_info *property_info; ulong hash_value; @@ -1293,7 +1293,7 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *p } /* }}} */ -ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, const char *property_name, zend_str_size_int property_name_len, const zend_literal *key TSRMLS_DC) /* {{{ */ +ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, const zend_literal *key TSRMLS_DC) /* {{{ */ { zend_error_noreturn(E_ERROR, "Attempt to unset static property %s::$%s", ce->name, property_name); return 0; @@ -1504,7 +1504,7 @@ zend_class_entry *zend_std_object_get_class(const zval *object TSRMLS_DC) /* {{{ } /* }}} */ -int zend_std_object_get_class_name(const zval *object, const char **class_name, zend_str_size_uint *class_name_len, int parent TSRMLS_DC) /* {{{ */ +int zend_std_object_get_class_name(const zval *object, const char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC) /* {{{ */ { zend_object *zobj; zend_class_entry *ce; diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index be30af2c759c1..07428737ff193 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -88,7 +88,7 @@ typedef HashTable *(*zend_object_get_debug_info_t)(zval *object, int *is_temp TS /* Andi - EX(fbc) (function being called) needs to be initialized already in the INIT fcall opcode so that the parameters can be parsed the right way. We need to add another callback for this. */ typedef int (*zend_object_call_method_t)(const char *method, INTERNAL_FUNCTION_PARAMETERS); -typedef union _zend_function *(*zend_object_get_method_t)(zval **object_ptr, char *method, zend_str_size_int method_len, const struct _zend_literal *key TSRMLS_DC); +typedef union _zend_function *(*zend_object_get_method_t)(zval **object_ptr, char *method, int method_len, const struct _zend_literal *key TSRMLS_DC); typedef union _zend_function *(*zend_object_get_constructor_t)(zval *object TSRMLS_DC); /* Object maintenance/destruction */ @@ -98,7 +98,7 @@ typedef void (*zend_object_delete_obj_t)(zval *object TSRMLS_DC); typedef zend_object_value (*zend_object_clone_obj_t)(zval *object TSRMLS_DC); typedef zend_class_entry *(*zend_object_get_class_entry_t)(const zval *object TSRMLS_DC); -typedef int (*zend_object_get_class_name_t)(const zval *object, const char **class_name, zend_str_size_uint *class_name_len, int parent TSRMLS_DC); +typedef int (*zend_object_get_class_name_t)(const zval *object, const char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC); typedef int (*zend_object_compare_t)(zval *object1, zval *object2 TSRMLS_DC); typedef int (*zend_object_compare_zvals_t)(zval *resul, zval *op1, zval *op2 TSRMLS_DC); @@ -155,9 +155,9 @@ extern ZEND_API zend_object_handlers std_object_handlers; ((fbc)->common.prototype ? (fbc)->common.prototype->common.scope : (fbc)->common.scope) BEGIN_EXTERN_C() -ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, zend_str_size_int function_name_strlen, const struct _zend_literal *key TSRMLS_DC); -ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, zend_str_size_int property_name_len, zend_bool silent, const struct _zend_literal *key TSRMLS_DC); -ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, const char *property_name, zend_str_size_int property_name_len, const struct _zend_literal *key TSRMLS_DC); +ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, int function_name_strlen, const struct _zend_literal *key TSRMLS_DC); +ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, zend_bool silent, const struct _zend_literal *key TSRMLS_DC); +ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, const struct _zend_literal *key TSRMLS_DC); ZEND_API union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC); ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC); ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC); @@ -170,11 +170,11 @@ ZEND_API void rebuild_object_properties(zend_object *zobj); #define IS_ZEND_STD_OBJECT(z) (Z_TYPE(z) == IS_OBJECT && (Z_OBJ_HT((z))->get_class_entry != NULL)) #define HAS_CLASS_ENTRY(z) (Z_OBJ_HT(z)->get_class_entry != NULL) -ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, char *function_name_strval, zend_str_size_int function_name_strlen TSRMLS_DC); +ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC); ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope); -ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info_name, zend_str_size_int prop_info_name_len TSRMLS_DC); +ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info_name, int prop_info_name_len TSRMLS_DC); ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS); END_EXTERN_C() diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index ec5f8bc65239d..60730121882c5 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -79,7 +79,7 @@ static const unsigned char tolower_map[256] = { zend_binary_strncasecmp */ -ZEND_API int zend_atoi(const char *str, zend_str_size_int str_len) /* {{{ */ +ZEND_API int zend_atoi(const char *str, int str_len) /* {{{ */ { int retval; @@ -107,7 +107,7 @@ ZEND_API int zend_atoi(const char *str, zend_str_size_int str_len) /* {{{ */ } /* }}} */ -ZEND_API long zend_atol(const char *str, zend_str_size_int str_len) /* {{{ */ +ZEND_API long zend_atol(const char *str, int str_len) /* {{{ */ { long retval; @@ -135,7 +135,7 @@ ZEND_API long zend_atol(const char *str, zend_str_size_int str_len) /* {{{ */ } /* }}} */ -ZEND_API double zend_string_to_double(const char *number, zend_str_size_uint length) /* {{{ */ +ZEND_API double zend_string_to_double(const char *number, zend_uint length) /* {{{ */ { double divisor = 10.0; double result = 0.0; @@ -189,7 +189,7 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) /* {{{ */ char *strval; strval = Z_STRVAL_P(op); - if ((Z_TYPE_P(op)=is_numeric_string(strval, Z_STRSIZE_P(op), &Z_LVAL_P(op), &Z_DVAL_P(op), 1)) == 0) { + if ((Z_TYPE_P(op)=is_numeric_string(strval, Z_STRLEN_P(op), &Z_LVAL_P(op), &Z_DVAL_P(op), 1)) == 0) { ZVAL_LONG(op, 0); } STR_FREE(strval); @@ -222,7 +222,7 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) /* {{{ */ switch (Z_TYPE_P(op)) { \ case IS_STRING: \ { \ - if ((Z_TYPE(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRSIZE_P(op), &Z_LVAL(holder), &Z_DVAL(holder), 1)) == 0) { \ + if ((Z_TYPE(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL(holder), &Z_DVAL(holder), 1)) == 0) { \ ZVAL_LONG(&(holder), 0); \ } \ (op) = &(holder); \ @@ -305,8 +305,8 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) /* {{{ */ Z_LVAL(holder) = (Z_DVAL_P(op) ? 1 : 0); \ break; \ case IS_STRING: \ - if (Z_STRSIZE_P(op) == 0 \ - || (Z_STRSIZE_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { \ + if (Z_STRLEN_P(op) == 0 \ + || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { \ Z_LVAL(holder) = 0; \ } else { \ Z_LVAL(holder) = 1; \ @@ -534,8 +534,8 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */ { char *strval = Z_STRVAL_P(op); - if (Z_STRSIZE_P(op) == 0 - || (Z_STRSIZE_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { + if (Z_STRLEN_P(op) == 0 + || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) { Z_LVAL_P(op) = 0; } else { Z_LVAL_P(op) = 1; @@ -579,7 +579,7 @@ ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC) /* {{{ */ case IS_DOUBLE: { TSRMLS_FETCH(); dval = Z_DVAL_P(op); - Z_STRSIZE_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*H", (int) EG(precision), dval); + Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*H", (int) EG(precision), dval); /* %H already handles removing trailing zeros from the fractional part, yay */ break; } @@ -598,17 +598,17 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ switch (Z_TYPE_P(op)) { case IS_NULL: Z_STRVAL_P(op) = STR_EMPTY_ALLOC(); - Z_STRSIZE_P(op) = 0; + Z_STRLEN_P(op) = 0; break; case IS_STRING: break; case IS_BOOL: if (Z_LVAL_P(op)) { Z_STRVAL_P(op) = estrndup_rel("1", 1); - Z_STRSIZE_P(op) = 1; + Z_STRLEN_P(op) = 1; } else { Z_STRVAL_P(op) = STR_EMPTY_ALLOC(); - Z_STRSIZE_P(op) = 0; + Z_STRLEN_P(op) = 0; } break; case IS_RESOURCE: { @@ -616,18 +616,18 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ TSRMLS_FETCH(); zend_list_delete(Z_LVAL_P(op)); - Z_STRSIZE_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "Resource id #%ld", tmp); + Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "Resource id #%ld", tmp); break; } case IS_LONG: lval = Z_LVAL_P(op); - Z_STRSIZE_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%ld", lval); + Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%ld", lval); break; case IS_DOUBLE: { TSRMLS_FETCH(); dval = Z_DVAL_P(op); - Z_STRSIZE_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*G", (int) EG(precision), dval); + Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*G", (int) EG(precision), dval); /* %G already handles removing trailing zeros from the fractional part, yay */ break; } @@ -635,7 +635,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ zend_error(E_NOTICE, "Array to string conversion"); zval_dtor(op); Z_STRVAL_P(op) = estrndup_rel("Array", sizeof("Array")-1); - Z_STRSIZE_P(op) = sizeof("Array")-1; + Z_STRLEN_P(op) = sizeof("Array")-1; break; case IS_OBJECT: { TSRMLS_FETCH(); @@ -649,7 +649,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ zend_error(E_NOTICE, "Object of class %s to string conversion", Z_OBJCE_P(op)->name); zval_dtor(op); Z_STRVAL_P(op) = estrndup_rel("Object", sizeof("Object")-1); - Z_STRSIZE_P(op) = sizeof("Object")-1; + Z_STRLEN_P(op) = sizeof("Object")-1; break; } default: @@ -1108,13 +1108,13 @@ ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */ ZVAL_LONG(result, ~zend_dval_to_lval(Z_DVAL_P(op1))); return SUCCESS; case IS_STRING: { - zend_str_size i; + int i; zval op1_copy = *op1; Z_TYPE_P(result) = IS_STRING; - Z_STRVAL_P(result) = estrndup(Z_STRVAL(op1_copy), Z_STRSIZE(op1_copy)); - Z_STRSIZE_P(result) = Z_STRSIZE(op1_copy); - for (i = 0; i < Z_STRSIZE(op1_copy); i++) { + Z_STRVAL_P(result) = estrndup(Z_STRVAL(op1_copy), Z_STRLEN(op1_copy)); + Z_STRLEN_P(result) = Z_STRLEN(op1_copy); + for (i = 0; i < Z_STRLEN(op1_copy); i++) { Z_STRVAL_P(result)[i] = ~Z_STRVAL(op1_copy)[i]; } return SUCCESS; @@ -1136,9 +1136,9 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) / if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { zval *longer, *shorter; char *result_str; - zend_str_size i, result_len; + int i, result_len; - if (Z_STRSIZE_P(op1) >= Z_STRSIZE_P(op2)) { + if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { longer = op1; shorter = op2; } else { @@ -1147,16 +1147,16 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) / } Z_TYPE_P(result) = IS_STRING; - result_len = Z_STRSIZE_P(longer); - result_str = estrndup(Z_STRVAL_P(longer), Z_STRSIZE_P(longer)); - for (i = 0; i < Z_STRSIZE_P(shorter); i++) { + result_len = Z_STRLEN_P(longer); + result_str = estrndup(Z_STRVAL_P(longer), Z_STRLEN_P(longer)); + for (i = 0; i < Z_STRLEN_P(shorter); i++) { result_str[i] |= Z_STRVAL_P(shorter)[i]; } if (result==op1) { STR_FREE(Z_STRVAL_P(result)); } Z_STRVAL_P(result) = result_str; - Z_STRSIZE_P(result) = result_len; + Z_STRLEN_P(result) = result_len; return SUCCESS; } @@ -1183,9 +1183,9 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { zval *longer, *shorter; char *result_str; - zend_str_size i, result_len; + int i, result_len; - if (Z_STRSIZE_P(op1) >= Z_STRSIZE_P(op2)) { + if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { longer = op1; shorter = op2; } else { @@ -1194,16 +1194,16 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) } Z_TYPE_P(result) = IS_STRING; - result_len = Z_STRSIZE_P(shorter); - result_str = estrndup(Z_STRVAL_P(shorter), Z_STRSIZE_P(shorter)); - for (i = 0; i < Z_STRSIZE_P(shorter); i++) { + result_len = Z_STRLEN_P(shorter); + result_str = estrndup(Z_STRVAL_P(shorter), Z_STRLEN_P(shorter)); + for (i = 0; i < Z_STRLEN_P(shorter); i++) { result_str[i] &= Z_STRVAL_P(longer)[i]; } if (result==op1) { STR_FREE(Z_STRVAL_P(result)); } Z_STRVAL_P(result) = result_str; - Z_STRSIZE_P(result) = result_len; + Z_STRLEN_P(result) = result_len; return SUCCESS; } @@ -1230,9 +1230,9 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { zval *longer, *shorter; char *result_str; - zend_str_size i, result_len; + int i, result_len; - if (Z_STRSIZE_P(op1) >= Z_STRSIZE_P(op2)) { + if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { longer = op1; shorter = op2; } else { @@ -1241,16 +1241,16 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) } Z_TYPE_P(result) = IS_STRING; - result_len = Z_STRSIZE_P(shorter); - result_str = estrndup(Z_STRVAL_P(shorter), Z_STRSIZE_P(shorter)); - for (i = 0; i < Z_STRSIZE_P(shorter); i++) { + result_len = Z_STRLEN_P(shorter); + result_str = estrndup(Z_STRVAL_P(shorter), Z_STRLEN_P(shorter)); + for (i = 0; i < Z_STRLEN_P(shorter); i++) { result_str[i] ^= Z_STRVAL_P(longer)[i]; } if (result==op1) { STR_FREE(Z_STRVAL_P(result)); } Z_STRVAL_P(result) = result_str; - Z_STRSIZE_P(result) = result_len; + Z_STRLEN_P(result) = result_len; return SUCCESS; } @@ -1312,12 +1312,12 @@ ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* must support result==op1 */ ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */ { - zend_str_size length = Z_STRSIZE_P(op1) + 1; + int length = Z_STRLEN_P(op1) + 1; char *buf; if (IS_INTERNED(Z_STRVAL_P(op1))) { buf = (char *) emalloc(length + 1); - memcpy(buf, Z_STRVAL_P(op1), Z_STRSIZE_P(op1)); + memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); } else { buf = (char *) erealloc(Z_STRVAL_P(op1), length + 1); } @@ -1331,16 +1331,16 @@ ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) /* must support result==op1 */ ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */ { - zend_str_size length = Z_STRSIZE_P(op1) + Z_STRSIZE_P(op2); + int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); char *buf; if (IS_INTERNED(Z_STRVAL_P(op1))) { buf = (char *) emalloc(length+1); - memcpy(buf, Z_STRVAL_P(op1), Z_STRSIZE_P(op1)); + memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); } else { buf = (char *) erealloc(Z_STRVAL_P(op1), length+1); } - memcpy(buf + Z_STRSIZE_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op2)); + memcpy(buf + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); buf[length] = 0; ZVAL_STRINGL(result, buf, length, 0); return SUCCESS; @@ -1376,9 +1376,9 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{ op2 = &op2_copy; } if (result==op1 && !IS_INTERNED(Z_STRVAL_P(op1))) { /* special case, perform operations on result */ - zend_str_size res_len = Z_STRSIZE_P(op1) + Z_STRSIZE_P(op2); + uint res_len = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); - if (res_len < Z_STRSIZE_P(op1) || res_len < Z_STRSIZE_P(op2)) { + if (Z_STRLEN_P(result) < 0 || (int) (Z_STRLEN_P(op1) + Z_STRLEN_P(op2)) < 0) { efree(Z_STRVAL_P(result)); ZVAL_EMPTY_STRING(result); zend_error(E_ERROR, "String size overflow"); @@ -1386,15 +1386,15 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{ Z_STRVAL_P(result) = erealloc(Z_STRVAL_P(result), res_len+1); - memcpy(Z_STRVAL_P(result)+Z_STRSIZE_P(result), Z_STRVAL_P(op2), Z_STRSIZE_P(op2)); + memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(result), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); Z_STRVAL_P(result)[res_len]=0; - Z_STRSIZE_P(result) = res_len; + Z_STRLEN_P(result) = res_len; } else { - zend_str_size length = Z_STRSIZE_P(op1) + Z_STRSIZE_P(op2); + int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); char *buf = (char *) emalloc(length + 1); - memcpy(buf, Z_STRVAL_P(op1), Z_STRSIZE_P(op1)); - memcpy(buf + Z_STRSIZE_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op2)); + memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); + memcpy(buf + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); buf[length] = 0; ZVAL_STRINGL(result, buf, length, 0); } @@ -1576,11 +1576,11 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* { return SUCCESS; case TYPE_PAIR(IS_NULL, IS_STRING): - ZVAL_LONG(result, zend_binary_strcmp("", 0, Z_STRVAL_P(op2), Z_STRSIZE_P(op2))); + ZVAL_LONG(result, zend_binary_strcmp("", 0, Z_STRVAL_P(op2), Z_STRLEN_P(op2))); return SUCCESS; case TYPE_PAIR(IS_STRING, IS_NULL): - ZVAL_LONG(result, zend_binary_strcmp(Z_STRVAL_P(op1), Z_STRSIZE_P(op1), "", 0)); + ZVAL_LONG(result, zend_binary_strcmp(Z_STRVAL_P(op1), Z_STRLEN_P(op1), "", 0)); return SUCCESS; case TYPE_PAIR(IS_OBJECT, IS_NULL): @@ -1728,8 +1728,8 @@ ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) Z_LVAL_P(result) = (Z_DVAL_P(op1) == Z_DVAL_P(op2)); break; case IS_STRING: - Z_LVAL_P(result) = ((Z_STRSIZE_P(op1) == Z_STRSIZE_P(op2)) - && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRSIZE_P(op1)))); + Z_LVAL_P(result) = ((Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) + && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)))); break; case IS_ARRAY: Z_LVAL_P(result) = (Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) || @@ -1835,22 +1835,22 @@ ZEND_API zend_bool instanceof_function(const zend_class_entry *instance_ce, cons static void increment_string(zval *str) /* {{{ */ { int carry=0; - zend_str_size pos=Z_STRSIZE_P(str)-1; + int pos=Z_STRLEN_P(str)-1; char *s=Z_STRVAL_P(str); char *t; int last=0; /* Shut up the compiler warning */ int ch; - if (Z_STRSIZE_P(str) == 0) { + if (Z_STRLEN_P(str) == 0) { STR_FREE(Z_STRVAL_P(str)); Z_STRVAL_P(str) = estrndup("1", sizeof("1")-1); - Z_STRSIZE_P(str) = 1; + Z_STRLEN_P(str) = 1; return; } if (IS_INTERNED(s)) { - s = (char*) emalloc(Z_STRSIZE_P(str) + 1); - memcpy(s, Z_STRVAL_P(str), Z_STRSIZE_P(str) + 1); + s = (char*) emalloc(Z_STRLEN_P(str) + 1); + memcpy(s, Z_STRVAL_P(str), Z_STRLEN_P(str) + 1); Z_STRVAL_P(str) = s; } @@ -1894,10 +1894,10 @@ static void increment_string(zval *str) /* {{{ */ } if (carry) { - t = (char *) emalloc(Z_STRSIZE_P(str)+1+1); - memcpy(t+1, Z_STRVAL_P(str), Z_STRSIZE_P(str)); - Z_STRSIZE_P(str)++; - t[Z_STRSIZE_P(str)] = '\0'; + t = (char *) emalloc(Z_STRLEN_P(str)+1+1); + memcpy(t+1, Z_STRVAL_P(str), Z_STRLEN_P(str)); + Z_STRLEN_P(str)++; + t[Z_STRLEN_P(str)] = '\0'; switch (last) { case NUMERIC: t[0] = '1'; @@ -1937,7 +1937,7 @@ ZEND_API int increment_function(zval *op1) /* {{{ */ long lval; double dval; - switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRSIZE_P(op1), &lval, &dval, 0)) { + switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { case IS_LONG: str_efree(Z_STRVAL_P(op1)); if (lval == LONG_MAX) { @@ -1998,12 +1998,12 @@ ZEND_API int decrement_function(zval *op1) /* {{{ */ Z_DVAL_P(op1) = Z_DVAL_P(op1) - 1; break; case IS_STRING: /* Like perl we only support string increment */ - if (Z_STRSIZE_P(op1) == 0) { /* consider as 0 */ + if (Z_STRLEN_P(op1) == 0) { /* consider as 0 */ STR_FREE(Z_STRVAL_P(op1)); ZVAL_LONG(op1, -1); break; } - switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRSIZE_P(op1), &lval, &dval, 0)) { + switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { case IS_LONG: STR_FREE(Z_STRVAL_P(op1)); if (lval == LONG_MIN) { @@ -2056,7 +2056,7 @@ ZEND_API void zend_update_current_locale(void) /* {{{ */ /* }}} */ #endif -ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, zend_str_size_uint length) /* {{{ */ +ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned int length) /* {{{ */ { register unsigned char *str = (unsigned char*)source; register unsigned char *result = (unsigned char*)dest; @@ -2071,13 +2071,13 @@ ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, zend_str_si } /* }}} */ -ZEND_API char *zend_str_tolower_dup(const char *source, zend_str_size_uint length) /* {{{ */ +ZEND_API char *zend_str_tolower_dup(const char *source, unsigned int length) /* {{{ */ { return zend_str_tolower_copy((char *)emalloc(length+1), source, length); } /* }}} */ -ZEND_API void zend_str_tolower(char *str, zend_str_size_uint length) /* {{{ */ +ZEND_API void zend_str_tolower(char *str, unsigned int length) /* {{{ */ { register unsigned char *p = (unsigned char*)str; register unsigned char *end = p + length; @@ -2089,9 +2089,9 @@ ZEND_API void zend_str_tolower(char *str, zend_str_size_uint length) /* {{{ */ } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strcmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ +ZEND_API int zend_binary_strcmp(const char *s1, uint len1, const char *s2, uint len2) /* {{{ */ { - zend_str_size retval; + int retval; if (s1 == s2) { return 0; @@ -2105,9 +2105,9 @@ ZEND_API zend_str_size_int zend_binary_strcmp(const char *s1, zend_str_size_uint } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strncmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ +ZEND_API int zend_binary_strncmp(const char *s1, uint len1, const char *s2, uint len2, uint length) /* {{{ */ { - zend_str_size retval; + int retval; if (s1 == s2) { return 0; @@ -2121,10 +2121,10 @@ ZEND_API zend_str_size_int zend_binary_strncmp(const char *s1, zend_str_size_uin } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strcasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ +ZEND_API int zend_binary_strcasecmp(const char *s1, uint len1, const char *s2, uint len2) /* {{{ */ { - zend_str_size len; - zend_str_size c1, c2; + int len; + int c1, c2; if (s1 == s2) { return 0; @@ -2143,10 +2143,10 @@ ZEND_API zend_str_size_int zend_binary_strcasecmp(const char *s1, zend_str_size_ } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strncasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ +ZEND_API int zend_binary_strncasecmp(const char *s1, uint len1, const char *s2, uint len2, uint length) /* {{{ */ { - zend_str_size len; - zend_str_size c1, c2; + int len; + int c1, c2; if (s1 == s2) { return 0; @@ -2164,10 +2164,10 @@ ZEND_API zend_str_size_int zend_binary_strncasecmp(const char *s1, zend_str_size } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strcasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ +ZEND_API int zend_binary_strcasecmp_l(const char *s1, uint len1, const char *s2, uint len2) /* {{{ */ { - zend_str_size len; - zend_str_size c1, c2; + int len; + int c1, c2; if (s1 == s2) { return 0; @@ -2186,10 +2186,10 @@ ZEND_API zend_str_size_int zend_binary_strcasecmp_l(const char *s1, zend_str_siz } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strncasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ +ZEND_API int zend_binary_strncasecmp_l(const char *s1, uint len1, const char *s2, uint len2, uint length) /* {{{ */ { - zend_str_size len; - zend_str_size c1, c2; + int len; + int c1, c2; if (s1 == s2) { return 0; @@ -2207,27 +2207,27 @@ ZEND_API zend_str_size_int zend_binary_strncasecmp_l(const char *s1, zend_str_si } /* }}} */ -ZEND_API zend_str_size_int zend_binary_zval_strcmp(zval *s1, zval *s2) /* {{{ */ +ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2) /* {{{ */ { - return zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2)); + return zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) /* {{{ */ +ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) /* {{{ */ { - return zend_binary_strncmp(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2), Z_LVAL_P(s3)); + return zend_binary_strncmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_zval_strcasecmp(zval *s1, zval *s2) /* {{{ */ +ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2) /* {{{ */ { - return zend_binary_strcasecmp_l(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2)); + return zend_binary_strcasecmp_l(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2)); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) /* {{{ */ +ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) /* {{{ */ { - return zend_binary_strncasecmp_l(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2), Z_LVAL_P(s3)); + return zend_binary_strncasecmp_l(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3)); } /* }}} */ @@ -2238,8 +2238,8 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */ long lval1, lval2; double dval1, dval2; - if ((ret1=is_numeric_string_ex(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), &lval1, &dval1, 0, &oflow1)) && - (ret2=is_numeric_string_ex(Z_STRVAL_P(s2), Z_STRSIZE_P(s2), &lval2, &dval2, 0, &oflow2))) { + if ((ret1=is_numeric_string_ex(Z_STRVAL_P(s1), Z_STRLEN_P(s1), &lval1, &dval1, 0, &oflow1)) && + (ret2=is_numeric_string_ex(Z_STRVAL_P(s2), Z_STRLEN_P(s2), &lval2, &dval2, 0, &oflow2))) { #if ULONG_MAX == 0xFFFFFFFF if (oflow1 != 0 && oflow1 == oflow2 && dval1 - dval2 == 0. && ((oflow1 == 1 && dval1 > 9007199254740991. /*0x1FFFFFFFFFFFFF*/) @@ -2333,7 +2333,7 @@ ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC) /* {{{ */ { TSRMLS_FETCH(); - Z_STRSIZE_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*G", (int) EG(precision), (double)Z_DVAL_P(op)); + Z_STRLEN_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%.*G", (int) EG(precision), (double)Z_DVAL_P(op)); } /* }}} */ diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index e576d68851a00..e7ab9bb3fe9e4 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -128,7 +128,7 @@ static zend_always_inline long zend_dval_to_lval(double d) * could not be represented as such due to overflow. It writes 1 to oflow_info * if the integer is larger than LONG_MAX and -1 if it's smaller than LONG_MIN. */ -static inline zend_uchar is_numeric_string_ex(const char *str, zend_str_size_int length, long *lval, double *dval, int allow_errors, int *oflow_info) +static inline zend_uchar is_numeric_string_ex(const char *str, int length, long *lval, double *dval, int allow_errors, int *oflow_info) { const char *ptr; int base = 10, digits = 0, dp_or_e = 0; @@ -265,25 +265,21 @@ static inline zend_uchar is_numeric_string_ex(const char *str, zend_str_size_int } } -static inline zend_uchar is_numeric_string(const char *str, zend_str_size_int length, long *lval, double *dval, int allow_errors) { +static inline zend_uchar is_numeric_string(const char *str, int length, long *lval, double *dval, int allow_errors) { return is_numeric_string_ex(str, length, lval, dval, allow_errors, NULL); } static inline char * -zend_memnstr(const char *haystack, const char *needle, zend_str_size_int needle_len, char *end) +zend_memnstr(char *haystack, char *needle, int needle_len, char *end) { - const char *p = haystack; - const char ne = needle[needle_len-1]; - ptrdiff_t off_p; - zend_str_size_int off_s; + char *p = haystack; + char ne = needle[needle_len-1]; if (needle_len == 1) { return (char *)memchr(p, *needle, (end-p)); } - off_p = end - haystack; - off_s = (off_p > 0) ? (zend_str_size_int)off_p : 0; - if (needle_len > off_s) { + if (needle_len > end-haystack) { return NULL; } @@ -306,7 +302,7 @@ zend_memnstr(const char *haystack, const char *needle, zend_str_size_int needle_ return NULL; } -static inline const void *zend_memrchr(const void *s, int c, zend_str_size_size_t n) +static inline const void *zend_memrchr(const void *s, int c, size_t n) { register const unsigned char *e; @@ -345,7 +341,7 @@ ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2 #define convert_to_cstring(op) if ((op)->type != IS_STRING) { _convert_to_cstring((op) ZEND_FILE_LINE_CC); } #define convert_to_string(op) if ((op)->type != IS_STRING) { _convert_to_string((op) ZEND_FILE_LINE_CC); } -ZEND_API double zend_string_to_double(const char *number, zend_str_size_uint length); +ZEND_API double zend_string_to_double(const char *number, zend_uint length); ZEND_API int zval_is_true(zval *op); ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); @@ -357,27 +353,27 @@ ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2 TSR ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); #endif -ZEND_API void zend_str_tolower(char *str, zend_str_size_uint length); -ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, zend_str_size_uint length); -ZEND_API char *zend_str_tolower_dup(const char *source, zend_str_size_uint length); +ZEND_API void zend_str_tolower(char *str, unsigned int length); +ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned int length); +ZEND_API char *zend_str_tolower_dup(const char *source, unsigned int length); -ZEND_API zend_str_size_int zend_binary_zval_strcmp(zval *s1, zval *s2); -ZEND_API zend_str_size_int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3); -ZEND_API zend_str_size_int zend_binary_zval_strcasecmp(zval *s1, zval *s2); -ZEND_API zend_str_size_int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3); -ZEND_API zend_str_size_int zend_binary_strcmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2); -ZEND_API zend_str_size_int zend_binary_strncmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); -ZEND_API zend_str_size_int zend_binary_strcasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2); -ZEND_API zend_str_size_int zend_binary_strncasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); -ZEND_API zend_str_size_int zend_binary_strncasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); +ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2); +ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3); +ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2); +ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3); +ZEND_API int zend_binary_strcmp(const char *s1, uint len1, const char *s2, uint len2); +ZEND_API int zend_binary_strncmp(const char *s1, uint len1, const char *s2, uint len2, uint length); +ZEND_API int zend_binary_strcasecmp(const char *s1, uint len1, const char *s2, uint len2); +ZEND_API int zend_binary_strncasecmp(const char *s1, uint len1, const char *s2, uint len2, uint length); +ZEND_API int zend_binary_strncasecmp_l(const char *s1, uint len1, const char *s2, uint len2, uint length); ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2); ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC); ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC); ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC); -ZEND_API int zend_atoi(const char *str, zend_str_size_int str_len); -ZEND_API long zend_atol(const char *str, zend_str_size_int str_len); +ZEND_API int zend_atoi(const char *str, int str_len); +ZEND_API long zend_atol(const char *str, int str_len); ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC); END_EXTERN_C() @@ -445,14 +441,7 @@ END_EXTERN_C() #define Z_BVAL(zval) ((zend_bool)(zval).value.lval) #define Z_DVAL(zval) (zval).value.dval #define Z_STRVAL(zval) (zval).value.str.val - -#ifdef ZEND_USE_LEGACY_STRING_TYPES #define Z_STRLEN(zval) (zval).value.str.len -#define Z_STRLEN_P(zval_p) Z_STRLEN(*zval_p) -#define Z_STRLEN_PP(zval_pp) Z_STRLEN(**zval_pp) -#endif - -#define Z_STRSIZE(zval) (zval).value.str.len #define Z_ARRVAL(zval) (zval).value.ht #define Z_OBJVAL(zval) (zval).value.obj #define Z_OBJ_HANDLE(zval) Z_OBJVAL(zval).handle @@ -467,7 +456,7 @@ END_EXTERN_C() #define Z_BVAL_P(zval_p) Z_BVAL(*zval_p) #define Z_DVAL_P(zval_p) Z_DVAL(*zval_p) #define Z_STRVAL_P(zval_p) Z_STRVAL(*zval_p) -#define Z_STRSIZE_P(zval_p) Z_STRSIZE(*zval_p) +#define Z_STRLEN_P(zval_p) Z_STRLEN(*zval_p) #define Z_ARRVAL_P(zval_p) Z_ARRVAL(*zval_p) #define Z_OBJPROP_P(zval_p) Z_OBJPROP(*zval_p) #define Z_OBJCE_P(zval_p) Z_OBJCE(*zval_p) @@ -482,7 +471,7 @@ END_EXTERN_C() #define Z_BVAL_PP(zval_pp) Z_BVAL(**zval_pp) #define Z_DVAL_PP(zval_pp) Z_DVAL(**zval_pp) #define Z_STRVAL_PP(zval_pp) Z_STRVAL(**zval_pp) -#define Z_STRSIZE_PP(zval_pp) Z_STRSIZE(**zval_pp) +#define Z_STRLEN_PP(zval_pp) Z_STRLEN(**zval_pp) #define Z_ARRVAL_PP(zval_pp) Z_ARRVAL(**zval_pp) #define Z_OBJPROP_PP(zval_pp) Z_OBJPROP(**zval_pp) #define Z_OBJCE_PP(zval_pp) Z_OBJCE(**zval_pp) diff --git a/Zend/zend_string.c b/Zend/zend_string.c index 144de9d715eae..ff7ee3fd81a22 100644 --- a/Zend/zend_string.c +++ b/Zend/zend_string.c @@ -29,11 +29,11 @@ # include #endif -ZEND_API const char *(*zend_new_interned_string)(const char *str, zend_str_size_int len, int free_src TSRMLS_DC); +ZEND_API const char *(*zend_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC); ZEND_API void (*zend_interned_strings_snapshot)(TSRMLS_D); ZEND_API void (*zend_interned_strings_restore)(TSRMLS_D); -static const char *zend_new_interned_string_int(const char *str, zend_str_size_int len, int free_src TSRMLS_DC); +static const char *zend_new_interned_string_int(const char *str, int len, int free_src TSRMLS_DC); static void zend_interned_strings_snapshot_int(TSRMLS_D); static void zend_interned_strings_restore_int(TSRMLS_D); @@ -79,7 +79,7 @@ void zend_interned_strings_dtor(TSRMLS_D) #endif } -static const char *zend_new_interned_string_int(const char *arKey, zend_str_size_int nKeyLength, int free_src TSRMLS_DC) +static const char *zend_new_interned_string_int(const char *arKey, int nKeyLength, int free_src TSRMLS_DC) { #ifndef ZTS ulong h; diff --git a/Zend/zend_string.h b/Zend/zend_string.h index 3ef8f91ad180a..ebf8c816c11ff 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -24,7 +24,7 @@ #include "zend.h" BEGIN_EXTERN_C() -ZEND_API extern const char *(*zend_new_interned_string)(const char *str, zend_str_size_int len, int free_src TSRMLS_DC); +ZEND_API extern const char *(*zend_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC); ZEND_API extern void (*zend_interned_strings_snapshot)(TSRMLS_D); ZEND_API extern void (*zend_interned_strings_restore)(TSRMLS_D); diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 8ae0e683273b8..9cdf31fb343da 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -28,21 +28,6 @@ typedef unsigned int zend_uint; typedef unsigned long zend_ulong; typedef unsigned short zend_ushort; - -#ifdef ZEND_USE_LEGACY_STRING_TYPES -#define zend_str_size_int int -#define zend_str_size_uint unsigned int -#define zend_str_size_size_t size_t -#define zend_str_size_long long -typedef int zend_str_size; -#else -#define zend_str_size_int zend_str_size -#define zend_str_size_uint zend_str_size -#define zend_str_size_size_t zend_str_size -#define zend_str_size_long zend_str_size -typedef size_t zend_str_size; -#endif - #define HAVE_ZEND_LONG64 #ifdef ZEND_WIN32 typedef __int64 zend_long64; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 0708ee56e4a9e..a15e4c66d5a19 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1026,7 +1026,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST| if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (OP1_TYPE != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -1040,7 +1040,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST| } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); FREE_OP1(); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -1055,10 +1055,10 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST| } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -1072,7 +1072,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST| /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -2302,7 +2302,7 @@ ZEND_VM_HANDLER(54, ZEND_ADD_CHAR, TMP|UNUSED, CONST) if (OP1_TYPE == IS_UNUSED) { /* Initialize for erealloc in add_char_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRSIZE_P(str) = 0; + Z_STRLEN_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -2325,7 +2325,7 @@ ZEND_VM_HANDLER(55, ZEND_ADD_STRING, TMP|UNUSED, CONST) if (OP1_TYPE == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRSIZE_P(str) = 0; + Z_STRLEN_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -2353,7 +2353,7 @@ ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP|UNUSED, TMP|VAR|CV) if (OP1_TYPE == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRSIZE_P(str) = 0; + Z_STRLEN_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -2403,13 +2403,13 @@ ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMP|VAR|UNUSED|CV) if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -2428,7 +2428,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV) USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; zend_free_op free_op1, free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -2445,7 +2445,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV) } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R); @@ -2518,12 +2518,10 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op1.literal->cache_slot, ce); } @@ -2548,12 +2546,12 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS /* do nothing */ } else if (OP2_TYPE != IS_UNUSED) { char *function_name_strval = NULL; - zend_str_size_int function_name_strlen = 0; + int function_name_strlen = 0; zend_free_op free_op2; if (OP2_TYPE == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRSIZE_P(opline->op2.zv); + function_name_strlen = Z_STRLEN_P(opline->op2.zv); } else { function_name = GET_OP2_ZVAL_PTR(BP_VAR_R); @@ -2564,7 +2562,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); } } @@ -2637,7 +2635,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) function_name = (zval*)(opline->op2.literal+1); if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -2651,7 +2649,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) ZEND_VM_NEXT_OPCODE(); } else { char *function_name_strval, *lcname; - zend_str_size_int function_name_strlen; + int function_name_strlen; zend_free_op free_op2; SAVE_OPLINE(); @@ -2659,7 +2657,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); if (function_name_strval[0] == '\\') { function_name_strlen -= 1; lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); @@ -2684,7 +2682,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) if (call->object) { Z_ADDREF_P(call->object); } - if (OP2_TYPE == IS_VAR && OP2_FREE && Z_REFCOUNT_P(function_name) == 1 && + if (OP2_TYPE == IS_VAR && OP2_FREE && call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ call->fbc->common.prototype = (zend_function*)function_name; @@ -2718,7 +2716,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) } if (Z_TYPE_PP(obj) == IS_STRING) { - ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), NULL, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -2727,15 +2725,15 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) call->object = NULL; if (ce->get_static_method) { - call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) TSRMLS_CC); + call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC); } else { - call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); + call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); } } else { call->object = *obj; ce = call->called_scope = Z_OBJCE_PP(obj); - call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); + call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); if (UNEXPECTED(call->fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method)); } @@ -2783,9 +2781,9 @@ ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST) func_name = opline->op2.literal + 1; if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRSIZE(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE) { + } else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE) { func_name++; - if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRSIZE(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE)) { + if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -2817,7 +2815,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, CONST, ANY) if (CACHED_PTR(opline->op1.literal->cache_slot)) { EX(function_state).function = CACHED_PTR(opline->op1.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRSIZE_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRLEN_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", fname->value.str.val); } else { @@ -2925,12 +2923,9 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { zend_error(E_NOTICE, "Only variable references should be returned by reference"); if (EG(return_value_ptr_ptr)) { - zval *ret; - - ALLOC_ZVAL(ret); - INIT_PZVAL_COPY(ret, *retval_ptr_ptr); - zval_copy_ctor(ret); - *EG(return_value_ptr_ptr) = ret; + retval_ptr = *retval_ptr_ptr; + *EG(return_value_ptr_ptr) = retval_ptr; + Z_ADDREF_P(retval_ptr); } break; } @@ -3007,7 +3002,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV) if (CACHED_PTR(opline->op1.literal->cache_slot)) { catch_ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC); + catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC); CACHE_PTR(opline->op1.literal->cache_slot, catch_ce); } @@ -3499,7 +3494,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) c = CACHED_PTR(opline->op2.literal->cache_slot); } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) { if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv)); + char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); if(!actual) { actual = Z_STRVAL_P(opline->op2.zv); } else { @@ -3507,7 +3502,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) } /* non-qualified constant - allow text substitution */ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); + ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -3536,12 +3531,10 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) } else if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op1.literal->cache_slot, ce); } @@ -3555,7 +3548,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) } } - if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { + if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { zend_class_entry *old_scope = EG(scope); @@ -3571,7 +3564,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) } ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value); zval_copy_ctor(&EX_T(opline->result.var).tmp_var); - } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { + } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */ ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1); } else { @@ -3639,14 +3632,14 @@ ZEND_VM_C_LABEL(num_index): if (OP2_TYPE == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index)); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index)); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -3761,7 +3754,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) inc_filename = tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -3774,7 +3767,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); } else { @@ -3917,25 +3910,23 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + if (UNEXPECTED(ce == NULL)) { if (OP1_TYPE != IS_CONST && varname == &tmp) { zval_dtor(&tmp); } else if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) { zval_ptr_dtor(&varname); } FREE_OP1(); - HANDLE_EXCEPTION(); - } - if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op2.literal->cache_slot, ce); } } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -3991,17 +3982,17 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) if (OP2_TYPE == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_dim)); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_dim)); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); } if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) { zval_ptr_dtor(&offset); @@ -4225,12 +4216,12 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY) zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { char *str_key; - zend_str_size_uint str_key_len; + uint str_key_len; ulong int_key; zend_uchar key_type; key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); - if (key_type != HASH_KEY_NON_EXISTENT && + if (key_type != HASH_KEY_NON_EXISTANT && (key_type == HASH_KEY_IS_LONG || zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS)) { break; @@ -4282,7 +4273,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) zend_object *zobj = zend_objects_get_address(array TSRMLS_CC); int key_type; char *str_key; - zend_str_size_uint str_key_len; + zend_uint str_key_len; zend_ulong int_key; fe_ht = Z_OBJPROP_P(array); @@ -4303,7 +4294,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) ZVAL_LONG(key, int_key); } else { const char *class_name, *prop_name; - zend_str_size_int prop_name_len; + int prop_name_len; zend_unmangle_property_name_ex( str_key, str_key_len - 1, &class_name, &prop_name, &prop_name_len ); @@ -4427,7 +4418,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -4437,7 +4428,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -4511,15 +4502,15 @@ ZEND_VM_C_LABEL(num_index_prop): hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_prop)); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_prop)); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -4577,7 +4568,7 @@ ZEND_VM_C_LABEL(num_index_prop): if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == 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_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -4589,11 +4580,11 @@ ZEND_VM_C_LABEL(num_index_prop): } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -4713,7 +4704,7 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY) efree(EG(error_reporting_ini_entry)->value); } EG(error_reporting_ini_entry)->value = Z_STRVAL(restored_error_reporting); - EG(error_reporting_ini_entry)->value_length = Z_STRSIZE(restored_error_reporting); + EG(error_reporting_ini_entry)->value_length = Z_STRLEN(restored_error_reporting); } else { zendi_zval_dtor(restored_error_reporting); } @@ -4888,8 +4879,8 @@ ZEND_VM_HANDLER(145, ZEND_DECLARE_INHERITED_CLASS_DELAYED, ANY, ANY) zend_class_entry **pce, **pce_orig; SAVE_OPLINE(); - if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE || - (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS && + if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE || + (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS && *pce != *pce_orig)) { do_bind_inherited_class(EX(op_array), opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC); } @@ -4963,7 +4954,7 @@ ZEND_VM_HANDLER(144, ZEND_ADD_INTERFACE, ANY, CONST) if (CACHED_PTR(opline->op2.literal->cache_slot)) { iface = CACHED_PTR(opline->op2.literal->cache_slot); } else { - iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(iface == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -4991,7 +4982,7 @@ ZEND_VM_HANDLER(154, ZEND_ADD_TRAIT, ANY, ANY) trait = CACHED_PTR(opline->op2.literal->cache_slot); } else { trait = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), - Z_STRSIZE_P(opline->op2.zv), + Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(trait == NULL)) { @@ -5105,7 +5096,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) Z_TYPE(restored_error_reporting) = IS_LONG; Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting)); convert_to_string(&restored_error_reporting); - zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), 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("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); zendi_zval_dtor(restored_error_reporting); } EX(old_error_reporting) = NULL; @@ -5194,8 +5185,8 @@ ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST) zval_copy_ctor(&c.value); } c.flags = CONST_CS; /* non persistent, case sensetive */ - c.name = IS_INTERNED(Z_STRVAL_P(name)) ? Z_STRVAL_P(name) : zend_strndup(Z_STRVAL_P(name), Z_STRSIZE_P(name)); - c.name_len = Z_STRSIZE_P(name)+1; + c.name = IS_INTERNED(Z_STRVAL_P(name)) ? Z_STRVAL_P(name) : zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); + c.name_len = Z_STRLEN_P(name)+1; c.module_number = PHP_USER_CONSTANT; if (zend_register_constant(&c TSRMLS_CC) == FAILURE) { @@ -5214,7 +5205,7 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED) SAVE_OPLINE(); - if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) || + if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) || UNEXPECTED(op_array->type != ZEND_USER_FUNCTION)) { zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 6a2aaaa721ebd..c947c3e17f59b 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -889,8 +889,8 @@ static int ZEND_FASTCALL ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER(ZEND zend_class_entry **pce, **pce_orig; SAVE_OPLINE(); - if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE || - (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS && + if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE || + (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS && *pce != *pce_orig)) { do_bind_inherited_class(EX(op_array), opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC); } @@ -944,7 +944,7 @@ static int ZEND_FASTCALL ZEND_ADD_TRAIT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) trait = CACHED_PTR(opline->op2.literal->cache_slot); } else { trait = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), - Z_STRSIZE_P(opline->op2.zv), + Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(trait == NULL)) { @@ -1058,7 +1058,7 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER Z_TYPE(restored_error_reporting) = IS_LONG; Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting)); convert_to_string(&restored_error_reporting); - zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), 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("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); zendi_zval_dtor(restored_error_reporting); } EX(old_error_reporting) = NULL; @@ -1191,13 +1191,13 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLE if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -1220,7 +1220,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE function_name = (zval*)(opline->op2.literal+1); if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -1234,7 +1234,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE ZEND_VM_NEXT_OPCODE(); } else { char *function_name_strval, *lcname; - zend_str_size_int function_name_strlen; + int function_name_strlen; SAVE_OPLINE(); @@ -1242,7 +1242,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); if (function_name_strval[0] == '\\') { function_name_strlen -= 1; lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); @@ -1267,7 +1267,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE if (call->object) { Z_ADDREF_P(call->object); } - if (IS_CONST == IS_VAR && 0 && Z_REFCOUNT_P(function_name) == 1 && + if (IS_CONST == IS_VAR && 0 && call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ call->fbc->common.prototype = (zend_function*)function_name; @@ -1301,7 +1301,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE } if (Z_TYPE_PP(obj) == IS_STRING) { - ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), NULL, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -1310,15 +1310,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE call->object = NULL; if (ce->get_static_method) { - call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) TSRMLS_CC); + call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC); } else { - call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); + call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); } } else { call->object = *obj; ce = call->called_scope = Z_OBJCE_PP(obj); - call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); + call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); if (UNEXPECTED(call->fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method)); } @@ -1366,9 +1366,9 @@ static int ZEND_FASTCALL ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPC func_name = opline->op2.literal + 1; if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRSIZE(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE) { + } else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE) { func_name++; - if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRSIZE(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE)) { + if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &call->fbc)==FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -1427,6 +1427,7 @@ static int ZEND_FASTCALL ZEND_BRK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SAVE_OPLINE(); el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, EX(op_array), execute_data TSRMLS_CC); + ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); } @@ -1438,6 +1439,7 @@ static int ZEND_FASTCALL ZEND_CONT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SAVE_OPLINE(); el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, EX(op_array), execute_data TSRMLS_CC); + ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); } @@ -1478,7 +1480,7 @@ static int ZEND_FASTCALL ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND if (CACHED_PTR(opline->op2.literal->cache_slot)) { iface = CACHED_PTR(opline->op2.literal->cache_slot); } else { - iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(iface == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -1515,13 +1517,13 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -1545,7 +1547,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H function_name = (zval*)(opline->op2.literal+1); if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -1559,7 +1561,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H ZEND_VM_NEXT_OPCODE(); } else { char *function_name_strval, *lcname; - zend_str_size_int function_name_strlen; + int function_name_strlen; zend_free_op free_op2; SAVE_OPLINE(); @@ -1567,7 +1569,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); if (function_name_strval[0] == '\\') { function_name_strlen -= 1; lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); @@ -1592,7 +1594,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H if (call->object) { Z_ADDREF_P(call->object); } - if (IS_TMP_VAR == IS_VAR && 1 && Z_REFCOUNT_P(function_name) == 1 && + if (IS_TMP_VAR == IS_VAR && 1 && call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ call->fbc->common.prototype = (zend_function*)function_name; @@ -1626,7 +1628,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H } if (Z_TYPE_PP(obj) == IS_STRING) { - ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), NULL, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -1635,15 +1637,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H call->object = NULL; if (ce->get_static_method) { - call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) TSRMLS_CC); + call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC); } else { - call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); + call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); } } else { call->object = *obj; ce = call->called_scope = Z_OBJCE_PP(obj); - call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); + call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); if (UNEXPECTED(call->fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method)); } @@ -1702,13 +1704,13 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -1732,7 +1734,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H function_name = (zval*)(opline->op2.literal+1); if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -1746,7 +1748,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H ZEND_VM_NEXT_OPCODE(); } else { char *function_name_strval, *lcname; - zend_str_size_int function_name_strlen; + int function_name_strlen; zend_free_op free_op2; SAVE_OPLINE(); @@ -1754,7 +1756,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); if (function_name_strval[0] == '\\') { function_name_strlen -= 1; lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); @@ -1779,7 +1781,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H if (call->object) { Z_ADDREF_P(call->object); } - if (IS_VAR == IS_VAR && (free_op2.var != NULL) && Z_REFCOUNT_P(function_name) == 1 && + if (IS_VAR == IS_VAR && (free_op2.var != NULL) && call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ call->fbc->common.prototype = (zend_function*)function_name; @@ -1813,7 +1815,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H } if (Z_TYPE_PP(obj) == IS_STRING) { - ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), NULL, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -1822,15 +1824,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H call->object = NULL; if (ce->get_static_method) { - call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) TSRMLS_CC); + call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC); } else { - call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); + call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); } } else { call->object = *obj; ce = call->called_scope = Z_OBJCE_PP(obj); - call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); + call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); if (UNEXPECTED(call->fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method)); } @@ -1889,13 +1891,13 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDL if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -1928,13 +1930,13 @@ static int ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A if (CACHED_PTR(opline->op2.literal->cache_slot)) { EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); } else { - EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); } } else if (Z_TYPE_P(class_name) == IS_OBJECT) { EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); } else if (Z_TYPE_P(class_name) == IS_STRING) { - EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), opline->extended_value TSRMLS_CC); + EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); } else { if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); @@ -1957,7 +1959,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA function_name = (zval*)(opline->op2.literal+1); if (CACHED_PTR(opline->op2.literal->cache_slot)) { call->fbc = CACHED_PTR(opline->op2.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &call->fbc) == FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); } else { @@ -1971,7 +1973,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA ZEND_VM_NEXT_OPCODE(); } else { char *function_name_strval, *lcname; - zend_str_size_int function_name_strlen; + int function_name_strlen; SAVE_OPLINE(); @@ -1979,7 +1981,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); if (function_name_strval[0] == '\\') { function_name_strlen -= 1; lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); @@ -2004,7 +2006,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA if (call->object) { Z_ADDREF_P(call->object); } - if (IS_CV == IS_VAR && 0 && Z_REFCOUNT_P(function_name) == 1 && + if (IS_CV == IS_VAR && 0 && call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ call->fbc->common.prototype = (zend_function*)function_name; @@ -2038,7 +2040,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA } if (Z_TYPE_PP(obj) == IS_STRING) { - ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRSIZE_PP(obj), NULL, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -2047,15 +2049,15 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA call->object = NULL; if (ce->get_static_method) { - call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method) TSRMLS_CC); + call->fbc = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC); } else { - call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); + call->fbc = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); } } else { call->object = *obj; ce = call->called_scope = Z_OBJCE_PP(obj); - call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRSIZE_PP(method), NULL TSRMLS_CC); + call->fbc = Z_OBJ_HT_P(call->object)->get_method(&call->object, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); if (UNEXPECTED(call->fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(call->object), Z_STRVAL_PP(method)); } @@ -2311,7 +2313,7 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A if (CACHED_PTR(opline->op1.literal->cache_slot)) { EX(function_state).function = CACHED_PTR(opline->op1.literal->cache_slot); - } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRSIZE_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) { + } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRLEN_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) { SAVE_OPLINE(); zend_error_noreturn(E_ERROR, "Call to undefined function %s()", fname->value.str.val); } else { @@ -2417,12 +2419,9 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { zend_error(E_NOTICE, "Only variable references should be returned by reference"); if (EG(return_value_ptr_ptr)) { - zval *ret; - - ALLOC_ZVAL(ret); - INIT_PZVAL_COPY(ret, *retval_ptr_ptr); - zval_copy_ctor(ret); - *EG(return_value_ptr_ptr) = ret; + retval_ptr = *retval_ptr_ptr; + *EG(return_value_ptr_ptr) = retval_ptr; + Z_ADDREF_P(retval_ptr); } break; } @@ -2657,7 +2656,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA inc_filename = tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -2670,7 +2669,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); } else { @@ -2902,12 +2901,12 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { char *str_key; - zend_str_size_uint str_key_len; + uint str_key_len; ulong int_key; zend_uchar key_type; key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); - if (key_type != HASH_KEY_NON_EXISTENT && + if (key_type != HASH_KEY_NON_EXISTANT && (key_type == HASH_KEY_IS_LONG || zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS)) { break; @@ -3364,7 +3363,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -3378,7 +3377,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -3393,10 +3392,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -3410,7 +3409,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -3563,12 +3562,10 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op1.literal->cache_slot, ce); } @@ -3593,12 +3590,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( /* do nothing */ } else if (IS_CONST != IS_UNUSED) { char *function_name_strval = NULL; - zend_str_size_int function_name_strlen = 0; + int function_name_strlen = 0; if (IS_CONST == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRSIZE_P(opline->op2.zv); + function_name_strlen = Z_STRLEN_P(opline->op2.zv); } else { function_name = opline->op2.zv; @@ -3609,7 +3606,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); } } @@ -3699,7 +3696,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO c = CACHED_PTR(opline->op2.literal->cache_slot); } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) { if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv)); + char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); if(!actual) { actual = Z_STRVAL_P(opline->op2.zv); } else { @@ -3707,7 +3704,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO } /* non-qualified constant - allow text substitution */ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); + ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -3736,12 +3733,10 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO } else if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op1.literal->cache_slot, ce); } @@ -3755,7 +3750,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO } } - if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { + if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { zend_class_entry *old_scope = EG(scope); @@ -3771,7 +3766,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO } ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value); zval_copy_ctor(&EX_T(opline->result.var).tmp_var); - } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { + } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */ ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1); } else { @@ -3839,14 +3834,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_O if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -3924,25 +3919,23 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST && varname == &tmp) { zval_dtor(&tmp); } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) { zval_ptr_dtor(&varname); } - HANDLE_EXCEPTION(); - } - if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op2.literal->cache_slot, ce); } } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -4000,7 +3993,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -4010,7 +4003,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -4073,8 +4066,8 @@ static int ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCOD zval_copy_ctor(&c.value); } c.flags = CONST_CS; /* non persistent, case sensetive */ - c.name = IS_INTERNED(Z_STRVAL_P(name)) ? Z_STRVAL_P(name) : zend_strndup(Z_STRVAL_P(name), Z_STRSIZE_P(name)); - c.name_len = Z_STRSIZE_P(name)+1; + c.name = IS_INTERNED(Z_STRVAL_P(name)) ? Z_STRVAL_P(name) : zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); + c.name_len = Z_STRLEN_P(name)+1; c.module_number = PHP_USER_CONSTANT; if (zend_register_constant(&c TSRMLS_CC) == FAILURE) { @@ -4556,12 +4549,10 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op1.literal->cache_slot, ce); } @@ -4586,12 +4577,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE /* do nothing */ } else if (IS_TMP_VAR != IS_UNUSED) { char *function_name_strval = NULL; - zend_str_size_int function_name_strlen = 0; + int function_name_strlen = 0; zend_free_op free_op2; if (IS_TMP_VAR == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRSIZE_P(opline->op2.zv); + function_name_strlen = Z_STRLEN_P(opline->op2.zv); } else { function_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); @@ -4602,7 +4593,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); } } @@ -4736,14 +4727,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPC if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -5239,7 +5230,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -5253,7 +5244,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -5268,10 +5259,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -5285,7 +5276,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_VAR(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -5414,12 +5405,10 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op1.literal->cache_slot, ce); } @@ -5444,12 +5433,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE /* do nothing */ } else if (IS_VAR != IS_UNUSED) { char *function_name_strval = NULL; - zend_str_size_int function_name_strlen = 0; + int function_name_strlen = 0; zend_free_op free_op2; if (IS_VAR == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRSIZE_P(opline->op2.zv); + function_name_strlen = Z_STRLEN_P(opline->op2.zv); } else { function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); @@ -5460,7 +5449,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); } } @@ -5594,14 +5583,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPC if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -5679,25 +5668,23 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST && varname == &tmp) { zval_dtor(&tmp); } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) { zval_ptr_dtor(&varname); } - HANDLE_EXCEPTION(); - } - if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op2.literal->cache_slot, ce); } } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -5755,7 +5742,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -5765,7 +5752,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -5985,7 +5972,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -5999,7 +5986,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -6014,10 +6001,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -6031,7 +6018,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int typ /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -6134,12 +6121,10 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op1.literal->cache_slot, ce); } @@ -6164,12 +6149,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER /* do nothing */ } else if (IS_UNUSED != IS_UNUSED) { char *function_name_strval = NULL; - zend_str_size_int function_name_strlen = 0; + int function_name_strlen = 0; if (IS_UNUSED == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRSIZE_P(opline->op2.zv); + function_name_strlen = Z_STRLEN_P(opline->op2.zv); } else { function_name = NULL; @@ -6180,7 +6165,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); } } @@ -6299,14 +6284,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_ if (IS_UNUSED == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -6384,25 +6369,23 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + if (UNEXPECTED(ce == NULL)) { if (IS_CONST != IS_CONST && varname == &tmp) { zval_dtor(&tmp); } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) { zval_ptr_dtor(&varname); } - HANDLE_EXCEPTION(); - } - if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op2.literal->cache_slot, ce); } } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -6460,7 +6443,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_ if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -6470,7 +6453,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_ } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CONST == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -6512,7 +6495,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER SAVE_OPLINE(); - if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) || + if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) || UNEXPECTED(op_array->type != ZEND_USER_FUNCTION)) { zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); } @@ -6994,12 +6977,10 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op1.literal->cache_slot, ce); } @@ -7024,12 +7005,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN /* do nothing */ } else if (IS_CV != IS_UNUSED) { char *function_name_strval = NULL; - zend_str_size_int function_name_strlen = 0; + int function_name_strlen = 0; if (IS_CV == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRSIZE_P(opline->op2.zv); + function_name_strlen = Z_STRLEN_P(opline->op2.zv); } else { function_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC); @@ -7040,7 +7021,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); } } @@ -7119,7 +7100,7 @@ static int ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A if (CACHED_PTR(opline->op1.literal->cache_slot)) { catch_ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC); + catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC); CACHE_PTR(opline->op1.literal->cache_slot, catch_ce); } @@ -7233,14 +7214,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCO if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -7745,12 +7726,9 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { zend_error(E_NOTICE, "Only variable references should be returned by reference"); if (EG(return_value_ptr_ptr)) { - zval *ret; - - ALLOC_ZVAL(ret); - INIT_PZVAL_COPY(ret, *retval_ptr_ptr); - zval_copy_ctor(ret); - *EG(return_value_ptr_ptr) = ret; + retval_ptr = *retval_ptr_ptr; + *EG(return_value_ptr_ptr) = retval_ptr; + Z_ADDREF_P(retval_ptr); } break; } @@ -7986,7 +7964,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND inc_filename = tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -7999,7 +7977,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); } else { @@ -8231,12 +8209,12 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { char *str_key; - zend_str_size_uint str_key_len; + uint str_key_len; ulong int_key; zend_uchar key_type; key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); - if (key_type != HASH_KEY_NON_EXISTENT && + if (key_type != HASH_KEY_NON_EXISTANT && (key_type == HASH_KEY_IS_LONG || zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS)) { break; @@ -8301,7 +8279,7 @@ static int ZEND_FASTCALL ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ efree(EG(error_reporting_ini_entry)->value); } EG(error_reporting_ini_entry)->value = Z_STRVAL(restored_error_reporting); - EG(error_reporting_ini_entry)->value_length = Z_STRSIZE(restored_error_reporting); + EG(error_reporting_ini_entry)->value_length = Z_STRLEN(restored_error_reporting); } else { zendi_zval_dtor(restored_error_reporting); } @@ -8745,7 +8723,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -8759,7 +8737,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_dtor(free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -8774,10 +8752,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -8791,7 +8769,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_CONST(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -8940,7 +8918,7 @@ static int ZEND_FASTCALL ZEND_ADD_CHAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDL if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_char_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRSIZE_P(str) = 0; + Z_STRLEN_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -8963,7 +8941,7 @@ static int ZEND_FASTCALL ZEND_ADD_STRING_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAN if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRSIZE_P(str) = 0; + Z_STRLEN_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -8981,7 +8959,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; zend_free_op free_op1; call_slot *call = EX(call_slots) + opline->result.num; @@ -8998,7 +8976,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -9125,14 +9103,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPC if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -9210,25 +9188,23 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); } else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) { zval_ptr_dtor(&varname); } zval_dtor(free_op1.var); - HANDLE_EXCEPTION(); - } - if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op2.literal->cache_slot, ce); } } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -9286,7 +9262,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -9296,7 +9272,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -9803,7 +9779,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRSIZE_P(str) = 0; + Z_STRLEN_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -9838,7 +9814,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; zend_free_op free_op1, free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -9855,7 +9831,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -9984,14 +9960,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP_HANDLER(ZEND_OPCOD if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -10487,7 +10463,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -10501,7 +10477,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_dtor(free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -10516,10 +10492,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -10533,7 +10509,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_VAR(int type, ZE /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -10663,7 +10639,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRSIZE_P(str) = 0; + Z_STRLEN_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -10698,7 +10674,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; zend_free_op free_op1, free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -10715,7 +10691,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -10844,14 +10820,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -10929,25 +10905,23 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); } else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) { zval_ptr_dtor(&varname); } zval_dtor(free_op1.var); - HANDLE_EXCEPTION(); - } - if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op2.literal->cache_slot, ce); } } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -11005,7 +10979,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -11015,7 +10989,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -11235,7 +11209,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -11249,7 +11223,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_dtor(free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -11264,10 +11238,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -11281,7 +11255,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMP_UNUSED(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -11426,14 +11400,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OP if (IS_UNUSED == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -11511,25 +11485,23 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + if (UNEXPECTED(ce == NULL)) { if (IS_TMP_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); } else if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) { zval_ptr_dtor(&varname); } zval_dtor(free_op1.var); - HANDLE_EXCEPTION(); - } - if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op2.literal->cache_slot, ce); } } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -11587,7 +11559,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -11597,7 +11569,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_TMP_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -12104,7 +12076,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_A if (IS_TMP_VAR == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRSIZE_P(str) = 0; + Z_STRLEN_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -12138,7 +12110,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_ USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; zend_free_op free_op1; call_slot *call = EX(call_slots) + opline->result.num; @@ -12155,7 +12127,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_ } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -12282,14 +12254,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -12974,12 +12946,9 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { zend_error(E_NOTICE, "Only variable references should be returned by reference"); if (EG(return_value_ptr_ptr)) { - zval *ret; - - ALLOC_ZVAL(ret); - INIT_PZVAL_COPY(ret, *retval_ptr_ptr); - zval_copy_ctor(ret); - *EG(return_value_ptr_ptr) = ret; + retval_ptr = *retval_ptr_ptr; + *EG(return_value_ptr_ptr) = retval_ptr; + Z_ADDREF_P(retval_ptr); } break; } @@ -13325,7 +13294,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND inc_filename = tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -13338,7 +13307,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); } else { @@ -13570,12 +13539,12 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { char *str_key; - zend_str_size_uint str_key_len; + uint str_key_len; ulong int_key; zend_uchar key_type; key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); - if (key_type != HASH_KEY_NON_EXISTENT && + if (key_type != HASH_KEY_NON_EXISTANT && (key_type == HASH_KEY_IS_LONG || zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS)) { break; @@ -13627,7 +13596,7 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG zend_object *zobj = zend_objects_get_address(array TSRMLS_CC); int key_type; char *str_key; - zend_str_size_uint str_key_len; + zend_uint str_key_len; zend_ulong int_key; fe_ht = Z_OBJPROP_P(array); @@ -13648,7 +13617,7 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG ZVAL_LONG(key, int_key); } else { const char *class_name, *prop_name; - zend_str_size_int prop_name_len; + int prop_name_len; zend_unmangle_property_name_ex( str_key, str_key_len - 1, &class_name, &prop_name, &prop_name_len ); @@ -14649,7 +14618,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -14663,7 +14632,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_ptr_dtor(&free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -14678,10 +14647,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -14695,7 +14664,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_CONST(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -15374,7 +15343,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; zend_free_op free_op1; call_slot *call = EX(call_slots) + opline->result.num; @@ -15391,7 +15360,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -15463,12 +15432,10 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op1.literal->cache_slot, ce); } @@ -15493,12 +15460,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE /* do nothing */ } else if (IS_CONST != IS_UNUSED) { char *function_name_strval = NULL; - zend_str_size_int function_name_strlen = 0; + int function_name_strlen = 0; if (IS_CONST == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRSIZE_P(opline->op2.zv); + function_name_strlen = Z_STRLEN_P(opline->op2.zv); } else { function_name = opline->op2.zv; @@ -15509,7 +15476,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); } } @@ -15599,7 +15566,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE c = CACHED_PTR(opline->op2.literal->cache_slot); } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) { if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv)); + char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); if(!actual) { actual = Z_STRVAL_P(opline->op2.zv); } else { @@ -15607,7 +15574,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE } /* non-qualified constant - allow text substitution */ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); + ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -15636,12 +15603,10 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE } else if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op1.literal->cache_slot, ce); } @@ -15655,7 +15620,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE } } - if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { + if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { zend_class_entry *old_scope = EG(scope); @@ -15671,7 +15636,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE } ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value); zval_copy_ctor(&EX_T(opline->result.var).tmp_var); - } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { + } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */ ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1); } else { @@ -15739,14 +15704,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPC if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -15824,25 +15789,23 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) { zval_ptr_dtor(&varname); } zval_ptr_dtor(&free_op1.var); - HANDLE_EXCEPTION(); - } - if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op2.literal->cache_slot, ce); } } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -15898,17 +15861,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); } if (IS_CONST == IS_CV || IS_CONST == IS_VAR) { zval_ptr_dtor(&offset); @@ -16041,7 +16004,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -16051,7 +16014,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -16125,15 +16088,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -16191,7 +16154,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == 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_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -16203,11 +16166,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST( } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -17726,7 +17689,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; zend_free_op free_op1, free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -17743,7 +17706,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -17816,12 +17779,10 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op1.literal->cache_slot, ce); } @@ -17846,12 +17807,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND /* do nothing */ } else if (IS_TMP_VAR != IS_UNUSED) { char *function_name_strval = NULL; - zend_str_size_int function_name_strlen = 0; + int function_name_strlen = 0; zend_free_op free_op2; if (IS_TMP_VAR == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRSIZE_P(opline->op2.zv); + function_name_strlen = Z_STRLEN_P(opline->op2.zv); } else { function_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); @@ -17862,7 +17823,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); } } @@ -17996,14 +17957,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP_HANDLER(ZEND_OPCOD if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -18077,17 +18038,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLE if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); } if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -18219,15 +18180,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -18285,7 +18246,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == 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_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -18297,11 +18258,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_TMP(in } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -19258,7 +19219,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -19272,7 +19233,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_ptr_dtor(&free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -19287,10 +19248,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -19304,7 +19265,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_VAR(int type, ZE /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -20039,7 +20000,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; zend_free_op free_op1, free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -20056,7 +20017,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -20129,12 +20090,10 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op1.literal->cache_slot, ce); } @@ -20159,12 +20118,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND /* do nothing */ } else if (IS_VAR != IS_UNUSED) { char *function_name_strval = NULL; - zend_str_size_int function_name_strlen = 0; + int function_name_strlen = 0; zend_free_op free_op2; if (IS_VAR == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRSIZE_P(opline->op2.zv); + function_name_strlen = Z_STRLEN_P(opline->op2.zv); } else { function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC); @@ -20175,7 +20134,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); } } @@ -20309,14 +20268,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -20394,25 +20353,23 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) { zval_ptr_dtor(&varname); } zval_ptr_dtor(&free_op1.var); - HANDLE_EXCEPTION(); - } - if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op2.literal->cache_slot, ce); } } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -20468,17 +20425,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); } if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -20611,7 +20568,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -20621,7 +20578,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -20695,15 +20652,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -20761,7 +20718,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == 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_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -20773,11 +20730,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_VAR(in } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -21252,7 +21209,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -21266,7 +21223,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); zval_ptr_dtor(&free_op1.var); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -21281,10 +21238,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -21298,7 +21255,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_VAR_UNUSED(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -21569,12 +21526,10 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op1.literal->cache_slot, ce); } @@ -21599,12 +21554,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z /* do nothing */ } else if (IS_UNUSED != IS_UNUSED) { char *function_name_strval = NULL; - zend_str_size_int function_name_strlen = 0; + int function_name_strlen = 0; if (IS_UNUSED == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRSIZE_P(opline->op2.zv); + function_name_strlen = Z_STRLEN_P(opline->op2.zv); } else { function_name = NULL; @@ -21615,7 +21570,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); } } @@ -21734,14 +21689,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OP if (IS_UNUSED == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -21819,25 +21774,23 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + if (UNEXPECTED(ce == NULL)) { if (IS_VAR != IS_CONST && varname == &tmp) { zval_dtor(&tmp); } else if (IS_VAR == IS_VAR || IS_VAR == IS_CV) { zval_ptr_dtor(&varname); } zval_ptr_dtor(&free_op1.var); - HANDLE_EXCEPTION(); - } - if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op2.literal->cache_slot, ce); } } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -21895,7 +21848,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -21905,7 +21858,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_VAR == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -23498,7 +23451,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_ USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; zend_free_op free_op1; call_slot *call = EX(call_slots) + opline->result.num; @@ -23515,7 +23468,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_ } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); @@ -23587,12 +23540,10 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op1.literal->cache_slot, ce); } @@ -23617,12 +23568,12 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ /* do nothing */ } else if (IS_CV != IS_UNUSED) { char *function_name_strval = NULL; - zend_str_size_int function_name_strlen = 0; + int function_name_strlen = 0; if (IS_CV == IS_CONST) { function_name_strval = Z_STRVAL_P(opline->op2.zv); - function_name_strlen = Z_STRSIZE_P(opline->op2.zv); + function_name_strlen = Z_STRLEN_P(opline->op2.zv); } else { function_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC); @@ -23633,7 +23584,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ zend_error_noreturn(E_ERROR, "Function name must be a string"); } else { function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); } } @@ -23766,14 +23717,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -23847,17 +23798,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); } if (IS_CV == IS_CV || IS_CV == IS_VAR) { zval_ptr_dtor(&offset); @@ -23989,15 +23940,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -24055,7 +24006,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == 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_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -24067,11 +24018,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CV(int } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -25095,7 +25046,7 @@ static int ZEND_FASTCALL ZEND_ADD_CHAR_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HA if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_char_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRSIZE_P(str) = 0; + Z_STRLEN_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -25118,7 +25069,7 @@ static int ZEND_FASTCALL ZEND_ADD_STRING_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_ if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRSIZE_P(str) = 0; + Z_STRLEN_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -25136,7 +25087,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; call_slot *call = EX(call_slots) + opline->result.num; @@ -25153,7 +25104,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = _get_obj_zval_ptr_unused(TSRMLS_C); @@ -25223,7 +25174,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC c = CACHED_PTR(opline->op2.literal->cache_slot); } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) { if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRSIZE_P(opline->op2.zv)); + char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); if(!actual) { actual = Z_STRVAL_P(opline->op2.zv); } else { @@ -25231,7 +25182,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC } /* non-qualified constant - allow text substitution */ zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRSIZE_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); + ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } else { @@ -25260,12 +25211,10 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC } else if (CACHED_PTR(opline->op1.literal->cache_slot)) { ce = CACHED_PTR(opline->op1.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRSIZE_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op1.literal->cache_slot, ce); } @@ -25279,7 +25228,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC } } - if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { + if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || (Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { zend_class_entry *old_scope = EG(scope); @@ -25295,7 +25244,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC } ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value); zval_copy_ctor(&EX_T(opline->result.var).tmp_var); - } else if (Z_STRSIZE_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { + } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && strcmp(Z_STRVAL_P(opline->op2.zv), "class") == 0) { /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */ ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, ce->name, ce->name_length, 1); } else { @@ -25359,17 +25308,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_H if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); } if (IS_CONST == IS_CV || IS_CONST == IS_VAR) { zval_ptr_dtor(&offset); @@ -25499,15 +25448,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -25565,7 +25514,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == 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_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -25577,11 +25526,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CON } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -26520,7 +26469,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDL if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRSIZE_P(str) = 0; + Z_STRLEN_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -26555,7 +26504,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; zend_free_op free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -26572,7 +26521,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = _get_obj_zval_ptr_unused(TSRMLS_C); @@ -26682,17 +26631,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HAN if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); } if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -26822,15 +26771,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -26888,7 +26837,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == 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_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -26900,11 +26849,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_TMP } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -27843,7 +27792,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDL if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRSIZE_P(str) = 0; + Z_STRLEN_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -27878,7 +27827,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; zend_free_op free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -27895,7 +27844,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = _get_obj_zval_ptr_unused(TSRMLS_C); @@ -28005,17 +27954,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HAN if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); } if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -28145,15 +28094,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -28211,7 +28160,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == 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_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -28223,11 +28172,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_VAR } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -29590,7 +29539,7 @@ static int ZEND_FASTCALL ZEND_ADD_VAR_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLE if (IS_UNUSED == IS_UNUSED) { /* Initialize for erealloc in add_string_to_string */ Z_STRVAL_P(str) = NULL; - Z_STRSIZE_P(str) = 0; + Z_STRLEN_P(str) = 0; Z_TYPE_P(str) = IS_STRING; INIT_PZVAL(str); @@ -29624,7 +29573,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; call_slot *call = EX(call_slots) + opline->result.num; @@ -29641,7 +29590,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = _get_obj_zval_ptr_unused(TSRMLS_C); @@ -29750,17 +29699,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAND if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); } if (IS_CV == IS_CV || IS_CV == IS_VAR) { zval_ptr_dtor(&offset); @@ -29890,15 +29839,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV( hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -29956,7 +29905,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV( if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == 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_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -29968,11 +29917,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_UNUSED_CV( } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -30633,12 +30582,9 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { zend_error(E_NOTICE, "Only variable references should be returned by reference"); if (EG(return_value_ptr_ptr)) { - zval *ret; - - ALLOC_ZVAL(ret); - INIT_PZVAL_COPY(ret, *retval_ptr_ptr); - zval_copy_ctor(ret); - *EG(return_value_ptr_ptr) = ret; + retval_ptr = *retval_ptr_ptr; + *EG(return_value_ptr_ptr) = retval_ptr; + Z_ADDREF_P(retval_ptr); } break; } @@ -30971,7 +30917,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL inc_filename = tmp_inc_filename; } - if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRSIZE_P(inc_filename)) { + if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); } else { @@ -30984,7 +30930,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL zend_file_handle file_handle; char *resolved_path; - resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRSIZE_P(inc_filename) TSRMLS_CC); + resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC); if (resolved_path) { failure_retval = zend_hash_exists(&EG(included_files), resolved_path, strlen(resolved_path)+1); } else { @@ -31216,12 +31162,12 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { char *str_key; - zend_str_size_uint str_key_len; + uint str_key_len; ulong int_key; zend_uchar key_type; key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); - if (key_type != HASH_KEY_NON_EXISTENT && + if (key_type != HASH_KEY_NON_EXISTANT && (key_type == HASH_KEY_IS_LONG || zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS)) { break; @@ -32160,7 +32106,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -32174,7 +32120,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -32189,10 +32135,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -32206,7 +32152,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_CONST(int type, Z /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -32878,7 +32824,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; call_slot *call = EX(call_slots) + opline->result.num; @@ -32895,7 +32841,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); @@ -33022,14 +32968,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCO if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -33107,25 +33053,23 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST && varname == &tmp) { zval_dtor(&tmp); } else if (IS_CV == IS_VAR || IS_CV == IS_CV) { zval_ptr_dtor(&varname); } - HANDLE_EXCEPTION(); - } - if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op2.literal->cache_slot, ce); } } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -33181,17 +33125,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL if (IS_CONST == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); } if (IS_CONST == IS_CV || IS_CONST == IS_VAR) { zval_ptr_dtor(&offset); @@ -33322,7 +33266,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -33332,7 +33276,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -33406,15 +33350,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -33472,7 +33416,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == 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_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -33484,11 +33428,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CONST(i } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -34996,7 +34940,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_ USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; zend_free_op free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -35013,7 +34957,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_ } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); @@ -35142,14 +35086,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -35223,17 +35167,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER if (IS_TMP_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); } if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -35363,15 +35307,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -35429,7 +35373,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == 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_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -35441,11 +35385,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_TMP(int } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -36398,7 +36342,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -36412,7 +36356,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -36427,10 +36371,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -36444,7 +36388,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_VAR(int type, ZEN /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -37171,7 +37115,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_ USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; zend_free_op free_op2; call_slot *call = EX(call_slots) + opline->result.num; @@ -37188,7 +37132,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_ } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); @@ -37317,14 +37261,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_VAR_HANDLER(ZEND_OPCODE if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -37402,25 +37346,23 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST && varname == &tmp) { zval_dtor(&tmp); } else if (IS_CV == IS_VAR || IS_CV == IS_CV) { zval_ptr_dtor(&varname); } - HANDLE_EXCEPTION(); - } - if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op2.literal->cache_slot, ce); } } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -37476,17 +37418,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER if (IS_VAR == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); } if (IS_VAR == IS_CV || IS_VAR == IS_VAR) { zval_ptr_dtor(&offset); @@ -37617,7 +37559,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -37627,7 +37569,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -37701,15 +37643,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -37767,7 +37709,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == 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_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -37779,11 +37721,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_VAR(int } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } @@ -38254,7 +38196,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type, if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST && varname == &tmp_varname) { zval_dtor(&tmp_varname); @@ -38268,7 +38210,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type, } else { ce = EX_T(opline->op2.var).class_entry; } - retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); @@ -38283,10 +38225,10 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type, } else if (IS_INTERNED(Z_STRVAL_P(varname))) { hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); } else { - hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1); + hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); } - if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { + if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: case BP_VAR_UNSET: @@ -38300,7 +38242,7 @@ static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type, /* break missing intentionally */ case BP_VAR_W: Z_ADDREF_P(&EG(uninitialized_zval)); - zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRSIZE_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); + zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); break; EMPTY_SWITCH_DEFAULT_CASE() } @@ -38612,14 +38554,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPC if (IS_UNUSED == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -38697,25 +38639,23 @@ static int ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); - if (UNEXPECTED(EG(exception) != NULL)) { + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + if (UNEXPECTED(ce == NULL)) { if (IS_CV != IS_CONST && varname == &tmp) { zval_dtor(&tmp); } else if (IS_CV == IS_VAR || IS_CV == IS_CV) { zval_ptr_dtor(&varname); } - HANDLE_EXCEPTION(); - } - if (UNEXPECTED(ce == NULL)) { - zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv)); + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); } CACHE_PTR(opline->op2.literal->cache_slot, ce); } } else { ce = EX_T(opline->op2.var).class_entry; } - zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); } else { ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); @@ -38773,7 +38713,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC if (CACHED_PTR(opline->op2.literal->cache_slot)) { ce = CACHED_PTR(opline->op2.literal->cache_slot); } else { - ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRSIZE_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); + ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); if (UNEXPECTED(ce == NULL)) { CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -38783,7 +38723,7 @@ static int ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC } else { ce = EX_T(opline->op2.var).class_entry; } - value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRSIZE_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); + value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((IS_CV == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); if (!value) { isset = 0; } @@ -40345,7 +40285,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H USE_OPLINE zval *function_name; char *function_name_strval; - zend_str_size_int function_name_strlen; + int function_name_strlen; call_slot *call = EX(call_slots) + opline->result.num; @@ -40362,7 +40302,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H } function_name_strval = Z_STRVAL_P(function_name); - function_name_strlen = Z_STRSIZE_P(function_name); + function_name_strlen = Z_STRLEN_P(function_name); call->object = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); @@ -40489,14 +40429,14 @@ static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_ if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); + zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); @@ -40570,17 +40510,17 @@ static int ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ if (IS_CV == IS_CONST) { hval = Z_HASH_P(offset); } else { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_dim); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_dim); if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } if (ht == &EG(symbol_table)) { zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); } else { - zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval); + zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); } if (IS_CV == IS_CV || IS_CV == IS_VAR) { zval_ptr_dtor(&offset); @@ -40710,15 +40650,15 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int hval = Z_HASH_P(offset); } else { if (!prop_dim) { - ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, goto num_index_prop); + ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, goto num_index_prop); } if (IS_INTERNED(Z_STRVAL_P(offset))) { hval = INTERNED_HASH(Z_STRVAL_P(offset)); } else { - hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1); + hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); } } - if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, hval, (void **) &value) == SUCCESS) { + if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { isset = 1; } break; @@ -40776,7 +40716,7 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int if (Z_TYPE_P(offset) != IS_LONG) { if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ - && IS_LONG == 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_COPY_VALUE(&tmp, offset); zval_copy_ctor(&tmp); convert_to_long(&tmp); @@ -40788,11 +40728,11 @@ static int ZEND_FASTCALL zend_isset_isempty_dim_prop_obj_handler_SPEC_CV_CV(int } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container)) { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { result = 1; } } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { - if (offset->value.lval >= 0 && offset->value.lval < Z_STRSIZE_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { + if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { result = 1; } } diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index 60ac30e17f988..f1afdf0ce13cb 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -1408,7 +1408,7 @@ function usage() { // Disabling code for old-style executor define("ZEND_VM_OLD_EXECUTOR", 1); } else if ($argv[$i] == "--with-lines") { - // Enabling debugging using original zend_vm_def.h + // Enabling debuging using original zend_vm_def.h define("ZEND_VM_LINES", 1); } else if ($argv[$i] == "--help") { usage(); diff --git a/acinclude.m4 b/acinclude.m4 index b76bd344a757f..6c97dc37c60aa 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2686,14 +2686,14 @@ EOF fi for arg in $ac_configure_args; do if test `expr -- $arg : "'.*"` = 0; then - if test `expr -- $arg : "-.*"` = 0 && test `expr -- $arg : ".*=.*"` = 0; then - continue; + if test `expr -- $arg : "--.*"` = 0; then + break; fi echo "'[$]arg' \\" >> $1 CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS '[$]arg'" else - if test `expr -- $arg : "'-.*"` = 0 && test `expr -- $arg : "'.*=.*"` = 0; then - continue; + if test `expr -- $arg : "'--.*"` = 0; then + break; fi echo "[$]arg \\" >> $1 CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS [$]arg" @@ -2962,14 +2962,10 @@ dnl DTrace objects esac dnl Generate Makefile.objects entries -dnl The empty $ac_provsrc command stops an implicit circular dependency -dnl in GNU Make which causes the .d file to be overwritten (Bug 61268) cat>>Makefile.objects< \$[]@ + CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@ && \$(SED) -ibak 's,PHP_,DTRACE_,g' \$[]@ \$(PHP_DTRACE_OBJS): $ac_bdir[$]ac_hdrobj @@ -2978,22 +2974,3 @@ $ac_bdir[$]ac_provsrc.o: \$(PHP_DTRACE_OBJS) EOF ]) - -dnl -dnl PHP_CHECK_STDINT_TYPES -dnl -AC_DEFUN([PHP_CHECK_STDINT_TYPES], [ - AC_CHECK_SIZEOF([short], 2) - AC_CHECK_SIZEOF([int], 4) - AC_CHECK_SIZEOF([long], 4) - AC_CHECK_SIZEOF([long long], 8) - AC_CHECK_TYPES([int8, int16, int32, int64, int8_t, int16_t, int32_t, int64_t, uint8, uint16, uint32, uint64, uint8_t, uint16_t, uint32_t, uint64_t, u_int8_t, u_int16_t, u_int32_t, u_int64_t], [], [], [ -#if HAVE_STDINT_H -# include -#endif -#if HAVE_SYS_TYPES_H -# include -#endif - ]) - AC_DEFINE([PHP_HAVE_STDINT_TYPES], [1], [Checked for stdint types]) -]) diff --git a/build/libtool.m4 b/build/libtool.m4 index 56658ccbb4d4e..268cad9d3e5c4 100644 --- a/build/libtool.m4 +++ b/build/libtool.m4 @@ -193,11 +193,11 @@ AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) AC_ARG_ENABLE([libtool-lock], -[ --disable-libtool-lock Avoid locking (might break parallel builds)]) +[ --disable-libtool-lock avoid locking (might break parallel builds)]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes AC_ARG_WITH([pic], -[ --with-pic Try to use only PIC/non-PIC objects [default=use both]], +[ --with-pic try to use only PIC/non-PIC objects [default=use both]], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=default @@ -1230,7 +1230,7 @@ if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then - # We can hardcode non-existent directories. + # We can hardcode non-existant directories. if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library @@ -1919,7 +1919,7 @@ fi AC_DEFUN([_LT_AC_TAGCONFIG], [AC_REQUIRE([LT_AC_PROG_SED])dnl AC_ARG_WITH([tags], -[ --with-tags[=TAGS] Include additional configurations [automatic] +[ --with-tags[=TAGS] include additional configurations [automatic] ], [tagnames="$withval"]) @@ -2023,7 +2023,7 @@ AC_DEFUN([AC_ENABLE_SHARED], [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([shared], changequote(<<, >>)dnl -<< --enable-shared[=PKGS] Build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case $enableval in @@ -2063,7 +2063,7 @@ AC_DEFUN([AC_ENABLE_STATIC], [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([static], changequote(<<, >>)dnl -<< --enable-static[=PKGS] Build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case $enableval in @@ -2103,8 +2103,7 @@ AC_DEFUN([AC_ENABLE_FAST_INSTALL], [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([fast-install], changequote(<<, >>)dnl -<< --enable-fast-install[=PKGS] - Optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case $enableval in @@ -2242,7 +2241,7 @@ fi # find the pathname to the GNU or non-GNU linker AC_DEFUN([AC_PROG_LD], [AC_ARG_WITH([gnu-ld], -[ --with-gnu-ld Assume the C compiler uses GNU ld [default=no]], +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no]) AC_REQUIRE([LT_AC_PROG_SED])dnl diff --git a/config.guess b/config.guess index 1578aa1736a32..b94cde8ef2e0f 100644 --- a/config.guess +++ b/config.guess @@ -1080,7 +1080,7 @@ EOF # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configure will decide that + # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; diff --git a/configure.in b/configure.in index 8530b54bbec4d..260b982ce8a43 100644 --- a/configure.in +++ b/configure.in @@ -60,7 +60,7 @@ AH_BOTTOM([ #endif #if ZEND_BROKEN_SPRINTF -zend_str_size_int zend_sprintf(char *buffer, const char *format, ...); +int zend_sprintf(char *buffer, const char *format, ...); #else # define zend_sprintf sprintf #endif @@ -572,9 +572,6 @@ PHP_CHECK_SIZEOF(intmax_t, 0) PHP_CHECK_SIZEOF(ssize_t, 8) PHP_CHECK_SIZEOF(ptrdiff_t, 8) -dnl Check stdint types (must be after header check) -PHP_CHECK_STDINT_TYPES - dnl Check for members of the stat structure AC_STRUCT_ST_BLKSIZE dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists @@ -864,13 +861,6 @@ else ZEND_DEBUG=no fi -PHP_ARG_ENABLE(zstrlen, whether to include Z_STRLEN macros, -[ --enable-zstrlen Enable legacy Z_STRLEN macros and types], no, no) - -if test "$PHP_ZSTRLEN" = "yes"; then - AC_DEFINE(ZEND_USE_LEGACY_STRING_TYPES, "1", [ ]) -fi - PHP_ARG_WITH(layout, layout of installed files, [ --with-layout=TYPE Set how installed files will be laid out. Type can be either PHP or GNU @<:@PHP@:>@], PHP, no) @@ -1016,7 +1006,7 @@ dnl Check if all enabled by default extensions should be disabled dnl AC_ARG_ENABLE(all, -[ --disable-all Disable all extensions which are enabled by default +[ --disable-all Disable all extensions which are enabled by default ], [ PHP_ENABLE_ALL=$enableval ]) @@ -1592,7 +1582,7 @@ cat < max_index) { diff --git a/ext/com_dotnet/com_wrapper.c b/ext/com_dotnet/com_wrapper.c index 355779e4ad975..597b0599510f1 100644 --- a/ext/com_dotnet/com_wrapper.c +++ b/ext/com_dotnet/com_wrapper.c @@ -467,7 +467,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC) /* properties */ if (Z_OBJPROP_P(disp->object)) { zend_hash_internal_pointer_reset_ex(Z_OBJPROP_P(disp->object), &pos); - while (HASH_KEY_NON_EXISTENT != (keytype = + while (HASH_KEY_NON_EXISTANT != (keytype = zend_hash_get_current_key_ex(Z_OBJPROP_P(disp->object), &name, &namelen, &pid, 0, &pos))) { char namebuf[32]; @@ -498,7 +498,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC) /* functions */ if (Z_OBJCE_P(disp->object)) { zend_hash_internal_pointer_reset_ex(&Z_OBJCE_P(disp->object)->function_table, &pos); - while (HASH_KEY_NON_EXISTENT != (keytype = + while (HASH_KEY_NON_EXISTANT != (keytype = zend_hash_get_current_key_ex(&Z_OBJCE_P(disp->object)->function_table, &name, &namelen, &pid, 0, &pos))) { @@ -598,7 +598,7 @@ PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *si zend_hash_init(disp->name_to_dispid, 0, NULL, ZVAL_PTR_DTOR, 0); zend_hash_internal_pointer_reset_ex(id_to_name, &pos); - while (HASH_KEY_NON_EXISTENT != (keytype = + while (HASH_KEY_NON_EXISTANT != (keytype = zend_hash_get_current_key_ex(id_to_name, &name, &namelen, &pid, 0, &pos))) { if (keytype == HASH_KEY_IS_LONG) { diff --git a/ext/curl/config.m4 b/ext/curl/config.m4 index 2f82c3485d862..e3d1d51cccdfc 100644 --- a/ext/curl/config.m4 +++ b/ext/curl/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(curl, for cURL support, -[ --with-curl[=DIR] Include cURL support]) +[ --with-curl[=DIR] Include cURL support]) if test "$PHP_CURL" != "no"; then if test -r $PHP_CURL/include/curl/easy.h; then diff --git a/ext/date/config0.m4 b/ext/date/config0.m4 index 0b46c6803a7fd..f403104a8afbe 100644 --- a/ext/date/config0.m4 +++ b/ext/date/config0.m4 @@ -22,5 +22,4 @@ cat > $ext_builddir/lib/timelib_config.h < #endif -#include EOF diff --git a/ext/date/lib/timelib_structs.h b/ext/date/lib/timelib_structs.h index cc12eb38a6f04..a3d7793447b72 100644 --- a/ext/date/lib/timelib_structs.h +++ b/ext/date/lib/timelib_structs.h @@ -23,7 +23,37 @@ #include "timelib_config.h" -#include "php_stdint.h" +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#if defined(HAVE_INTTYPES_H) +#include +#elif defined(HAVE_STDINT_H) +#include +#endif + +#ifdef PHP_WIN32 +/* TODO: Remove these hacks/defs once we have the int definitions in main/ + rathen than in each 2nd extension and win32/ */ +# include "win32/php_stdint.h" +#else +# ifndef HAVE_INT32_T +# if SIZEOF_INT == 4 +typedef int int32_t; +# elif SIZEOF_LONG == 4 +typedef long int int32_t; +# endif +# endif + +# ifndef HAVE_UINT32_T +# if SIZEOF_INT == 4 +typedef unsigned int uint32_t; +# elif SIZEOF_LONG == 4 +typedef unsigned long int uint32_t; +# endif +# endif +#endif #include diff --git a/ext/date/lib/timezonedb.h b/ext/date/lib/timezonedb.h index 1e5706cdccd3c..2f9d8fe668032 100644 --- a/ext/date/lib/timezonedb.h +++ b/ext/date/lib/timezonedb.h @@ -766,8 +766,8 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x1A, 0xB7, 0xA6, 0x00, 0x1E, 0x18, 0x6F, 0xF0, 0x48, 0x41, 0xE6, 0x80, 0x48, 0xBB, 0x22, 0x70, 0x4A, 0x23, 0x1A, 0x00, 0x4A, 0x8D, 0xD5, 0x70, 0x4B, 0xDC, 0xC0, 0x80, 0x4C, 0x5D, 0xE5, 0x70, 0x4D, 0x97, 0xB8, 0x80, 0x4E, 0x34, 0x8C, 0xF0, 0x4F, 0x9C, 0xA0, 0xA0, 0x50, 0x08, 0xBB, 0xA0, -0x50, 0x31, 0x9A, 0x20, 0x50, 0x67, 0xA7, 0xA0, 0x51, 0x7C, 0x82, 0xA0, 0x51, 0xD8, 0xCB, 0xA0, -0x52, 0x05, 0x9E, 0xA0, 0x52, 0x47, 0x89, 0xA0, 0x53, 0x5C, 0x64, 0xA0, 0x53, 0xAF, 0x73, 0x20, +0x50, 0x31, 0x9A, 0x20, 0x50, 0x67, 0xA7, 0xA0, 0x51, 0x7C, 0x82, 0xA0, 0x51, 0xDB, 0x6E, 0xA0, +0x52, 0x02, 0xFB, 0xA0, 0x52, 0x47, 0x89, 0xA0, 0x53, 0x5C, 0x64, 0xA0, 0x53, 0xAF, 0x73, 0x20, 0x53, 0xD7, 0x00, 0x20, 0x54, 0x27, 0x6B, 0xA0, 0x55, 0x3C, 0x46, 0xA0, 0x55, 0x82, 0x26, 0x20, 0x55, 0xA9, 0xB3, 0x20, 0x56, 0x07, 0x4D, 0xA0, 0x57, 0x1C, 0x28, 0xA0, 0x57, 0x56, 0x2A, 0xA0, 0x57, 0x7D, 0xB7, 0xA0, 0x57, 0xE7, 0x2F, 0xA0, 0x59, 0x05, 0x45, 0x20, 0x59, 0x28, 0xDD, 0xA0, @@ -7248,7 +7248,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x8C, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x9A, 0xB0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x9A, 0xB0, 0x01, 0x00, 0x00, 0x00, 0x8C, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x9A, 0xB0, 0x00, 0x08, 0x45, 0x53, 0x54, 0x00, 0x7A, 0x7A, 0x7A, 0x00, 0x4D, 0x49, 0x53, 0x54, 0x00, 0x00, -0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x2B, 0x30, 0x02, +0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x2B, 0x30, 0x02, 0x05, 0x32, 0x58, 0x00, 0x00, 0x00, 0x10, 0x4D, 0x61, 0x63, 0x71, 0x75, 0x61, 0x72, 0x69, 0x65, 0x20, 0x49, 0x73, 0x6C, 0x61, 0x6E, 0x64, @@ -8441,19 +8441,19 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x46, 0xEC, 0x63, 0xF0, 0x47, 0xEC, 0x35, 0x00, 0x48, 0xE7, 0xF5, 0x70, 0x49, 0xCC, 0x17, 0x00, 0x4A, 0xBE, 0x9C, 0xF0, 0x4B, 0xAB, 0xF9, 0x00, 0x4C, 0x8C, 0x09, 0xF0, 0x4D, 0x95, 0x15, 0x80, 0x4E, 0x87, 0x9B, 0x70, 0x4F, 0x74, 0xF7, 0x80, 0x50, 0x5E, 0x42, 0xF0, 0x51, 0x54, 0xD9, 0x80, -0x52, 0x6C, 0x49, 0x70, 0x53, 0x34, 0xBB, 0x80, 0x54, 0x4C, 0x2B, 0x70, 0x55, 0x14, 0x9D, 0x80, -0x56, 0x2C, 0x0D, 0x70, 0x56, 0xF4, 0x7F, 0x80, 0x58, 0x15, 0x29, 0xF0, 0x58, 0xD4, 0x61, 0x80, -0x59, 0xF5, 0x0B, 0xF0, 0x5A, 0xB4, 0x43, 0x80, 0x5B, 0xD4, 0xED, 0xF0, 0x5C, 0x9D, 0x60, 0x00, -0x5D, 0xB4, 0xCF, 0xF0, 0x5E, 0x7D, 0x42, 0x00, 0x5F, 0x94, 0xB1, 0xF0, 0x60, 0x5D, 0x24, 0x00, -0x61, 0x7D, 0xCE, 0x70, 0x62, 0x3D, 0x06, 0x00, 0x63, 0x5D, 0xB0, 0x70, 0x64, 0x1C, 0xE8, 0x00, -0x65, 0x3D, 0x92, 0x70, 0x66, 0x06, 0x04, 0x80, 0x67, 0x1D, 0x74, 0x70, 0x67, 0xE5, 0xE6, 0x80, -0x68, 0xFD, 0x56, 0x70, 0x69, 0xC5, 0xC8, 0x80, 0x6A, 0xDD, 0x38, 0x70, 0x6B, 0xA5, 0xAA, 0x80, -0x6C, 0xC6, 0x54, 0xF0, 0x6D, 0x85, 0x8C, 0x80, 0x6E, 0xA6, 0x36, 0xF0, 0x6F, 0x65, 0x6E, 0x80, -0x70, 0x86, 0x18, 0xF0, 0x71, 0x4E, 0x8B, 0x00, 0x72, 0x65, 0xFA, 0xF0, 0x73, 0x2E, 0x6D, 0x00, -0x74, 0x45, 0xDC, 0xF0, 0x75, 0x0E, 0x4F, 0x00, 0x76, 0x2E, 0xF9, 0x70, 0x76, 0xEE, 0x31, 0x00, -0x78, 0x0E, 0xDB, 0x70, 0x78, 0xCE, 0x13, 0x00, 0x79, 0xEE, 0xBD, 0x70, 0x7A, 0xAD, 0xF5, 0x00, -0x7B, 0xCE, 0x9F, 0x70, 0x7C, 0x97, 0x11, 0x80, 0x7D, 0xAE, 0x81, 0x70, 0x7E, 0x76, 0xF3, 0x80, -0x7F, 0x8E, 0x63, 0x70, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, +0x52, 0x50, 0x99, 0xF0, 0x53, 0x34, 0xBB, 0x80, 0x54, 0x30, 0x7B, 0xF0, 0x55, 0x14, 0x9D, 0x80, +0x56, 0x10, 0x5D, 0xF0, 0x56, 0xF4, 0x7F, 0x80, 0x57, 0xF0, 0x3F, 0xF0, 0x58, 0xD4, 0x61, 0x80, +0x59, 0xD9, 0x5C, 0x70, 0x5A, 0xB4, 0x43, 0x80, 0x5B, 0xB9, 0x3E, 0x70, 0x5C, 0x9D, 0x60, 0x00, +0x5D, 0x99, 0x20, 0x70, 0x5E, 0x7D, 0x42, 0x00, 0x5F, 0x79, 0x02, 0x70, 0x60, 0x5D, 0x24, 0x00, +0x61, 0x58, 0xE4, 0x70, 0x62, 0x3D, 0x06, 0x00, 0x63, 0x38, 0xC6, 0x70, 0x64, 0x1C, 0xE8, 0x00, +0x65, 0x21, 0xE2, 0xF0, 0x66, 0x06, 0x04, 0x80, 0x67, 0x01, 0xC4, 0xF0, 0x67, 0xE5, 0xE6, 0x80, +0x68, 0xE1, 0xA6, 0xF0, 0x69, 0xC5, 0xC8, 0x80, 0x6A, 0xC1, 0x88, 0xF0, 0x6B, 0xA5, 0xAA, 0x80, +0x6C, 0xA2, 0xBC, 0x70, 0x6D, 0x85, 0x8C, 0x80, 0x6E, 0x8A, 0x87, 0x70, 0x6F, 0x65, 0x6E, 0x80, +0x70, 0x6A, 0x69, 0x70, 0x71, 0x4E, 0x8B, 0x00, 0x72, 0x4A, 0x4B, 0x70, 0x73, 0x2E, 0x6D, 0x00, +0x74, 0x2A, 0x2D, 0x70, 0x75, 0x0E, 0x4F, 0x00, 0x76, 0x0A, 0x0F, 0x70, 0x76, 0xEE, 0x31, 0x00, +0x77, 0xE9, 0xF1, 0x70, 0x78, 0xCE, 0x13, 0x00, 0x79, 0xD3, 0x0D, 0xF0, 0x7A, 0xAD, 0xF5, 0x00, +0x7B, 0xB2, 0xEF, 0xF0, 0x7C, 0x97, 0x11, 0x80, 0x7D, 0x92, 0xD1, 0xF0, 0x7E, 0x76, 0xF3, 0x80, +0x7F, 0x72, 0xB3, 0xF0, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, @@ -8465,7 +8465,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x01, 0x02, 0x00, 0x00, 0x20, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x04, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x08, 0x00, 0x00, 0x38, 0x40, 0x01, 0x0C, 0x4A, 0x4D, 0x54, 0x00, 0x49, 0x44, 0x54, 0x00, 0x49, 0x53, 0x54, 0x00, 0x49, 0x44, 0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0xB9, 0xD2, 0x87, 0x01, 0x48, 0x67, 0xD4, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xB9, 0xCD, 0x1A, 0x01, 0x48, 0x6B, 0x85, 0x00, 0x00, 0x00, 0x00, /* Asia/Kabul */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -9310,19 +9310,19 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x46, 0xEC, 0x63, 0xF0, 0x47, 0xEC, 0x35, 0x00, 0x48, 0xE7, 0xF5, 0x70, 0x49, 0xCC, 0x17, 0x00, 0x4A, 0xBE, 0x9C, 0xF0, 0x4B, 0xAB, 0xF9, 0x00, 0x4C, 0x8C, 0x09, 0xF0, 0x4D, 0x95, 0x15, 0x80, 0x4E, 0x87, 0x9B, 0x70, 0x4F, 0x74, 0xF7, 0x80, 0x50, 0x5E, 0x42, 0xF0, 0x51, 0x54, 0xD9, 0x80, -0x52, 0x6C, 0x49, 0x70, 0x53, 0x34, 0xBB, 0x80, 0x54, 0x4C, 0x2B, 0x70, 0x55, 0x14, 0x9D, 0x80, -0x56, 0x2C, 0x0D, 0x70, 0x56, 0xF4, 0x7F, 0x80, 0x58, 0x15, 0x29, 0xF0, 0x58, 0xD4, 0x61, 0x80, -0x59, 0xF5, 0x0B, 0xF0, 0x5A, 0xB4, 0x43, 0x80, 0x5B, 0xD4, 0xED, 0xF0, 0x5C, 0x9D, 0x60, 0x00, -0x5D, 0xB4, 0xCF, 0xF0, 0x5E, 0x7D, 0x42, 0x00, 0x5F, 0x94, 0xB1, 0xF0, 0x60, 0x5D, 0x24, 0x00, -0x61, 0x7D, 0xCE, 0x70, 0x62, 0x3D, 0x06, 0x00, 0x63, 0x5D, 0xB0, 0x70, 0x64, 0x1C, 0xE8, 0x00, -0x65, 0x3D, 0x92, 0x70, 0x66, 0x06, 0x04, 0x80, 0x67, 0x1D, 0x74, 0x70, 0x67, 0xE5, 0xE6, 0x80, -0x68, 0xFD, 0x56, 0x70, 0x69, 0xC5, 0xC8, 0x80, 0x6A, 0xDD, 0x38, 0x70, 0x6B, 0xA5, 0xAA, 0x80, -0x6C, 0xC6, 0x54, 0xF0, 0x6D, 0x85, 0x8C, 0x80, 0x6E, 0xA6, 0x36, 0xF0, 0x6F, 0x65, 0x6E, 0x80, -0x70, 0x86, 0x18, 0xF0, 0x71, 0x4E, 0x8B, 0x00, 0x72, 0x65, 0xFA, 0xF0, 0x73, 0x2E, 0x6D, 0x00, -0x74, 0x45, 0xDC, 0xF0, 0x75, 0x0E, 0x4F, 0x00, 0x76, 0x2E, 0xF9, 0x70, 0x76, 0xEE, 0x31, 0x00, -0x78, 0x0E, 0xDB, 0x70, 0x78, 0xCE, 0x13, 0x00, 0x79, 0xEE, 0xBD, 0x70, 0x7A, 0xAD, 0xF5, 0x00, -0x7B, 0xCE, 0x9F, 0x70, 0x7C, 0x97, 0x11, 0x80, 0x7D, 0xAE, 0x81, 0x70, 0x7E, 0x76, 0xF3, 0x80, -0x7F, 0x8E, 0x63, 0x70, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, +0x52, 0x50, 0x99, 0xF0, 0x53, 0x34, 0xBB, 0x80, 0x54, 0x30, 0x7B, 0xF0, 0x55, 0x14, 0x9D, 0x80, +0x56, 0x10, 0x5D, 0xF0, 0x56, 0xF4, 0x7F, 0x80, 0x57, 0xF0, 0x3F, 0xF0, 0x58, 0xD4, 0x61, 0x80, +0x59, 0xD9, 0x5C, 0x70, 0x5A, 0xB4, 0x43, 0x80, 0x5B, 0xB9, 0x3E, 0x70, 0x5C, 0x9D, 0x60, 0x00, +0x5D, 0x99, 0x20, 0x70, 0x5E, 0x7D, 0x42, 0x00, 0x5F, 0x79, 0x02, 0x70, 0x60, 0x5D, 0x24, 0x00, +0x61, 0x58, 0xE4, 0x70, 0x62, 0x3D, 0x06, 0x00, 0x63, 0x38, 0xC6, 0x70, 0x64, 0x1C, 0xE8, 0x00, +0x65, 0x21, 0xE2, 0xF0, 0x66, 0x06, 0x04, 0x80, 0x67, 0x01, 0xC4, 0xF0, 0x67, 0xE5, 0xE6, 0x80, +0x68, 0xE1, 0xA6, 0xF0, 0x69, 0xC5, 0xC8, 0x80, 0x6A, 0xC1, 0x88, 0xF0, 0x6B, 0xA5, 0xAA, 0x80, +0x6C, 0xA2, 0xBC, 0x70, 0x6D, 0x85, 0x8C, 0x80, 0x6E, 0x8A, 0x87, 0x70, 0x6F, 0x65, 0x6E, 0x80, +0x70, 0x6A, 0x69, 0x70, 0x71, 0x4E, 0x8B, 0x00, 0x72, 0x4A, 0x4B, 0x70, 0x73, 0x2E, 0x6D, 0x00, +0x74, 0x2A, 0x2D, 0x70, 0x75, 0x0E, 0x4F, 0x00, 0x76, 0x0A, 0x0F, 0x70, 0x76, 0xEE, 0x31, 0x00, +0x77, 0xE9, 0xF1, 0x70, 0x78, 0xCE, 0x13, 0x00, 0x79, 0xD3, 0x0D, 0xF0, 0x7A, 0xAD, 0xF5, 0x00, +0x7B, 0xB2, 0xEF, 0xF0, 0x7C, 0x97, 0x11, 0x80, 0x7D, 0x92, 0xD1, 0xF0, 0x7E, 0x76, 0xF3, 0x80, +0x7F, 0x72, 0xB3, 0xF0, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, @@ -16249,19 +16249,19 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x46, 0xEC, 0x63, 0xF0, 0x47, 0xEC, 0x35, 0x00, 0x48, 0xE7, 0xF5, 0x70, 0x49, 0xCC, 0x17, 0x00, 0x4A, 0xBE, 0x9C, 0xF0, 0x4B, 0xAB, 0xF9, 0x00, 0x4C, 0x8C, 0x09, 0xF0, 0x4D, 0x95, 0x15, 0x80, 0x4E, 0x87, 0x9B, 0x70, 0x4F, 0x74, 0xF7, 0x80, 0x50, 0x5E, 0x42, 0xF0, 0x51, 0x54, 0xD9, 0x80, -0x52, 0x6C, 0x49, 0x70, 0x53, 0x34, 0xBB, 0x80, 0x54, 0x4C, 0x2B, 0x70, 0x55, 0x14, 0x9D, 0x80, -0x56, 0x2C, 0x0D, 0x70, 0x56, 0xF4, 0x7F, 0x80, 0x58, 0x15, 0x29, 0xF0, 0x58, 0xD4, 0x61, 0x80, -0x59, 0xF5, 0x0B, 0xF0, 0x5A, 0xB4, 0x43, 0x80, 0x5B, 0xD4, 0xED, 0xF0, 0x5C, 0x9D, 0x60, 0x00, -0x5D, 0xB4, 0xCF, 0xF0, 0x5E, 0x7D, 0x42, 0x00, 0x5F, 0x94, 0xB1, 0xF0, 0x60, 0x5D, 0x24, 0x00, -0x61, 0x7D, 0xCE, 0x70, 0x62, 0x3D, 0x06, 0x00, 0x63, 0x5D, 0xB0, 0x70, 0x64, 0x1C, 0xE8, 0x00, -0x65, 0x3D, 0x92, 0x70, 0x66, 0x06, 0x04, 0x80, 0x67, 0x1D, 0x74, 0x70, 0x67, 0xE5, 0xE6, 0x80, -0x68, 0xFD, 0x56, 0x70, 0x69, 0xC5, 0xC8, 0x80, 0x6A, 0xDD, 0x38, 0x70, 0x6B, 0xA5, 0xAA, 0x80, -0x6C, 0xC6, 0x54, 0xF0, 0x6D, 0x85, 0x8C, 0x80, 0x6E, 0xA6, 0x36, 0xF0, 0x6F, 0x65, 0x6E, 0x80, -0x70, 0x86, 0x18, 0xF0, 0x71, 0x4E, 0x8B, 0x00, 0x72, 0x65, 0xFA, 0xF0, 0x73, 0x2E, 0x6D, 0x00, -0x74, 0x45, 0xDC, 0xF0, 0x75, 0x0E, 0x4F, 0x00, 0x76, 0x2E, 0xF9, 0x70, 0x76, 0xEE, 0x31, 0x00, -0x78, 0x0E, 0xDB, 0x70, 0x78, 0xCE, 0x13, 0x00, 0x79, 0xEE, 0xBD, 0x70, 0x7A, 0xAD, 0xF5, 0x00, -0x7B, 0xCE, 0x9F, 0x70, 0x7C, 0x97, 0x11, 0x80, 0x7D, 0xAE, 0x81, 0x70, 0x7E, 0x76, 0xF3, 0x80, -0x7F, 0x8E, 0x63, 0x70, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, +0x52, 0x50, 0x99, 0xF0, 0x53, 0x34, 0xBB, 0x80, 0x54, 0x30, 0x7B, 0xF0, 0x55, 0x14, 0x9D, 0x80, +0x56, 0x10, 0x5D, 0xF0, 0x56, 0xF4, 0x7F, 0x80, 0x57, 0xF0, 0x3F, 0xF0, 0x58, 0xD4, 0x61, 0x80, +0x59, 0xD9, 0x5C, 0x70, 0x5A, 0xB4, 0x43, 0x80, 0x5B, 0xB9, 0x3E, 0x70, 0x5C, 0x9D, 0x60, 0x00, +0x5D, 0x99, 0x20, 0x70, 0x5E, 0x7D, 0x42, 0x00, 0x5F, 0x79, 0x02, 0x70, 0x60, 0x5D, 0x24, 0x00, +0x61, 0x58, 0xE4, 0x70, 0x62, 0x3D, 0x06, 0x00, 0x63, 0x38, 0xC6, 0x70, 0x64, 0x1C, 0xE8, 0x00, +0x65, 0x21, 0xE2, 0xF0, 0x66, 0x06, 0x04, 0x80, 0x67, 0x01, 0xC4, 0xF0, 0x67, 0xE5, 0xE6, 0x80, +0x68, 0xE1, 0xA6, 0xF0, 0x69, 0xC5, 0xC8, 0x80, 0x6A, 0xC1, 0x88, 0xF0, 0x6B, 0xA5, 0xAA, 0x80, +0x6C, 0xA2, 0xBC, 0x70, 0x6D, 0x85, 0x8C, 0x80, 0x6E, 0x8A, 0x87, 0x70, 0x6F, 0x65, 0x6E, 0x80, +0x70, 0x6A, 0x69, 0x70, 0x71, 0x4E, 0x8B, 0x00, 0x72, 0x4A, 0x4B, 0x70, 0x73, 0x2E, 0x6D, 0x00, +0x74, 0x2A, 0x2D, 0x70, 0x75, 0x0E, 0x4F, 0x00, 0x76, 0x0A, 0x0F, 0x70, 0x76, 0xEE, 0x31, 0x00, +0x77, 0xE9, 0xF1, 0x70, 0x78, 0xCE, 0x13, 0x00, 0x79, 0xD3, 0x0D, 0xF0, 0x7A, 0xAD, 0xF5, 0x00, +0x7B, 0xB2, 0xEF, 0xF0, 0x7C, 0x97, 0x11, 0x80, 0x7D, 0x92, 0xD1, 0xF0, 0x7E, 0x76, 0xF3, 0x80, +0x7F, 0x72, 0xB3, 0xF0, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, @@ -18410,4 +18410,4 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x00, 0x00, 0x55, 0x54, 0x43, 0x00, 0x00, 0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, }; -const timelib_tzdb timezonedb_builtin = { "2013.4", 579, timezonedb_idx_builtin, timelib_timezone_db_data_builtin }; +const timelib_tzdb timezonedb_builtin = { "2013.3", 579, timezonedb_idx_builtin, timelib_timezone_db_data_builtin }; diff --git a/ext/date/php_date.c b/ext/date/php_date.c index ede953bc9b48b..28ac86b119170 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -945,7 +945,7 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC) zval ztz; if (SUCCESS == zend_get_configuration_directive("date.timezone", sizeof("date.timezone"), &ztz) - && Z_TYPE(ztz) == IS_STRING && Z_STRSIZE(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) { + && Z_TYPE(ztz) == IS_STRING && Z_STRLEN(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) { return Z_STRVAL(ztz); } } else if (*DATEG(default_timezone)) { @@ -1038,10 +1038,10 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d) /* }}} */ /* {{{ date_format - (gm)date helper */ -static char *date_format(char *format, zend_str_size_int format_len, timelib_time *t, int localtime) +static char *date_format(char *format, int format_len, timelib_time *t, int localtime) { smart_str string = {0}; - zend_str_size i, length; + int i, length; char buffer[97]; timelib_time_offset *offset = NULL; timelib_sll isoweek, isoyear; @@ -1199,11 +1199,11 @@ static char *date_format(char *format, zend_str_size_int format_len, timelib_tim static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime) { char *format; - zend_str_size format_len; + int format_len; long ts; char *string; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &format, &format_len, &ts) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) { RETURN_FALSE; } if (ZEND_NUM_ARGS() == 1) { @@ -1216,7 +1216,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime) } /* }}} */ -PHPAPI char *php_format_date(char *format, zend_str_size_int format_len, time_t ts, int localtime TSRMLS_DC) /* {{{ */ +PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localtime TSRMLS_DC) /* {{{ */ { timelib_time *t; timelib_tzinfo *tzi; @@ -1358,11 +1358,11 @@ PHP_FUNCTION(gmdate) PHP_FUNCTION(idate) { char *format; - zend_str_size_int format_len; + int format_len; long ts = 0; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &format, &format_len, &ts) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) { RETURN_FALSE; } @@ -1396,7 +1396,7 @@ PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb) } /* }}} */ -/* {{{ php_parse_date: Backwards compatibility function */ +/* {{{ php_parse_date: Backwards compability function */ PHPAPI signed long php_parse_date(char *string, signed long *now) { timelib_time *parsed_time; @@ -1425,8 +1425,7 @@ PHPAPI signed long php_parse_date(char *string, signed long *now) PHP_FUNCTION(strtotime) { char *times, *initial_ts; - zend_str_size time_len; - int error1, error2; + int time_len, error1, error2; struct timelib_error_container *error; long preset_ts = 0, ts; @@ -1435,7 +1434,7 @@ PHP_FUNCTION(strtotime) tzi = get_timezone_info(TSRMLS_C); - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "Sl", ×, &time_len, &preset_ts) != FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sl", ×, &time_len, &preset_ts) != FAILURE) { /* We have an initial timestamp */ now = timelib_time_ctor(); @@ -1448,7 +1447,7 @@ PHP_FUNCTION(strtotime) timelib_unixtime2local(now, t->sse); timelib_time_dtor(t); efree(initial_ts); - } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", ×, &time_len, &preset_ts) != FAILURE) { + } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", ×, &time_len, &preset_ts) != FAILURE) { /* We have no initial timestamp */ now = timelib_time_ctor(); now->tz_info = tzi; @@ -1611,7 +1610,7 @@ PHP_FUNCTION(checkdate) PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) { char *format, *buf; - zend_str_size format_len; + int format_len; long timestamp = 0; struct tm ta; int max_reallocs = 5; @@ -1622,7 +1621,7 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) timestamp = (long) time(NULL); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &format, &format_len, ×tamp) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, ×tamp) == FAILURE) { RETURN_FALSE; } @@ -1679,13 +1678,6 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) break; } } -#if defined(PHP_WIN32) && _MSC_VER >= 1700 - /* VS2012 strftime() returns number of characters, not bytes. - See VC++11 bug id 766205. */ - if (real_len > 0) { - real_len = strlen(buf); - } -#endif timelib_time_dtor(ts); if (!gmt) { @@ -2534,7 +2526,7 @@ static void update_errors_warnings(timelib_error_container *last_errors TSRMLS_D DATEG(last_errors) = last_errors; } -PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, zend_str_size_int time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC) +PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC) { timelib_time *now; timelib_tzinfo *tzi = NULL; @@ -2623,9 +2615,9 @@ PHP_FUNCTION(date_create) { zval *timezone_object = NULL; char *time_str = NULL; - zend_str_size time_str_len = 0; + int time_str_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|SO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { RETURN_FALSE; } @@ -2643,9 +2635,9 @@ PHP_FUNCTION(date_create_immutable) { zval *timezone_object = NULL; char *time_str = NULL; - zend_str_size time_str_len = 0; + int time_str_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|SO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { RETURN_FALSE; } @@ -2663,9 +2655,9 @@ PHP_FUNCTION(date_create_from_format) { zval *timezone_object = NULL; char *time_str = NULL, *format_str = NULL; - zend_str_size time_str_len = 0, format_str_len = 0; + int time_str_len = 0, format_str_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { RETURN_FALSE; } @@ -2683,9 +2675,9 @@ PHP_FUNCTION(date_create_immutable_from_format) { zval *timezone_object = NULL; char *time_str = NULL, *format_str = NULL; - zend_str_size time_str_len = 0, format_str_len = 0; + int time_str_len = 0, format_str_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { RETURN_FALSE; } @@ -2703,11 +2695,11 @@ PHP_METHOD(DateTime, __construct) { zval *timezone_object = NULL; char *time_str = NULL; - zend_str_size time_str_len = 0; + int time_str_len = 0; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|SO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC); } zend_restore_error_handling(&error_handling TSRMLS_CC); @@ -2721,11 +2713,11 @@ PHP_METHOD(DateTimeImmutable, __construct) { zval *timezone_object = NULL; char *time_str = NULL; - zend_str_size time_str_len = 0; + int time_str_len = 0; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|SO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC); } zend_restore_error_handling(&error_handling TSRMLS_CC); @@ -2751,10 +2743,10 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat switch (Z_LVAL_PP(z_timezone_type)) { case TIMELIB_ZONETYPE_OFFSET: case TIMELIB_ZONETYPE_ABBR: { - char *tmp = emalloc(Z_STRSIZE_PP(z_date) + Z_STRSIZE_PP(z_timezone) + 2); + char *tmp = emalloc(Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2); int ret; - snprintf(tmp, Z_STRSIZE_PP(z_date) + Z_STRSIZE_PP(z_timezone) + 2, "%s %s", Z_STRVAL_PP(z_date), Z_STRVAL_PP(z_timezone)); - ret = php_date_initialize(*dateobj, tmp, Z_STRSIZE_PP(z_date) + Z_STRSIZE_PP(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC); + snprintf(tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2, "%s %s", Z_STRVAL_PP(z_date), Z_STRVAL_PP(z_timezone)); + ret = php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC); efree(tmp); return 1 == ret; } @@ -2771,7 +2763,7 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat tzobj->tzi.tz = tzi; tzobj->initialized = 1; - ret = php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRSIZE_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC); + ret = php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC); zval_ptr_dtor(&tmp_obj); return 1 == ret; } @@ -2962,11 +2954,11 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time * PHP_FUNCTION(date_parse) { char *date; - zend_str_size date_len; + int date_len; struct timelib_error_container *error; timelib_time *parsed_time; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &date, &date_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &date, &date_len) == FAILURE) { RETURN_FALSE; } @@ -2981,11 +2973,11 @@ PHP_FUNCTION(date_parse) PHP_FUNCTION(date_parse_from_format) { char *date, *format; - zend_str_size date_len, format_len; + int date_len, format_len; struct timelib_error_container *error; timelib_time *parsed_time; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &format, &format_len, &date, &date_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &format, &format_len, &date, &date_len) == FAILURE) { RETURN_FALSE; } @@ -3002,9 +2994,9 @@ PHP_FUNCTION(date_format) zval *object; php_date_obj *dateobj; char *format; - zend_str_size format_len; + int format_len; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OS", &object, date_ce_interface, &format, &format_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_interface, &format, &format_len) == FAILURE) { RETURN_FALSE; } dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC); @@ -3013,7 +3005,7 @@ PHP_FUNCTION(date_format) } /* }}} */ -static int php_date_modify(zval *object, char *modify, zend_str_size_int modify_len TSRMLS_DC) +static int php_date_modify(zval *object, char *modify, int modify_len TSRMLS_DC) { php_date_obj *dateobj; timelib_time *tmp_time; @@ -3082,9 +3074,9 @@ PHP_FUNCTION(date_modify) { zval *object; char *modify; - zend_str_size modify_len; + int modify_len; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OS", &object, date_ce_date, &modify, &modify_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_date, &modify, &modify_len) == FAILURE) { RETURN_FALSE; } @@ -3102,9 +3094,9 @@ PHP_METHOD(DateTimeImmutable, modify) { zval *object, *new_object; char *modify; - zend_str_size modify_len; + int modify_len; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OS", &object, date_ce_immutable, &modify, &modify_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_immutable, &modify, &modify_len) == FAILURE) { RETURN_FALSE; } @@ -3655,11 +3647,11 @@ static int timezone_initialize(timelib_tzinfo **tzi, /*const*/ char *tz TSRMLS_D PHP_FUNCTION(timezone_open) { char *tz; - zend_str_size tz_len; + int tz_len; timelib_tzinfo *tzi = NULL; php_timezone_obj *tzobj; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &tz, &tz_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len) == FAILURE) { RETURN_FALSE; } if (SUCCESS != timezone_initialize(&tzi, tz TSRMLS_CC)) { @@ -3678,13 +3670,13 @@ PHP_FUNCTION(timezone_open) PHP_METHOD(DateTimeZone, __construct) { char *tz; - zend_str_size tz_len; + int tz_len; timelib_tzinfo *tzi = NULL; php_timezone_obj *tzobj; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &tz, &tz_len)) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len)) { if (SUCCESS == timezone_initialize(&tzi, tz TSRMLS_CC)) { tzobj = zend_object_store_get_object(getThis() TSRMLS_CC); tzobj->type = TIMELIB_ZONETYPE_ID; @@ -3711,8 +3703,8 @@ static int php_date_timezone_initialize_from_hash(zval **return_value, php_timez case TIMELIB_ZONETYPE_OFFSET: { char *offset, *offset_start; - offset = emalloc(sizeof(char) * (Z_STRSIZE_PP(z_timezone) + 1)); - memmove(offset, Z_STRVAL_PP(z_timezone), Z_STRSIZE_PP(z_timezone)+1); + offset = emalloc(sizeof(char) * (Z_STRLEN_PP(z_timezone) + 1)); + memmove(offset, Z_STRVAL_PP(z_timezone), Z_STRLEN_PP(z_timezone)+1); offset_start = offset; ++offset; @@ -3821,11 +3813,11 @@ PHP_FUNCTION(timezone_name_from_abbr) { char *abbr; char *tzid; - zend_str_size abbr_len; + int abbr_len; long gmtoffset = -1; long isdst = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ll", &abbr, &abbr_len, &gmtoffset, &isdst) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &abbr, &abbr_len, &gmtoffset, &isdst) == FAILURE) { RETURN_FALSE; } tzid = timelib_timezone_id_from_abbr(abbr, gmtoffset, isdst); @@ -3979,7 +3971,7 @@ PHP_FUNCTION(timezone_location_get) } /* }}} */ -static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *format, zend_str_size_int format_length TSRMLS_DC) +static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *format, int format_length TSRMLS_DC) { timelib_time *b = NULL, *e = NULL; timelib_rel_time *p = NULL; @@ -4139,13 +4131,13 @@ void date_interval_write_property(zval *object, zval *member, zval *value, const PHP_METHOD(DateInterval, __construct) { char *interval_string = NULL; - zend_str_size interval_string_length; + int interval_string_length; php_interval_obj *diobj; timelib_rel_time *reltime; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &interval_string, &interval_string_length) == SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &interval_string, &interval_string_length) == SUCCESS) { if (date_interval_initialize(&reltime, interval_string, interval_string_length TSRMLS_CC) == SUCCESS) { diobj = zend_object_store_get_object(getThis() TSRMLS_CC); diobj->diff = reltime; @@ -4246,12 +4238,12 @@ PHP_METHOD(DateInterval, __wakeup) PHP_FUNCTION(date_interval_create_from_date_string) { char *time_str = NULL; - zend_str_size time_str_len = 0; + int time_str_len = 0; timelib_time *time; timelib_error_container *err = NULL; php_interval_obj *diobj; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &time_str, &time_str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &time_str, &time_str_len) == FAILURE) { RETURN_FALSE; } @@ -4267,11 +4259,10 @@ PHP_FUNCTION(date_interval_create_from_date_string) /* }}} */ /* {{{ date_interval_format - */ -static char *date_interval_format(char *format, zend_str_size_int format_len, timelib_rel_time *t) +static char *date_interval_format(char *format, int format_len, timelib_rel_time *t) { smart_str string = {0}; - zend_str_size i, length; - int have_format_spec = 0; + int i, length, have_format_spec = 0; char buffer[33]; if (!format_len) { @@ -4337,9 +4328,9 @@ PHP_FUNCTION(date_interval_format) zval *object; php_interval_obj *diobj; char *format; - zend_str_size format_len; + int format_len; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OS", &object, date_ce_interval, &format, &format_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_interval, &format, &format_len) == FAILURE) { RETURN_FALSE; } diobj = (php_interval_obj *) zend_object_store_get_object(object TSRMLS_CC); @@ -4349,7 +4340,7 @@ PHP_FUNCTION(date_interval_format) } /* }}} */ -static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_rel_time **d, long *recurrences, /*const*/ char *format, zend_str_size_int format_length TSRMLS_DC) +static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_rel_time **d, long *recurrences, /*const*/ char *format, int format_length TSRMLS_DC) { timelib_time *b = NULL, *e = NULL; timelib_rel_time *p = NULL; @@ -4384,14 +4375,14 @@ PHP_METHOD(DatePeriod, __construct) zval *start, *end = NULL, *interval; long recurrences = 0, options = 0; char *isostr = NULL; - zend_str_size isostr_len = 0; + int isostr_len = 0; timelib_time *clone; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOl|l", &start, date_ce_interface, &interval, date_ce_interval, &recurrences, &options) == FAILURE) { if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|l", &start, date_ce_interface, &interval, date_ce_interval, &end, date_ce_date, &options) == FAILURE) { - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &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."); zend_restore_error_handling(&error_handling TSRMLS_CC); return; @@ -4487,9 +4478,9 @@ PHP_FUNCTION(timezone_identifiers_list) int i, item_count; long what = PHP_DATE_TIMEZONE_GROUP_ALL; char *option = NULL; - zend_str_size option_len = 0; + int option_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lS", &what, &option, &option_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ls", &what, &option, &option_len) == FAILURE) { RETURN_FALSE; } @@ -4570,9 +4561,9 @@ PHP_FUNCTION(timezone_abbreviations_list) PHP_FUNCTION(date_default_timezone_set) { char *zone; - zend_str_size zone_len; + int zone_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &zone, &zone_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zone, &zone_len) == FAILURE) { RETURN_FALSE; } if (!timelib_timezone_id_is_valid(zone, DATE_TIMEZONEDB)) { diff --git a/ext/date/php_date.h b/ext/date/php_date.h index 11a72b58203b9..725590136c706 100644 --- a/ext/date/php_date.h +++ b/ext/date/php_date.h @@ -182,7 +182,7 @@ ZEND_END_MODULE_GLOBALS(date) #define DATEG(v) (date_globals.v) #endif -/* Backwards compatibility wrapper */ +/* Backwards compability wrapper */ PHPAPI signed long php_parse_date(char *string, signed long *now); PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt); PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC); @@ -190,7 +190,7 @@ PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC); #define _php_strftime php_strftime PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm); #endif -PHPAPI char *php_format_date(char *format, zend_str_size_int format_len, time_t ts, int localtime TSRMLS_DC); +PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localtime TSRMLS_DC); /* Mechanism to set new TZ database */ PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb); @@ -202,7 +202,7 @@ PHPAPI zend_class_entry *php_date_get_timezone_ce(void); /* Functions for creating DateTime objects, and initializing them from a string */ PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC); -PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, zend_str_size_int time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC); +PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC); #endif /* PHP_DATE_H */ diff --git a/ext/date/tests/bug55397.phpt b/ext/date/tests/bug55397.phpt index 7c9bbb01c1f38..13778a00b2c98 100644 --- a/ext/date/tests/bug55397.phpt +++ b/ext/date/tests/bug55397.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #55397 (comparison of incomplete DateTime causes SIGSEGV) +Bug #55397 (comparsion of incomplete DateTime causes SIGSEGV) --INI-- --FILE-- ---FILE-- - -===DONE=== ---EXPECT-- -90 85 97 6a 93 fa -6 -===DONE=== diff --git a/ext/dba/config.m4 b/ext/dba/config.m4 index 5442bb1415149..4b123518b46a3 100644 --- a/ext/dba/config.m4 +++ b/ext/dba/config.m4 @@ -557,10 +557,10 @@ PHP_ARG_WITH(cdb,, [ --without-cdb[=DIR] DBA: CDB support (bundled)], $php_dba_enable, no) PHP_ARG_ENABLE(inifile,, -[ --disable-inifile DBA: INI support (bundled)], $php_dba_enable, no) +[ --disable-inifile DBA: INI support (bundled)], $php_dba_enable, no) PHP_ARG_ENABLE(flatfile,, -[ --disable-flatfile DBA: FlatFile support (bundled)], $php_dba_enable, no) +[ --disable-flatfile DBA: FlatFile support (bundled)], $php_dba_enable, no) # CDB if test "$PHP_CDB" = "yes"; then diff --git a/ext/dba/dba.c b/ext/dba/dba.c index 8005101de34b1..5273c05fabba1 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -888,7 +888,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) RETURN_FALSE; } if (hptr->flags & (DBA_NO_APPEND|DBA_CAST_AS_FD)) { - /* Needed because some systems do not allow to write to the original + /* Needed becasue some systems do not allow to write to the original * file contents with O_APPEND being set. */ if (SUCCESS != php_stream_cast(info->fp, PHP_STREAM_AS_FD, (void*)&info->fd, 1)) { diff --git a/ext/dba/tests/dba_gdbm.phpt b/ext/dba/tests/dba_gdbm.phpt index d8fde4b6284b1..e68e8b7409024 100644 --- a/ext/dba/tests/dba_gdbm.phpt +++ b/ext/dba/tests/dba_gdbm.phpt @@ -12,7 +12,7 @@ DBA GDBM handler test $lock_flag = ''; // lock in library require_once dirname(__FILE__) .'/dba_handler.inc'; - // Read during write is system dependent. Important is that there is no deadlock + // Read during write is system dependant. Important is that there is no deadlock ?> ===DONE=== --EXPECTF-- diff --git a/ext/dom/document.c b/ext/dom/document.c index efe6d9070fb7c..d17c7cbd55f1d 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -1973,15 +1973,14 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type xmlDoc *docp; dom_object *intern; char *source = NULL, *valid_file = NULL; - int source_len = 0, valid_opts = 0; - long flags = 0; + int source_len = 0; xmlSchemaParserCtxtPtr parser; xmlSchemaPtr sptr; xmlSchemaValidCtxtPtr vptr; int is_valid; char resolved_path[MAXPATHLEN + 1]; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|l", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &source, &source_len) == FAILURE) { return; } @@ -2030,13 +2029,6 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type RETURN_FALSE; } -#if LIBXML_VERSION >= 20614 - if (flags & XML_SCHEMA_VAL_VC_I_CREATE) { - valid_opts |= XML_SCHEMA_VAL_VC_I_CREATE; - } -#endif - - xmlSchemaSetValidOptions(vptr, valid_opts); xmlSchemaSetValidErrors(vptr, php_libxml_error_handler, php_libxml_error_handler, vptr); is_valid = xmlSchemaValidateDoc(vptr, docp); xmlSchemaFree(sptr); @@ -2050,14 +2042,14 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type } /* }}} */ -/* {{{ proto boolean dom_document_schema_validate_file(string filename, int flags); */ +/* {{{ proto boolean dom_document_schema_validate_file(string filename); */ PHP_FUNCTION(dom_document_schema_validate_file) { _dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE); } /* }}} end dom_document_schema_validate_file */ -/* {{{ proto boolean dom_document_schema_validate(string source, int flags); */ +/* {{{ proto boolean dom_document_schema_validate(string source); */ PHP_FUNCTION(dom_document_schema_validate_xml) { _dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING); diff --git a/ext/dom/tests/DOMDocument_loadXML_basic.phpt b/ext/dom/tests/DOMDocument_loadXML_basic.phpt deleted file mode 100644 index 569593c00758d..0000000000000 --- a/ext/dom/tests/DOMDocument_loadXML_basic.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Test DOMDocument::loadXML() basic behavior ---DESCRIPTION-- -This test verifies the basic behaviour of the method -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/book.xml -LOAD_OPTIONS=0 -EXPECTED_RESULT=1 ---FILE_EXTERNAL-- -domdocumentloadxml_test_method.php ---EXPECT-- diff --git a/ext/dom/tests/DOMDocument_loadXML_error1.phpt b/ext/dom/tests/DOMDocument_loadXML_error1.phpt deleted file mode 100644 index 52d44ea291dae..0000000000000 --- a/ext/dom/tests/DOMDocument_loadXML_error1.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -Test DOMDocument::loadXML() detects not-well formed XML ---DESCRIPTION-- -This test verifies the method detects an opening and ending tag mismatch -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/not_well_formed.xml -LOAD_OPTIONS=0 -EXPECTED_RESULT=0 ---FILE_EXTERNAL-- -domdocumentloadxml_test_method.php ---EXPECTF-- -Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: title line 5 and book %s - -Warning: DOMDocument::load%r(XML){0,1}%r(): expected '>' %s - -Warning: DOMDocument::load%r(XML){0,1}%r(): Premature end of data in tag books %s diff --git a/ext/dom/tests/DOMDocument_loadXML_error2.phpt b/ext/dom/tests/DOMDocument_loadXML_error2.phpt deleted file mode 100644 index 6ac4193dafd40..0000000000000 --- a/ext/dom/tests/DOMDocument_loadXML_error2.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -Test DOMDocument::loadXML() detects not-well formed XML ---DESCRIPTION-- -This test verifies the method detects attributes values not closed between " or ' -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/not_well_formed2.xml -LOAD_OPTIONS=0 -EXPECTED_RESULT=0 ---FILE_EXTERNAL-- -domdocumentloadxml_test_method.php ---EXPECTF-- -Warning: DOMDocument::load%r(XML){0,1}%r(): AttValue: " or ' expected %s - -Warning: DOMDocument::load%r(XML){0,1}%r(): attributes construct error %s - -Warning: DOMDocument::load%r(XML){0,1}%r(): Couldn't find end of Start Tag book %s - -Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: books %s - -Warning: DOMDocument::load%r(XML){0,1}%r(): Extra content at the end of the document %s diff --git a/ext/dom/tests/DOMDocument_loadXML_error3.phpt b/ext/dom/tests/DOMDocument_loadXML_error3.phpt deleted file mode 100644 index 07f7ca77383bc..0000000000000 --- a/ext/dom/tests/DOMDocument_loadXML_error3.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Test DOMDocument::loadXML() detects not-well formed XML ---DESCRIPTION-- -This test verifies the method detects a typo in tag names -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/not_well_formed3.xml -LOAD_OPTIONS=0 -EXPECTED_RESULT=0 ---FILE_EXTERNAL-- -domdocumentloadxml_test_method.php ---EXPECTF-- -Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: boOk line 8 and book %s diff --git a/ext/dom/tests/DOMDocument_loadXML_error4.phpt b/ext/dom/tests/DOMDocument_loadXML_error4.phpt deleted file mode 100644 index e35d3dcea5c83..0000000000000 --- a/ext/dom/tests/DOMDocument_loadXML_error4.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Test DOMDocument::loadXML() detects not-well formed XML ---DESCRIPTION-- -This test verifies the method detects an unsupported xml version -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/not_well_formed4.xml -LOAD_OPTIONS=0 -EXPECTED_RESULT=0 ---FILE_EXTERNAL-- -domdocumentloadxml_test_method.php ---EXPECTF-- -Warning: DOMDocument::load%r(XML){0,1}%r(): Unsupported version '3.1' %s diff --git a/ext/dom/tests/DOMDocument_loadXML_error5.phpt b/ext/dom/tests/DOMDocument_loadXML_error5.phpt deleted file mode 100644 index a4aa1858f58cc..0000000000000 --- a/ext/dom/tests/DOMDocument_loadXML_error5.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Test DOMDocument::loadXML() detects not-well formed XML ---DESCRIPTION-- -This test verifies the method detects extra content at the end of the document -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/not_well_formed5.xml -LOAD_OPTIONS=0 -EXPECTED_RESULT=0 ---FILE_EXTERNAL-- -domdocumentloadxml_test_method.php ---EXPECTF-- -Warning: DOMDocument::load%r(XML){0,1}%r(): Extra content at the end of the document %s diff --git a/ext/dom/tests/DOMDocument_loadXML_variation1.phpt b/ext/dom/tests/DOMDocument_loadXML_variation1.phpt deleted file mode 100644 index 558137526f27e..0000000000000 --- a/ext/dom/tests/DOMDocument_loadXML_variation1.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Test DOMDocument::loadXML() with LIBXML_DTDLOAD option ---DESCRIPTION-- -This test verifies the right behaviour of the LIBXML_DTDLOAD constant -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/book_with_dtd2.xml -LOAD_OPTIONS=LIBXML_DTDLOAD -EXPECTED_RESULT=1 ---FILE_EXTERNAL-- -domdocumentloadxml_test_method.php ---EXPECT-- diff --git a/ext/dom/tests/DOMDocument_loadXML_variation2.phpt b/ext/dom/tests/DOMDocument_loadXML_variation2.phpt deleted file mode 100644 index 71f638efc142d..0000000000000 --- a/ext/dom/tests/DOMDocument_loadXML_variation2.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Test DOMDocument::loadXML() with LIBXML_DTDVALID option ---DESCRIPTION-- -This test verifies the right behaviour of the LIBXML_DTDVALID constant -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/wrong_book_with_dtd2.xml -LOAD_OPTIONS=LIBXML_DTDVALID -EXPECTED_RESULT=1 ---FILE_EXTERNAL-- -domdocumentloadxml_test_method.php ---EXPECTF-- -Warning: DOMDocument::load%r(XML){0,1}%r(): Element book content does not follow the DTD, expecting (title , author), got (title author author ) %s diff --git a/ext/dom/tests/DOMDocument_loadXML_variation3.phpt b/ext/dom/tests/DOMDocument_loadXML_variation3.phpt deleted file mode 100644 index 8e61ec4dbcc5d..0000000000000 --- a/ext/dom/tests/DOMDocument_loadXML_variation3.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Test DOMDocument::loadXML() with LIBXML_DTDVALID and LIBXML_NOERROR options ---DESCRIPTION-- -This test vrifies the right behaviour of the LIBXML_NOERROR constant -which avoids the display of the warning message -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/wrong_book_with_dtd.xml -LOAD_OPTIONS=LIBXML_DTDVALID | LIBXML_NOERROR -EXPECTED_RESULT=1 ---FILE_EXTERNAL-- -domdocumentloadxml_test_method.php ---EXPECT-- diff --git a/ext/dom/tests/DOMDocument_loadXML_variation4.phpt b/ext/dom/tests/DOMDocument_loadXML_variation4.phpt deleted file mode 100644 index 4f1ea37c1924f..0000000000000 --- a/ext/dom/tests/DOMDocument_loadXML_variation4.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -Test DOMDocument::loadXML() with LIBXML_DTDATTR, LIBXML_NOCDATA, LIBXML_NOENT, LIBXML_NOBLANKS ---DESCRIPTION-- -This test verifies the right behaviour of the following constants: -LIBXML_DTDATTR, LIBXML_NOCDATA, LIBXML_NOENT and LIBXML_NOBLANKS -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/book_with_dtd2.xml -LOAD_OPTIONS=LIBXML_DTDATTR|LIBXML_NOCDATA|LIBXML_NOENT|LIBXML_NOBLANKS -EXPECTED_RESULT=1 ---FILE_EXTERNAL-- -domdocumentloadxml_test_method_savexml.php ---EXPECT-- - - - - - - - -]> -The Grapes of WrathJohn SteinbeckThe PearlJohn Steinbeckentity is only for test purposesdata for test diff --git a/ext/dom/tests/DOMDocument_load_basic.phpt b/ext/dom/tests/DOMDocument_load_basic.phpt deleted file mode 100644 index 6d70ed4522206..0000000000000 --- a/ext/dom/tests/DOMDocument_load_basic.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Test DOMDocument::load() basic behavior ---DESCRIPTION-- -This test verifies the basic behaviour of the method -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/book.xml -LOAD_OPTIONS=0 -EXPECTED_RESULT=1 ---FILE_EXTERNAL-- -domdocumentload_test_method.php ---EXPECT-- diff --git a/ext/dom/tests/DOMDocument_load_error1.phpt b/ext/dom/tests/DOMDocument_load_error1.phpt deleted file mode 100644 index 2ac3f50979c64..0000000000000 --- a/ext/dom/tests/DOMDocument_load_error1.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -Test DOMDocument::load() detects not-well formed XML ---DESCRIPTION-- -This test verifies the method detects an opening and ending tag mismatch -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/not_well_formed.xml -LOAD_OPTIONS=0 -EXPECTED_RESULT=0 ---FILE_EXTERNAL-- -domdocumentload_test_method.php ---EXPECTF-- -Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: title line 5 and book %s - -Warning: DOMDocument::load%r(XML){0,1}%r(): expected '>' %s - -Warning: DOMDocument::load%r(XML){0,1}%r(): Premature end of data in tag books %s diff --git a/ext/dom/tests/DOMDocument_load_error2.phpt b/ext/dom/tests/DOMDocument_load_error2.phpt deleted file mode 100644 index 23a5e4827d557..0000000000000 --- a/ext/dom/tests/DOMDocument_load_error2.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -Test DOMDocument::load() detects not-well formed XML ---DESCRIPTION-- -This test verifies the method detects attributes values not closed between " or ' -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/not_well_formed2.xml -LOAD_OPTIONS=0 -EXPECTED_RESULT=0 ---FILE_EXTERNAL-- -domdocumentload_test_method.php ---EXPECTF-- -Warning: DOMDocument::load%r(XML){0,1}%r(): AttValue: " or ' expected %s - -Warning: DOMDocument::load%r(XML){0,1}%r(): attributes construct error %s - -Warning: DOMDocument::load%r(XML){0,1}%r(): Couldn't find end of Start Tag book %s - -Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: books %s - -Warning: DOMDocument::load%r(XML){0,1}%r(): Extra content at the end of the document %s diff --git a/ext/dom/tests/DOMDocument_load_error3.phpt b/ext/dom/tests/DOMDocument_load_error3.phpt deleted file mode 100644 index b9ac49c466707..0000000000000 --- a/ext/dom/tests/DOMDocument_load_error3.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Test DOMDocument::load() detects not-well formed XML ---DESCRIPTION-- -This test verifies the method detects and opening and ending tag mismatch -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/not_well_formed3.xml -LOAD_OPTIONS=0 -EXPECTED_RESULT=0 ---FILE_EXTERNAL-- -domdocumentload_test_method.php ---EXPECTF-- -Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: boOk line 8 and book %s diff --git a/ext/dom/tests/DOMDocument_load_error4.phpt b/ext/dom/tests/DOMDocument_load_error4.phpt deleted file mode 100644 index ca9ed79a3e847..0000000000000 --- a/ext/dom/tests/DOMDocument_load_error4.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Test DOMDocument::load() detects not-well formed XML ---DESCRIPTION-- -This test verifies the method detects an unsupported xml version -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/not_well_formed4.xml -LOAD_OPTIONS=0 -EXPECTED_RESULT=0 ---FILE_EXTERNAL-- -domdocumentload_test_method.php ---EXPECTF-- -Warning: DOMDocument::load%r(XML){0,1}%r(): Unsupported version '3.1' %s diff --git a/ext/dom/tests/DOMDocument_load_error5.phpt b/ext/dom/tests/DOMDocument_load_error5.phpt deleted file mode 100644 index a374f9474d147..0000000000000 --- a/ext/dom/tests/DOMDocument_load_error5.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Test DOMDocument::load() detects not-well formed XML ---DESCRIPTION-- -This test verifies the method detects extra content at the end of the document -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/not_well_formed5.xml -LOAD_OPTIONS=0 -EXPECTED_RESULT=0 ---FILE_EXTERNAL-- -domdocumentload_test_method.php ---EXPECTF-- -Warning: DOMDocument::load%r(XML){0,1}%r(): Extra content at the end of the document %s diff --git a/ext/dom/tests/DOMDocument_load_variation1.phpt b/ext/dom/tests/DOMDocument_load_variation1.phpt deleted file mode 100644 index b2b99e74c77ab..0000000000000 --- a/ext/dom/tests/DOMDocument_load_variation1.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Test DOMDocument::load() with LIBXML_DTDLOAD option ---DESCRIPTION-- -This test verifies the right behaviour of the LIBXML_DTDLOAD constant -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/book_with_dtd.xml -LOAD_OPTIONS=LIBXML_DTDLOAD -EXPECTED_RESULT=1 ---FILE_EXTERNAL-- -domdocumentload_test_method.php ---EXPECT-- diff --git a/ext/dom/tests/DOMDocument_load_variation2.phpt b/ext/dom/tests/DOMDocument_load_variation2.phpt deleted file mode 100644 index c8460e55eb2ea..0000000000000 --- a/ext/dom/tests/DOMDocument_load_variation2.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Test DOMDocument::load() with LIBXML_DTDVALID option ---DESCRIPTION-- -This test verifies the right behaviour of the LIBXML_DTDVALID constant -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/wrong_book_with_dtd.xml -LOAD_OPTIONS=LIBXML_DTDVALID -EXPECTED_RESULT=1 ---FILE_EXTERNAL-- -domdocumentload_test_method.php ---EXPECTF-- -Warning: DOMDocument::load%r(XML){0,1}%r(): Element book content does not follow the DTD, expecting (title , author), got (title author author ) %s diff --git a/ext/dom/tests/DOMDocument_load_variation3.phpt b/ext/dom/tests/DOMDocument_load_variation3.phpt deleted file mode 100644 index 77801d475e0bd..0000000000000 --- a/ext/dom/tests/DOMDocument_load_variation3.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Test DOMDocument::load() with LIBXML_DTDVALID and LIBXML_NOERROR options ---DESCRIPTION-- -This test vrifies the right behaviour of the LIBXML_NOERROR constant -which avoids the display of the warning message -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/wrong_book_with_dtd.xml -LOAD_OPTIONS=LIBXML_DTDVALID | LIBXML_NOERROR -EXPECTED_RESULT=1 ---FILE_EXTERNAL-- -domdocumentload_test_method.php ---EXPECT-- diff --git a/ext/dom/tests/DOMDocument_load_variation4.phpt b/ext/dom/tests/DOMDocument_load_variation4.phpt deleted file mode 100644 index 3bf7ccc04d85c..0000000000000 --- a/ext/dom/tests/DOMDocument_load_variation4.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Test DOMDocument::load() with LIBXML_DTDATTR, LIBXML_NOCDATA, LIBXML_NOENT, LIBXML_NOBLANKS ---DESCRIPTION-- -This test verifies the right behaviour of the following constants: -LIBXML_DTDATTR, LIBXML_NOCDATA, LIBXML_NOENT and LIBXML_NOBLANKS -Environment variables used in the test: -- XML_FILE: the xml file to load -- LOAD_OPTIONS: the second parameter to pass to the method -- EXPECTED_RESULT: the expected result ---CREDITS-- -Antonio Diaz Ruiz ---INI-- -assert.bail=true ---SKIPIF-- - ---ENV-- -XML_FILE=/book_with_dtd.xml -LOAD_OPTIONS=LIBXML_DTDATTR|LIBXML_NOCDATA|LIBXML_NOENT|LIBXML_NOBLANKS -EXPECTED_RESULT=1 ---FILE_EXTERNAL-- -domdocumentload_test_method_savexml.php ---EXPECT-- - - -The Grapes of WrathJohn SteinbeckThe PearlJohn Steinbeckentity is only for test purposesdata for test diff --git a/ext/dom/tests/DOMDocument_schemaValidateSource_addAttrs.phpt b/ext/dom/tests/DOMDocument_schemaValidateSource_addAttrs.phpt deleted file mode 100644 index 994b94d0c8533..0000000000000 --- a/ext/dom/tests/DOMDocument_schemaValidateSource_addAttrs.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -DomDocument::schemaValidateSource() - Add missing attribute default values from schema ---CREDITS-- -Chris Wright ---SKIPIF-- - ---FILE-- -load(dirname(__FILE__)."/book-attr.xml"); - -$xsd = file_get_contents(dirname(__FILE__)."/book.xsd"); - -$doc->schemaValidateSource($xsd, LIBXML_SCHEMA_CREATE); - -foreach ($doc->getElementsByTagName('book') as $book) { - var_dump($book->getAttribute('is-hardback')); -} - -?> ---EXPECT-- -string(5) "false" -string(4) "true" diff --git a/ext/dom/tests/DOMDocument_schemaValidateSource_error4.phpt b/ext/dom/tests/DOMDocument_schemaValidateSource_error4.phpt index f841b874288dd..65c8d8678f8ea 100644 --- a/ext/dom/tests/DOMDocument_schemaValidateSource_error4.phpt +++ b/ext/dom/tests/DOMDocument_schemaValidateSource_error4.phpt @@ -17,5 +17,5 @@ var_dump($result); ?> --EXPECTF-- -Warning: DOMDocument::schemaValidateSource() expects at least 1 parameter, 0 given in %s.php on line %d +Warning: DOMDocument::schemaValidateSource() expects exactly 1 parameter, 0 given in %s.php on line %d NULL diff --git a/ext/dom/tests/DOMDocument_schemaValidateSource_missingAttrs.phpt b/ext/dom/tests/DOMDocument_schemaValidateSource_missingAttrs.phpt deleted file mode 100644 index 7c98a74b1da25..0000000000000 --- a/ext/dom/tests/DOMDocument_schemaValidateSource_missingAttrs.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -DomDocument::schemaValidateSource() - Don't add missing attribute default values from schema ---CREDITS-- -Chris Wright ---SKIPIF-- - ---FILE-- -load(dirname(__FILE__)."/book-attr.xml"); - -$xsd = file_get_contents(dirname(__FILE__)."/book.xsd"); - -$doc->schemaValidateSource($xsd); - -foreach ($doc->getElementsByTagName('book') as $book) { - var_dump($book->getAttribute('is-hardback')); -} - -?> ---EXPECT-- -string(0) "" -string(4) "true" diff --git a/ext/dom/tests/DOMDocument_schemaValidate_addAttrs.phpt b/ext/dom/tests/DOMDocument_schemaValidate_addAttrs.phpt deleted file mode 100644 index e0b5251b2333f..0000000000000 --- a/ext/dom/tests/DOMDocument_schemaValidate_addAttrs.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -DomDocument::schemaValidate() - Add missing attribute default values from schema ---CREDITS-- -Chris Wright ---SKIPIF-- - ---FILE-- -load(dirname(__FILE__)."/book-attr.xml"); - -$doc->schemaValidate(dirname(__FILE__)."/book.xsd", LIBXML_SCHEMA_CREATE); - -foreach ($doc->getElementsByTagName('book') as $book) { - var_dump($book->getAttribute('is-hardback')); -} - -?> ---EXPECT-- -string(5) "false" -string(4) "true" diff --git a/ext/dom/tests/DOMDocument_schemaValidate_error4.phpt b/ext/dom/tests/DOMDocument_schemaValidate_error4.phpt index 9e4b6c4b7c963..d4817deca0b44 100644 --- a/ext/dom/tests/DOMDocument_schemaValidate_error4.phpt +++ b/ext/dom/tests/DOMDocument_schemaValidate_error4.phpt @@ -17,5 +17,5 @@ var_dump($result); ?> --EXPECTF-- -Warning: DOMDocument::schemaValidate() expects at least 1 parameter, 0 given in %s.php on line %d +Warning: DOMDocument::schemaValidate() expects exactly 1 parameter, 0 given in %s.php on line %d NULL diff --git a/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt b/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt index d5743bc6cf5c7..d3f0658c1f9f1 100644 --- a/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt +++ b/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt @@ -1,5 +1,5 @@ --TEST-- -DomDocument::schemaValidate() - non-existent schema file +DomDocument::schemaValidate() - non-existant schema file --CREDITS-- Daniel Convissor # TestFest 2009 NYPHP @@ -12,14 +12,14 @@ $doc = new DOMDocument; $doc->load(dirname(__FILE__)."/book.xml"); -$result = $doc->schemaValidate(dirname(__FILE__)."/non-existent-file"); +$result = $doc->schemaValidate(dirname(__FILE__)."/non-existant-file"); var_dump($result); ?> --EXPECTF-- -Warning: DOMDocument::schemaValidate(): I/O warning : failed to load external entity "%snon-existent-file" in %s.php on line %d +Warning: DOMDocument::schemaValidate(): I/O warning : failed to load external entity "%snon-existant-file" in %s.php on line %d -Warning: DOMDocument::schemaValidate(): Failed to locate the main schema resource at '%s/non-existent-file'. in %s.php on line %d +Warning: DOMDocument::schemaValidate(): Failed to locate the main schema resource at '%s/non-existant-file'. in %s.php on line %d Warning: DOMDocument::schemaValidate(): Invalid Schema in %s.php on line %d bool(false) diff --git a/ext/dom/tests/DOMDocument_schemaValidate_missingAttrs.phpt b/ext/dom/tests/DOMDocument_schemaValidate_missingAttrs.phpt deleted file mode 100644 index d253ad9690071..0000000000000 --- a/ext/dom/tests/DOMDocument_schemaValidate_missingAttrs.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -DomDocument::schemaValidate() - Don't add missing attribute default values from schema ---CREDITS-- -Chris Wright ---SKIPIF-- - ---FILE-- -load(dirname(__FILE__)."/book-attr.xml"); - -$doc->schemaValidate(dirname(__FILE__)."/book.xsd"); - -foreach ($doc->getElementsByTagName('book') as $book) { - var_dump($book->getAttribute('is-hardback')); -} - -?> ---EXPECT-- -string(0) "" -string(4) "true" diff --git a/ext/dom/tests/book-attr.xml b/ext/dom/tests/book-attr.xml deleted file mode 100644 index ba4298d0984c3..0000000000000 --- a/ext/dom/tests/book-attr.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - The Grapes of Wrath - John Steinbeck - - - The Pearl - John Steinbeck - - diff --git a/ext/dom/tests/book.xsd b/ext/dom/tests/book.xsd index 6b4a8ea54569c..45986fc4b3989 100755 --- a/ext/dom/tests/book.xsd +++ b/ext/dom/tests/book.xsd @@ -9,7 +9,6 @@ - diff --git a/ext/dom/tests/book_with_dtd.xml b/ext/dom/tests/book_with_dtd.xml deleted file mode 100644 index de12e92102aa6..0000000000000 --- a/ext/dom/tests/book_with_dtd.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - The Grapes of Wrath - John Steinbeck - - - The Pearl - John Steinbeck - - - &entitest; - - - diff --git a/ext/dom/tests/book_with_dtd2.xml b/ext/dom/tests/book_with_dtd2.xml deleted file mode 100644 index aeb4f0b800d63..0000000000000 --- a/ext/dom/tests/book_with_dtd2.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - -]> - - - The Grapes of Wrath - John Steinbeck - - - The Pearl - John Steinbeck - - - &entitest; - - - diff --git a/ext/dom/tests/books.dtd b/ext/dom/tests/books.dtd deleted file mode 100644 index b3f03c1c1635d..0000000000000 --- a/ext/dom/tests/books.dtd +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - diff --git a/ext/dom/tests/bug44648.phpt b/ext/dom/tests/bug44648.phpt index 4ff7ac389cbf6..d04f590acabbd 100644 --- a/ext/dom/tests/bug44648.phpt +++ b/ext/dom/tests/bug44648.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #44648 (Attribute names not checked for well formedness) +Bug #44648 (Attribute names not checked for wellformedness) --SKIPIF-- --FILE-- diff --git a/ext/dom/tests/domdocumentload_test_method.php b/ext/dom/tests/domdocumentload_test_method.php deleted file mode 100644 index 7afce15c3a75a..0000000000000 --- a/ext/dom/tests/domdocumentload_test_method.php +++ /dev/null @@ -1,12 +0,0 @@ -load(dirname(__FILE__) . getenv('XML_FILE'), $libxml_options); - -$expectedResult = (bool) getenv('EXPECTED_RESULT'); -assert('$result === $expectedResult'); -?> diff --git a/ext/dom/tests/domdocumentload_test_method_savexml.php b/ext/dom/tests/domdocumentload_test_method_savexml.php deleted file mode 100644 index 8ffd9445246df..0000000000000 --- a/ext/dom/tests/domdocumentload_test_method_savexml.php +++ /dev/null @@ -1,14 +0,0 @@ -load(dirname(__FILE__) . getenv('XML_FILE'), $libxml_options); - -$expectedResult = (bool) getenv('EXPECTED_RESULT'); -assert('$result === $expectedResult'); - -echo $doc->saveXML(); -?> diff --git a/ext/dom/tests/domdocumentload_utilities.php b/ext/dom/tests/domdocumentload_utilities.php deleted file mode 100644 index efd1e5a1a52bc..0000000000000 --- a/ext/dom/tests/domdocumentload_utilities.php +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/ext/dom/tests/domdocumentloadxml_test_method.php b/ext/dom/tests/domdocumentloadxml_test_method.php deleted file mode 100644 index 7c4be85cf1f2f..0000000000000 --- a/ext/dom/tests/domdocumentloadxml_test_method.php +++ /dev/null @@ -1,12 +0,0 @@ -loadXML(file_get_contents(dirname(__FILE__) . getenv('XML_FILE')), - $libxml_options); - -$expectedResult = (bool) getenv('EXPECTED_RESULT'); -assert('$result === $expectedResult'); -?> diff --git a/ext/dom/tests/domdocumentloadxml_test_method_savexml.php b/ext/dom/tests/domdocumentloadxml_test_method_savexml.php deleted file mode 100644 index 550219fb78c52..0000000000000 --- a/ext/dom/tests/domdocumentloadxml_test_method_savexml.php +++ /dev/null @@ -1,14 +0,0 @@ -loadXML(file_get_contents(dirname(__FILE__) . getenv('XML_FILE')), - $libxml_options); - -$expectedResult = (bool) getenv('EXPECTED_RESULT'); -assert('$result === $expectedResult'); - -echo $doc->saveXML(); -?> diff --git a/ext/dom/tests/not_well_formed.xml b/ext/dom/tests/not_well_formed.xml deleted file mode 100644 index d362e0c4b94e0..0000000000000 --- a/ext/dom/tests/not_well_formed.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - The Grapes of Wrath - <author>John Steinbeck</author> - </book> - <book> - <title>The Pearl - John Steinbeck - - diff --git a/ext/dom/tests/not_well_formed2.xml b/ext/dom/tests/not_well_formed2.xml deleted file mode 100644 index da6b3bccbaf80..0000000000000 --- a/ext/dom/tests/not_well_formed2.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - The Grapes of Wrath - John Steinbeck - - - The Pearl - John Steinbeck - - diff --git a/ext/dom/tests/not_well_formed3.xml b/ext/dom/tests/not_well_formed3.xml deleted file mode 100644 index 99b2189074651..0000000000000 --- a/ext/dom/tests/not_well_formed3.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - The Grapes of Wrath - John Steinbeck - - - The Pearl - John Steinbeck - - diff --git a/ext/dom/tests/not_well_formed4.xml b/ext/dom/tests/not_well_formed4.xml deleted file mode 100644 index 581b8bd9625b6..0000000000000 --- a/ext/dom/tests/not_well_formed4.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - The Grapes of Wrath - John Steinbeck - - - The Pearl - John Steinbeck - - diff --git a/ext/dom/tests/not_well_formed5.xml b/ext/dom/tests/not_well_formed5.xml deleted file mode 100644 index f42ead83ab36a..0000000000000 --- a/ext/dom/tests/not_well_formed5.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - The Grapes of Wrath - John Steinbeck - - - The Pearl - John Steinbeck - diff --git a/ext/dom/tests/wrong_book_with_dtd.xml b/ext/dom/tests/wrong_book_with_dtd.xml deleted file mode 100644 index 3a2d48e355f85..0000000000000 --- a/ext/dom/tests/wrong_book_with_dtd.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - The Grapes of Wrath - John Steinbeck - John Steinbeck - - - The Pearl - John Steinbeck - - diff --git a/ext/dom/tests/wrong_book_with_dtd2.xml b/ext/dom/tests/wrong_book_with_dtd2.xml deleted file mode 100644 index 6c49deb1f5697..0000000000000 --- a/ext/dom/tests/wrong_book_with_dtd2.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - -]> - - - The Grapes of Wrath - John Steinbeck - John Steinbeck - - - The Pearl - John Steinbeck - - diff --git a/ext/enchant/config.m4 b/ext/enchant/config.m4 index db8a69c5d189c..cc40d0bd0385e 100755 --- a/ext/enchant/config.m4 +++ b/ext/enchant/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(enchant,for ENCHANT support, -[ --with-enchant[=DIR] Include enchant support. +[ --with-enchant[=DIR] Include enchant support. GNU Aspell version 1.1.3 or higher required.]) if test "$PHP_ENCHANT" != "no"; then diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c index 98b5c9fd87904..141192c67fbee 100644 --- a/ext/enchant/enchant.c +++ b/ext/enchant/enchant.c @@ -674,7 +674,7 @@ PHP_FUNCTION(enchant_broker_dict_exists) described/referred to by 'tag'. The ordering is a comma delimited list of provider names. As a special exception, the "*" tag can be used as a language tag to declare a default ordering for any - language that does not explicitly declare an ordering. */ + language that does not explictly declare an ordering. */ PHP_FUNCTION(enchant_broker_set_ordering) { diff --git a/ext/ereg/config0.m4 b/ext/ereg/config0.m4 index caec39d285027..f4f8190932ff2 100644 --- a/ext/ereg/config0.m4 +++ b/ext/ereg/config0.m4 @@ -5,7 +5,7 @@ dnl dnl Check for regex library type dnl PHP_ARG_WITH(regex,, -[ --with-regex=TYPE Regex library type: system, php. [TYPE=php] +[ --with-regex=TYPE regex library type: system, php. [TYPE=php] WARNING: Do NOT use unless you know what you are doing!], php, no) case $PHP_REGEX in diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c index b2e64267e9320..76f5c1b765866 100644 --- a/ext/ereg/ereg.c +++ b/ext/ereg/ereg.c @@ -562,8 +562,8 @@ static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase) } if (Z_TYPE_PP(arg_pattern) == IS_STRING) { - if (Z_STRVAL_PP(arg_pattern) && Z_STRSIZE_PP(arg_pattern)) { - pattern = estrndup(Z_STRVAL_PP(arg_pattern), Z_STRSIZE_PP(arg_pattern)); + if (Z_STRVAL_PP(arg_pattern) && Z_STRLEN_PP(arg_pattern)) { + pattern = estrndup(Z_STRVAL_PP(arg_pattern), Z_STRLEN_PP(arg_pattern)); } else { pattern = STR_EMPTY_ALLOC(); } @@ -575,8 +575,8 @@ static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase) } if (Z_TYPE_PP(arg_replace) == IS_STRING) { - if (Z_STRVAL_PP(arg_replace) && Z_STRSIZE_PP(arg_replace)) { - replace = estrndup(Z_STRVAL_PP(arg_replace), Z_STRSIZE_PP(arg_replace)); + if (Z_STRVAL_PP(arg_replace) && Z_STRLEN_PP(arg_replace)) { + replace = estrndup(Z_STRVAL_PP(arg_replace), Z_STRLEN_PP(arg_replace)); } else { replace = STR_EMPTY_ALLOC(); } diff --git a/ext/exif/exif.c b/ext/exif/exif.c index ec121a6c326bc..c69107589835d 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -40,6 +40,16 @@ #include "php.h" #include "ext/standard/file.h" +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef PHP_WIN32 +# include "win32/php_stdint.h" +#endif + #if HAVE_EXIF /* When EXIF_DEBUG is defined the module generates a lot of debug messages @@ -2585,7 +2595,7 @@ static int exif_process_string_raw(char **result, char *value, size_t byte_count /* {{{ exif_process_string * Copy a string in Exif header to a character string and return length of allocated buffer if any. - * In contrast to exif_process_string this function does always return a string buffer */ + * In contrast to exif_process_string this function does allways return a string buffer */ static int exif_process_string(char **result, char *value, size_t byte_count TSRMLS_DC) { /* we cannot use strlcpy - here the problem is that we cannot use strlen to * determin length of string and we cannot use strlcpy with len=byte_count+1 diff --git a/ext/ext_skel b/ext/ext_skel index 061e78d6493f1..2492bf73da33e 100755 --- a/ext/ext_skel +++ b/ext/ext_skel @@ -12,7 +12,7 @@ echo "" echo " --extname=module module is the name of your extension" echo " --proto=file file contains prototypes of functions to create" echo " --stubs=file generate only function stubs in file" -echo " --xml generate xml documentation to be added to phpdoc-svn" +echo " --xml generate xml documentation to be added to phpdoc-cvs" echo " --skel=dir path to the skeleton directory" echo " --full-xml generate xml documentation for a self-contained extension" echo " (not yet implemented)" @@ -187,43 +187,11 @@ if (PHP_$EXTNAME != "no") { eof -$ECHO_N " .gitignore$ECHO_C" -cat >.gitignore <.svnignore <type) { case FILE_BYTE: - if (nbytes < (offset + 1)) /* should always be true */ + if (nbytes < (offset + 1)) /* should alway be true */ return 0; break; diff --git a/ext/fileinfo/tests/magic b/ext/fileinfo/tests/magic index aa75fb65bc1bd..27bde927e6709 100644 --- a/ext/fileinfo/tests/magic +++ b/ext/fileinfo/tests/magic @@ -3303,7 +3303,7 @@ >>>0x44 string =GLOB \b. >>>>0x60 beshort x \b%.4d -# Scripts that run in the embedded Python interpreter +# Scripts that run in the embeded Python interpreter 0 string #!BPY Blender3D BPython script #------------------------------------------------------------------------------ @@ -11969,7 +11969,7 @@ #>65 string ZSYS (Pre-System 7 system file) #>65 string acf3 (Aldus FreeHand) #>65 string cdev (control panel) -#>65 string dfil (Desk Accessory suitcase) +#>65 string dfil (Desk Acessory suitcase) #>65 string libr (library) #>65 string nX^d (WriteNow word processor) #>65 string nX^w (WriteNow dictionary) diff --git a/ext/filter/config.m4 b/ext/filter/config.m4 index 676f5d99ef3b7..b4e32a21a474a 100644 --- a/ext/filter/config.m4 +++ b/ext/filter/config.m4 @@ -5,7 +5,7 @@ PHP_ARG_ENABLE(filter, whether to enable input filter support, [ --disable-filter Disable input filter support], yes) PHP_ARG_WITH(pcre-dir, pcre install prefix, -[ --with-pcre-dir FILTER: pcre install prefix], no, no) +[ --with-pcre-dir FILTER: pcre install prefix], no, no) if test "$PHP_FILTER" != "no"; then diff --git a/ext/filter/filter.c b/ext/filter/filter.c index 12aebcf366f80..da951feb042dd 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -243,7 +243,7 @@ PHP_MINIT_FUNCTION(filter) REGISTER_LONG_CONSTANT("FILTER_SANITIZE_STRIPPED", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("FILTER_SANITIZE_ENCODED", FILTER_SANITIZE_ENCODED, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("FILTER_SANITIZE_SPECIAL_CHARS", FILTER_SANITIZE_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_FULL_SPECIAL_CHARS", FILTER_SANITIZE_FULL_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("FILTER_SANITIZE_FULL_SPECIAL_CHARS", FILTER_SANITIZE_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("FILTER_SANITIZE_EMAIL", FILTER_SANITIZE_EMAIL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("FILTER_SANITIZE_URL", FILTER_SANITIZE_URL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_INT", FILTER_SANITIZE_NUMBER_INT, CONST_CS | CONST_PERSISTENT); diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 0d6704f9d21a0..4c8a94f81c7df 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -39,7 +39,7 @@ #ifdef PHP_WIN32 #include #elif defined(NETWARE) -#ifdef USE_WINSOCK /* Modified to use Winsock (NOVSOCK2.H), at least for now */ +#ifdef USE_WINSOCK /* Modified to use Winsock (NOVSOCK2.H), atleast for now */ #include #else #include @@ -182,7 +182,6 @@ ftp_close(ftpbuf_t *ftp) #if HAVE_OPENSSL_EXT if (ftp->ssl_active) { SSL_shutdown(ftp->ssl_handle); - SSL_free(ftp->ssl_handle); } #endif closesocket(ftp->fd); @@ -298,7 +297,6 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC) if (SSL_connect(ftp->ssl_handle) <= 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL/TLS handshake failed"); SSL_shutdown(ftp->ssl_handle); - SSL_free(ftp->ssl_handle); return 0; } @@ -612,7 +610,7 @@ ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int filenam /* {{{ ftp_alloc */ int -ftp_alloc(ftpbuf_t *ftp, const long size, char **response) +ftp_alloc(ftpbuf_t *ftp, const int size, char **response) { char buffer[64]; @@ -620,8 +618,8 @@ ftp_alloc(ftpbuf_t *ftp, const long size, char **response) return 0; } - snprintf(buffer, sizeof(buffer) - 1, "%ld", size); - + snprintf(buffer, sizeof(buffer) - 1, "%d", size); + if (!ftp_putcmd(ftp, "ALLO", buffer)) { return 0; } @@ -787,7 +785,7 @@ ftp_pasv(ftpbuf_t *ftp, int pasv) /* {{{ ftp_get */ int -ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC) +ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC) { databuf_t *data = NULL; int lastch; @@ -808,7 +806,11 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, ftp->data = data; if (resumepos > 0) { - snprintf(arg, sizeof(arg), "%ld", resumepos); + if (resumepos > 2147483647) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater than 2147483647 bytes."); + goto bail; + } + snprintf(arg, sizeof(arg), "%u", resumepos); if (!ftp_putcmd(ftp, "REST", arg)) { goto bail; } @@ -881,10 +883,10 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, /* {{{ ftp_put */ int -ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC) +ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC) { databuf_t *data = NULL; - long size; + int size; char *ptr; int ch; char arg[11]; @@ -901,7 +903,11 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, l ftp->data = data; if (startpos > 0) { - snprintf(arg, sizeof(arg), "%ld", startpos); + if (startpos > 2147483647) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater than 2147483647 bytes."); + goto bail; + } + snprintf(arg, sizeof(arg), "%u", startpos); if (!ftp_putcmd(ftp, "REST", arg)) { goto bail; } @@ -958,7 +964,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, l /* {{{ ftp_size */ -long +int ftp_size(ftpbuf_t *ftp, const char *path) { if (ftp == NULL) { @@ -973,7 +979,7 @@ ftp_size(ftpbuf_t *ftp, const char *path) if (!ftp_getresp(ftp) || ftp->resp != 213) { return -1; } - return atol(ftp->inbuf); + return atoi(ftp->inbuf); } /* }}} */ @@ -1135,7 +1141,7 @@ ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args) int ftp_readline(ftpbuf_t *ftp) { - long size, rcvd; + int size, rcvd; char *data, *eol; /* shift the extra to the front */ @@ -1228,8 +1234,7 @@ ftp_getresp(ftpbuf_t *ftp) int my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len) { - long size, sent; - int n; + int n, size, sent; size = len; while (size) { @@ -1543,7 +1548,6 @@ data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC) if (SSL_connect(data->ssl_handle) <= 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_accept: SSL/TLS handshake failed"); SSL_shutdown(data->ssl_handle); - SSL_free(data->ssl_handle); return 0; } @@ -1561,21 +1565,13 @@ data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC) databuf_t* data_close(ftpbuf_t *ftp, databuf_t *data) { -#if HAVE_OPENSSL_EXT - SSL_CTX *ctx; -#endif if (data == NULL) { return NULL; } if (data->listener != -1) { #if HAVE_OPENSSL_EXT if (data->ssl_active) { - - ctx = SSL_get_SSL_CTX(data->ssl_handle); - SSL_CTX_free(ctx); - SSL_shutdown(data->ssl_handle); - SSL_free(data->ssl_handle); data->ssl_active = 0; } #endif @@ -1584,11 +1580,7 @@ data_close(ftpbuf_t *ftp, databuf_t *data) if (data->fd != -1) { #if HAVE_OPENSSL_EXT if (data->ssl_active) { - ctx = SSL_get_SSL_CTX(data->ssl_handle); - SSL_CTX_free(ctx); - SSL_shutdown(data->ssl_handle); - SSL_free(data->ssl_handle); data->ssl_active = 0; } #endif @@ -1712,7 +1704,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC) /* {{{ ftp_nb_get */ int -ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC) +ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC) { databuf_t *data = NULL; char arg[11]; @@ -1730,7 +1722,14 @@ ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t typ } if (resumepos>0) { - snprintf(arg, sizeof(arg), "%ld", resumepos); + /* We are working on an architecture that supports 64-bit integers + * since php is 32 bit by design, we bail out with warning + */ + if (resumepos > 2147483647) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater than 2147483648 bytes."); + goto bail; + } + snprintf(arg, sizeof(arg), "%u", resumepos); if (!ftp_putcmd(ftp, "REST", arg)) { goto bail; } @@ -1829,7 +1828,7 @@ ftp_nb_continue_read(ftpbuf_t *ftp TSRMLS_DC) /* {{{ ftp_nb_put */ int -ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC) +ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC) { databuf_t *data = NULL; char arg[11]; @@ -1844,7 +1843,11 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type goto bail; } if (startpos > 0) { - snprintf(arg, sizeof(arg), "%ld", startpos); + if (startpos > 2147483647) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater than 2147483647 bytes."); + goto bail; + } + snprintf(arg, sizeof(arg), "%u", startpos); if (!ftp_putcmd(ftp, "REST", arg)) { goto bail; } @@ -1881,7 +1884,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type int ftp_nb_continue_write(ftpbuf_t *ftp TSRMLS_DC) { - long size; + int size; char *ptr; int ch; diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h index 69de7dbb78aca..c7db45789a5d9 100644 --- a/ext/ftp/ftp.h +++ b/ext/ftp/ftp.h @@ -146,7 +146,7 @@ int ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int fi * however some servers will not accept STOR or APPE until ALLO is confirmed. * If response is passed, it is estrdup()ed from ftp->inbuf and must be freed * or assigned to a zval returned to the user */ -int ftp_alloc(ftpbuf_t *ftp, const long size, char **response); +int ftp_alloc(ftpbuf_t *ftp, const int size, char **response); /* returns a NULL-terminated array of filenames in the given path * or NULL on error. the return array must be freed (but don't @@ -169,15 +169,15 @@ int ftp_pasv(ftpbuf_t *ftp, int pasv); /* retrieves a file and saves its contents to outfp * returns true on success, false on error */ -int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC); +int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC); /* stores the data from a file, socket, or process as a file on the remote server * returns true on success, false on error */ -int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC); +int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC); /* returns the size of the given file, or -1 on error */ -long ftp_size(ftpbuf_t *ftp, const char *path); +int ftp_size(ftpbuf_t *ftp, const char *path); /* returns the last modified time of the given file, or -1 on error */ time_t ftp_mdtm(ftpbuf_t *ftp, const char *path); @@ -194,12 +194,12 @@ int ftp_site(ftpbuf_t *ftp, const char *cmd); /* retrieves part of a file and saves its contents to outfp * returns true on success, false on error */ -int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC); +int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos TSRMLS_DC); /* stores the data from a file, socket, or process as a file on the remote server * returns true on success, false on error */ -int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC); +int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos TSRMLS_DC); /* continues a previous nb_(f)get command */ diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index da22e0b63eb3a..73071936e0fbc 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -784,8 +784,8 @@ PHP_FUNCTION(ftp_nb_fget) ftptype_t xtype; php_stream *stream; char *file; - int file_len; - long mode, resumepos=0, ret; + int file_len, ret; + long mode, resumepos=0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) { return; @@ -968,7 +968,9 @@ PHP_FUNCTION(ftp_nb_get) RETURN_LONG(PHP_FTP_FAILED); } - php_stream_close(outstream); + if (ret == PHP_FTP_FINISHED) { + php_stream_close(outstream); + } RETURN_LONG(ret); } @@ -980,7 +982,7 @@ PHP_FUNCTION(ftp_nb_continue) { zval *z_ftp; ftpbuf_t *ftp; - long ret; + int ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ftp) == FAILURE) { return; @@ -1118,7 +1120,7 @@ PHP_FUNCTION(ftp_put) ftpbuf_t *ftp; ftptype_t xtype; char *remote, *local; - long remote_len, local_len; + int remote_len, local_len; long mode, startpos=0; php_stream *instream; @@ -1171,8 +1173,8 @@ PHP_FUNCTION(ftp_nb_put) ftpbuf_t *ftp; ftptype_t xtype; char *remote, *local; - int remote_len, local_len; - long mode, startpos=0, ret; + int remote_len, local_len, ret; + long mode, startpos=0; php_stream *instream; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { diff --git a/ext/ftp/tests/filesize_large.phpt b/ext/ftp/tests/filesize_large.phpt deleted file mode 100644 index 05f12a3e5b8ee..0000000000000 --- a/ext/ftp/tests/filesize_large.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -Verify php can handle filesizes >32bit ---SKIPIF-- - ---FILE-- - ---EXPECT-- -int(5368709120) diff --git a/ext/ftp/tests/ftp_fget_basic.phpt b/ext/ftp/tests/ftp_fget_basic.phpt index 355b8b8469140..d736f8c45e8da 100644 --- a/ext/ftp/tests/ftp_fget_basic.phpt +++ b/ext/ftp/tests/ftp_fget_basic.phpt @@ -27,7 +27,7 @@ var_dump(ftp_fget($ftp, $fp, 'binary data.bin', FTP_BINARY)); fseek($fp, $postition); var_dump(urlencode(fgets($fp))); -//test non-existent file request +//test non-existant file request ftp_fget($ftp, $fp ,'a warning.txt', FTP_ASCII); //remove file diff --git a/ext/ftp/tests/ftp_get_basic.phpt b/ext/ftp/tests/ftp_get_basic.phpt index 2fd8c7914919f..23fd8d07f3f62 100644 --- a/ext/ftp/tests/ftp_get_basic.phpt +++ b/ext/ftp/tests/ftp_get_basic.phpt @@ -27,7 +27,7 @@ var_dump(ftp_get($ftp, $tmpfname, 'binary data.bin', FTP_BINARY)); var_dump(urlencode(file_get_contents($tmpfname))); unlink($tmpfname); -//test non-existent file request +//test non-existant file request ftp_get($ftp, $tmpfname ,'a warning.txt', FTP_ASCII); ?> --EXPECTF-- diff --git a/ext/ftp/tests/ftp_nb_get_large.phpt b/ext/ftp/tests/ftp_nb_get_large.phpt deleted file mode 100644 index 3fbf2a4831d14..0000000000000 --- a/ext/ftp/tests/ftp_nb_get_large.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -Testing ftp_nb_fget can handle large files incl. resume ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -string(1) "X" -int(5368709120) diff --git a/ext/ftp/tests/server.inc b/ext/ftp/tests/server.inc index 7dc8fa08d99ff..86178806233f7 100644 --- a/ext/ftp/tests/server.inc +++ b/ext/ftp/tests/server.inc @@ -357,17 +357,7 @@ if ($pid) { $transfer_type = $ascii? 'ASCII' : 'BINARY' ; fputs($fs, "Bar\r\n"); fputs($s, "226 Closing data Connection.\r\n"); - break; - case "fget_large": - fputs($s, "150 File status okay; about to open data connection.\r\n"); - $transfer_type = $ascii? 'ASCII' : 'BINARY' ; - if ($GLOBALS['rest_pos'] == '5368709119') { - fputs($fs, "X"); - } else { - fputs($fs, "Y"); - } - fputs($s, "226 Closing data Connection.\r\n"); - break; + break; default: fputs($s, "550 {$matches[1]}: No such file or directory \r\n"); break; @@ -403,12 +393,11 @@ if ($pid) { }elseif (preg_match('/^LIST no_exists\//', $buf, $matches)) { fputs($s, "425 Error establishing connection\r\n"); - }elseif (preg_match('/^REST (\d+)/', $buf, $matches)) { - $GLOBALS['rest_pos'] = $matches[1]; + }elseif (preg_match('/^REST \d+/', $buf, $matches)) { fputs($s, "350 OK\r\n"); - }elseif (preg_match('/^SIZE largefile/', $buf)) { - fputs($s, "213 5368709120\r\n"); - }else { + } + + else { fputs($s, "500 Syntax error, command unrecognized.\r\n"); dump_and_exit($buf); } @@ -418,4 +407,4 @@ if ($pid) { } fclose($socket); -?> +?> \ No newline at end of file diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 index c9e080faab7cd..50660af6cdeac 100644 --- a/ext/gd/config.m4 +++ b/ext/gd/config.m4 @@ -7,11 +7,11 @@ dnl Configure options dnl PHP_ARG_WITH(gd, for GD support, -[ --with-gd[=DIR] Include GD support. DIR is the GD library base +[ --with-gd[=DIR] Include GD support. DIR is the GD library base install directory [BUNDLED]]) if test -z "$PHP_VPX_DIR"; then PHP_ARG_WITH(vpx-dir, for the location of libvpx, - [ --with-vpx-dir[=DIR] GD: Set the path to libvpx install prefix], no, no) + [ --with-vpx-dir[=DIR] GD: Set the path to libvpx install prefix], no, no) fi if test -z "$PHP_JPEG_DIR"; then @@ -39,10 +39,10 @@ PHP_ARG_WITH(t1lib, for T1lib support, [ --with-t1lib[=DIR] GD: Include T1lib support. T1lib version >= 5.0.0 required], no, no) PHP_ARG_ENABLE(gd-native-ttf, whether to enable truetype string function in GD, -[ --enable-gd-native-ttf GD: Enable TrueType string function], no, no) +[ --enable-gd-native-ttf GD: Enable TrueType string function], no, no) PHP_ARG_ENABLE(gd-jis-conv, whether to enable JIS-mapped Japanese font support in GD, -[ --enable-gd-jis-conv GD: Enable JIS-mapped Japanese font support], no, no) +[ --enable-gd-jis-conv GD: Enable JIS-mapped Japanese font support], no, no) dnl dnl Checks for the configure options diff --git a/ext/gd/gd.c b/ext/gd/gd.c index b7af06e7fb2e9..7da8a62a3973f 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -104,7 +104,7 @@ int overflow2(int a, int b); /* IMPORTANT NOTE FOR NEW FILTER * Do not forget to update: * IMAGE_FILTER_MAX: define the last filter index - * IMAGE_FILTER_MAX_ARGS: define the biggest amount of arguments + * IMAGE_FILTER_MAX_ARGS: define the biggest amout of arguments * image_filter array in PHP_FUNCTION(imagefilter) * */ #define IMAGE_FILTER_NEGATE 0 diff --git a/ext/gd/libgd/gd_crop.c b/ext/gd/libgd/gd_crop.c index f0b888a4f1c69..9ce48273b640b 100644 --- a/ext/gd/libgd/gd_crop.c +++ b/ext/gd/libgd/gd_crop.c @@ -69,7 +69,7 @@ printf("rect->x: %i\nrect->y: %i\nrect->width: %i\nrect->height: %i\n", crop->x, if (src->trueColor) { unsigned int dst_y = 0; while (y < (crop->y + (crop->height - 1))) { - /* TODO: replace 4 w/byte per channel||pitch once available */ + /* TODO: replace 4 w/byte per channel||pitch once avaiable */ memcpy(dst->tpixels[dst_y++], src->tpixels[y++] + crop->x, crop->width * 4); } } else { diff --git a/ext/gd/libgd/webpimg.h b/ext/gd/libgd/webpimg.h index db23de5bb24ab..8a05429a73c49 100644 --- a/ext/gd/libgd/webpimg.h +++ b/ext/gd/libgd/webpimg.h @@ -84,7 +84,7 @@ WebPResult WebPDecode(const uint8* data, * height. * 6. y_stride: The width (in bytes) of one row of Y data. This may not * match width if there is end of row padding (e.g., for 32 - * bit row alignment). + * bit row aligment). * 7. QP: the quantization parameter. This parameter controls the * compression vs quality tradeoff. Use smaller numbers for better * quality (compression will be lesser) and vice versa. 20 is a diff --git a/ext/gd/tests/imagecrop_auto.phpt b/ext/gd/tests/imagecrop_auto.phpt index 1c1929d8e8d7c..c2b5177fbfe5b 100644 --- a/ext/gd/tests/imagecrop_auto.phpt +++ b/ext/gd/tests/imagecrop_auto.phpt @@ -57,8 +57,6 @@ $im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0); imagepng($im_crop, __DIR__ . "/crop_threshold.png"); var_dump(imagesx($im_crop)); var_dump(imagesy($im_crop)); - -@unlink(__DIR__ . "/crop_threshold.png"); ?> --EXPECT-- TC IMG_CROP_DEFAULT diff --git a/ext/gettext/config.m4 b/ext/gettext/config.m4 index 24dddd3a43fc4..02d436c6e760b 100644 --- a/ext/gettext/config.m4 +++ b/ext/gettext/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(gettext,for GNU gettext support, -[ --with-gettext[=DIR] Include GNU gettext support]) +[ --with-gettext[=DIR] Include GNU gettext support]) if test "$PHP_GETTEXT" != "no"; then for i in $PHP_GETTEXT /usr/local /usr; do diff --git a/ext/gmp/config.m4 b/ext/gmp/config.m4 index 2140aaf7015c5..9606b2f56d4d4 100644 --- a/ext/gmp/config.m4 +++ b/ext/gmp/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(gmp, for GNU MP support, -[ --with-gmp[=DIR] Include GNU MP support]) +[ --with-gmp[=DIR] Include GNU MP support]) if test "$PHP_GMP" != "no"; then diff --git a/ext/hash/config.m4 b/ext/hash/config.m4 index 5174db3b71fa9..79ac25e19f978 100644 --- a/ext/hash/config.m4 +++ b/ext/hash/config.m4 @@ -2,7 +2,7 @@ dnl $Id$ dnl config.m4 for extension hash PHP_ARG_WITH(mhash, for mhash support, -[ --with-mhash[=DIR] Include mhash support]) +[ --with-mhash[=DIR] Include mhash support]) PHP_ARG_ENABLE(hash, whether to enable hash support, [ --disable-hash Disable hash support], yes) @@ -31,7 +31,7 @@ if test "$PHP_HASH" != "no"; then EXT_HASH_HEADERS="php_hash.h php_hash_md.h php_hash_sha.h php_hash_ripemd.h \ php_hash_haval.h php_hash_tiger.h php_hash_gost.h php_hash_snefru.h \ php_hash_whirlpool.h php_hash_adler32.h php_hash_crc32.h \ - php_hash_fnv.h php_hash_joaat.h" + php_hash_fnv.h php_hash_joaat.h php_hash_types.h" PHP_NEW_EXTENSION(hash, $EXT_HASH_SOURCES, $ext_shared) ifdef([PHP_INSTALL_HEADERS], [ diff --git a/ext/hash/config.w32 b/ext/hash/config.w32 index 8e9d4c3d48c9d..abe8675f30639 100644 --- a/ext/hash/config.w32 +++ b/ext/hash/config.w32 @@ -19,6 +19,7 @@ if (PHP_HASH != "no") { PHP_INSTALL_HEADERS("ext/hash/", "php_hash.h php_hash_md.h php_hash_sha.h php_hash_ripemd.h " + "php_hash_haval.h php_hash_tiger.h php_hash_gost.h php_hash_snefru.h " + - "php_hash_whirlpool.h php_hash_adler32.h php_hash_crc32.h"); + "php_hash_whirlpool.h php_hash_adler32.h php_hash_crc32.h " + + "php_hash_types.h"); } diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 117221484e363..9cede1412525c 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -597,7 +597,7 @@ PHP_FUNCTION(hash_algos) array_init(return_value); for(zend_hash_internal_pointer_reset_ex(&php_hash_hashtable, &pos); - (type = zend_hash_get_current_key_ex(&php_hash_hashtable, &str, &str_len, &idx, 0, &pos)) != HASH_KEY_NON_EXISTENT; + (type = zend_hash_get_current_key_ex(&php_hash_hashtable, &str, &str_len, &idx, 0, &pos)) != HASH_KEY_NON_EXISTANT; zend_hash_move_forward_ex(&php_hash_hashtable, &pos)) { add_next_index_stringl(return_value, str, str_len-1, 1); } @@ -1042,7 +1042,7 @@ PHP_MINFO_FUNCTION(hash) long type; for(zend_hash_internal_pointer_reset_ex(&php_hash_hashtable, &pos); - (type = zend_hash_get_current_key_ex(&php_hash_hashtable, &str, NULL, &idx, 0, &pos)) != HASH_KEY_NON_EXISTENT; + (type = zend_hash_get_current_key_ex(&php_hash_hashtable, &str, NULL, &idx, 0, &pos)) != HASH_KEY_NON_EXISTANT; zend_hash_move_forward_ex(&php_hash_hashtable, &pos)) { s += slprintf(s, e - s, "%s ", str); } diff --git a/ext/hash/package.xml b/ext/hash/package.xml index 25a598a4a1522..119cdd673daa8 100644 --- a/ext/hash/package.xml +++ b/ext/hash/package.xml @@ -42,6 +42,7 @@ Supported Algorithms: + diff --git a/ext/hash/php_hash.h b/ext/hash/php_hash.h index 3f5e7ced3a19b..4bfddbacd9c45 100644 --- a/ext/hash/php_hash.h +++ b/ext/hash/php_hash.h @@ -22,6 +22,7 @@ #define PHP_HASH_H #include "php.h" +#include "php_hash_types.h" #define PHP_HASH_EXTNAME "hash" #define PHP_HASH_EXTVER "1.0" @@ -29,12 +30,6 @@ #define PHP_HASH_HMAC 0x0001 -#define L64 INT64_C -#define php_hash_int32 int32_t -#define php_hash_uint32 uint32_t -#define php_hash_int64 int64_t -#define php_hash_uint64 uint64_t - typedef void (*php_hash_init_func_t)(void *context); typedef void (*php_hash_update_func_t)(void *context, const unsigned char *buf, unsigned int count); typedef void (*php_hash_final_func_t)(unsigned char *digest, void *context); diff --git a/ext/hash/php_hash_types.h b/ext/hash/php_hash_types.h new file mode 100644 index 0000000000000..8793da55d6727 --- /dev/null +++ b/ext/hash/php_hash_types.h @@ -0,0 +1,71 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Michael Wallner | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_HASH_TYPES_H +#define PHP_HASH_TYPES_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#else +#ifndef PHP_WIN32 +#include "php_config.h" +#endif +#endif + +#ifndef PHP_WIN32 +#if SIZEOF_LONG == 8 +#define L64(x) x +typedef unsigned long php_hash_uint64; +#if SIZEOF_INT == 4 +typedef unsigned int php_hash_uint32; +#elif SIZEOF_SHORT == 4 +typedef unsigned short php_hash_uint32; +#else +#error "Need a 32bit integer type" +#endif +#elif SIZEOF_LONG_LONG == 8 +#define L64(x) x##LL +typedef unsigned long long php_hash_uint64; +#if SIZEOF_INT == 4 +typedef unsigned int php_hash_uint32; +#elif SIZEOF_LONG == 4 +typedef unsigned long php_hash_uint32; +#else +#error "Need a 32bit integer type" +#endif +#else +#error "Need a 64bit integer type" +#endif +#else +#define L64(x) x##i64 +typedef unsigned __int64 php_hash_uint64; +typedef unsigned __int32 php_hash_uint32; +#endif + +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/ext/hash/tests/hash_file_error.phpt b/ext/hash/tests/hash_file_error.phpt index 96c41e643219a..e1380301c28e0 100644 --- a/ext/hash/tests/hash_file_error.phpt +++ b/ext/hash/tests/hash_file_error.phpt @@ -23,8 +23,8 @@ file_put_contents( $filename, 'The quick brown fox jumped over the lazy dog.' ); echo "\n-- Testing hash_file() function with an unknown algorithm --\n"; var_dump( hash_file( 'foobar', $filename ) ); -echo "\n-- Testing hash_file() function with a non-existent file --\n"; -var_dump( hash_file( 'md5', 'nonexistent.txt' ) ); +echo "\n-- Testing hash_file() function with a non-existant file --\n"; +var_dump( hash_file( 'md5', 'nonexistant.txt' ) ); echo "\n-- Testing hash_file() function with less than expected no. of arguments --\n"; var_dump( hash_file( 'md5' ) ); @@ -50,7 +50,7 @@ unlink( $filename ); Warning: hash_file(): Unknown hashing algorithm: %s in %s on line %d bool(false) --- Testing hash_file() function with a non-existent file -- +-- Testing hash_file() function with a non-existant file -- Warning: hash_file(%s): failed to open stream: No such file or directory in %s on line %d bool(false) diff --git a/ext/iconv/config.m4 b/ext/iconv/config.m4 index 10d21ccc6de6d..d673b0adba458 100644 --- a/ext/iconv/config.m4 +++ b/ext/iconv/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(iconv, for iconv support, -[ --without-iconv[=DIR] Exclude iconv support], yes) +[ --without-iconv[=DIR] Exclude iconv support], yes) if test "$PHP_ICONV" != "no"; then diff --git a/ext/imap/config.m4 b/ext/imap/config.m4 index 3efc245901695..3ad7c107ddac1 100644 --- a/ext/imap/config.m4 +++ b/ext/imap/config.m4 @@ -95,7 +95,7 @@ AC_DEFUN([PHP_IMAP_SSL_CHK], [ PHP_ARG_WITH(imap,for IMAP support, -[ --with-imap[=DIR] Include IMAP support. DIR is the c-client install prefix]) +[ --with-imap[=DIR] Include IMAP support. DIR is the c-client install prefix]) PHP_ARG_WITH(kerberos,for IMAP Kerberos support, [ --with-kerberos[=DIR] IMAP: Include Kerberos support. DIR is the Kerberos install prefix], no, no) diff --git a/ext/interbase/config.m4 b/ext/interbase/config.m4 index dfd850b00ad88..603145ad6c30a 100644 --- a/ext/interbase/config.m4 +++ b/ext/interbase/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(interbase,for InterBase support, -[ --with-interbase[=DIR] Include InterBase support. DIR is the InterBase base +[ --with-interbase[=DIR] Include InterBase support. DIR is the InterBase base install directory [/usr/interbase]]) if test "$PHP_INTERBASE" != "no"; then diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp index 7ca7e94c95f74..7bf271a344f3b 100644 --- a/ext/intl/breakiterator/breakiterator_class.cpp +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -245,32 +245,32 @@ ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_void, 0, 0, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_locale, 0, 0, 0) - ZEND_ARG_INFO(0, locale) + ZEND_ARG_INFO(0, "locale") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_setText, 0, 0, 1) - ZEND_ARG_INFO(0, text) + ZEND_ARG_INFO(0, "text") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_next, 0, 0, 0) - ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, "offset") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_offset, 0, 0, 1) - ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, "offset") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_get_locale, 0, 0, 1) - ZEND_ARG_INFO(0, locale_type) + ZEND_ARG_INFO(0, "locale_type") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(ainfo_biter_getPartsIterator, 0, 0, 0) - ZEND_ARG_INFO(0, key_type) + ZEND_ARG_INFO(0, "key_type") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(ainfo_rbbi___construct, 0, 0, 1) - ZEND_ARG_INFO(0, rules) - ZEND_ARG_INFO(0, areCompiled) + ZEND_ARG_INFO(0, "rules") + ZEND_ARG_INFO(0, "areCompiled") ZEND_END_ARG_INFO() /* }}} */ diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp index e13425097d953..beb65f718f43f 100644 --- a/ext/intl/calendar/calendar_class.cpp +++ b/ext/intl/calendar/calendar_class.cpp @@ -361,10 +361,6 @@ ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_setLenient, 0, 0, 1) ZEND_ARG_INFO(0, isLenient) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_set_minimal_days_in_first_week, 0, 0, 1) - ZEND_ARG_INFO(0, numberOfDays) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_from_date_time, 0, 0, 1) ZEND_ARG_INFO(0, dateTime) ZEND_END_ARG_INFO() @@ -437,7 +433,6 @@ static const zend_function_entry Calendar_class_functions[] = { #endif PHP_ME_MAPPING(setFirstDayOfWeek, intlcal_set_first_day_of_week, ainfo_cal_dow, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(setLenient, intlcal_set_lenient, ainfo_cal_setLenient, ZEND_ACC_PUBLIC) - PHP_ME_MAPPING(setMinimalDaysInFirstWeek,intlcal_set_minimal_days_in_first_week,ainfo_cal_set_minimal_days_in_first_week,ZEND_ACC_PUBLIC) PHP_ME_MAPPING(equals, intlcal_equals, ainfo_cal_other_cal, ZEND_ACC_PUBLIC) #if U_ICU_VERSION_MAJOR_NUM >= 49 PHP_ME_MAPPING(getRepeatedWallTimeOption,intlcal_get_repeated_wall_time_option,ainfo_cal_void, ZEND_ACC_PUBLIC) @@ -528,7 +523,7 @@ void calendar_register_IntlCalendar_class(TSRMLS_D) CALENDAR_DECL_LONG_CONST("FIELD_JULIAN_DAY", UCAL_JULIAN_DAY); CALENDAR_DECL_LONG_CONST("FIELD_MILLISECONDS_IN_DAY", UCAL_MILLISECONDS_IN_DAY); CALENDAR_DECL_LONG_CONST("FIELD_IS_LEAP_MONTH", UCAL_IS_LEAP_MONTH); - CALENDAR_DECL_LONG_CONST("FIELD_FIELD_COUNT", UCAL_FIELD_COUNT); + CALENDAR_DECL_LONG_CONST("FIELD_FIELD_COUNT ", UCAL_FIELD_COUNT); CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_MONTH", UCAL_DAY_OF_MONTH); CALENDAR_DECL_LONG_CONST("DOW_SUNDAY", UCAL_SUNDAY); diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index db10502a1837f..2d33bd1952f2f 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -997,32 +997,6 @@ U_CFUNC PHP_FUNCTION(intlcal_set_lenient) RETURN_TRUE; } -U_CFUNC PHP_FUNCTION(intlcal_set_minimal_days_in_first_week) -{ - long num_days; - CALENDAR_METHOD_INIT_VARS; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Ol", &object, Calendar_ce_ptr, &num_days) == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_set_minimal_days_in_first_week: bad arguments", 0 TSRMLS_CC); - RETURN_FALSE; - } - - if (num_days < 1 || num_days > 7) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "intlcal_set_minimal_days_in_first_week: invalid number of days; " - "must be between 1 and 7", 0 TSRMLS_CC); - RETURN_FALSE; - } - - CALENDAR_METHOD_FETCH_OBJECT; - - co->ucal->setMinimalDaysInFirstWeek((uint8_t)num_days); - - RETURN_TRUE; -} - U_CFUNC PHP_FUNCTION(intlcal_equals) { zval *other_object; diff --git a/ext/intl/calendar/calendar_methods.h b/ext/intl/calendar/calendar_methods.h index dfd0bbeeaf67e..2be13e4920224 100644 --- a/ext/intl/calendar/calendar_methods.h +++ b/ext/intl/calendar/calendar_methods.h @@ -91,8 +91,6 @@ PHP_FUNCTION(intlcal_set_first_day_of_week); PHP_FUNCTION(intlcal_set_lenient); -PHP_FUNCTION(intlcal_set_minimal_days_in_first_week); - PHP_FUNCTION(intlcal_equals); PHP_FUNCTION(intlcal_get_repeated_wall_time_option); diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c index 2a3ac10fbf004..e989d4c65a2d4 100644 --- a/ext/intl/collator/collator_convert.c +++ b/ext/intl/collator/collator_convert.c @@ -139,7 +139,7 @@ void collator_convert_hash_from_utf8_to_utf16( HashTable* hash, UErrorCode* stat zend_hash_internal_pointer_reset( hash ); while( ( hashKeyType = zend_hash_get_current_key( hash, &hashKey, &hashIndex, 0 ) ) - != HASH_KEY_NON_EXISTENT ) + != HASH_KEY_NON_EXISTANT ) { /* Convert current hash item from UTF-8 to UTF-16LE. */ collator_convert_hash_item_from_utf8_to_utf16( @@ -164,7 +164,7 @@ void collator_convert_hash_from_utf16_to_utf8( HashTable* hash, UErrorCode* stat zend_hash_internal_pointer_reset( hash ); while( ( hashKeyType = zend_hash_get_current_key( hash, &hashKey, &hashIndex, 0 ) ) - != HASH_KEY_NON_EXISTENT ) + != HASH_KEY_NON_EXISTANT ) { /* Convert current hash item from UTF-16LE to UTF-8. */ collator_convert_hash_item_from_utf16_to_utf8( diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index 65e53c8b5e824..a2c4d77651d4b 100644 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -590,11 +590,6 @@ ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_set_lenient, 0, 0, 2 ) ZEND_ARG_INFO( 0, isLenient ) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_set_minimal_days_in_first_week, 0, 0, 2 ) - ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 ) - ZEND_ARG_INFO( 0, numberOfDays ) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_from_date_time, 0, 0, 1) ZEND_ARG_INFO(0, dateTime) ZEND_END_ARG_INFO() @@ -833,7 +828,6 @@ zend_function_entry intl_functions[] = { #endif PHP_FE( intlcal_set_first_day_of_week, ainfo_cal_dow ) PHP_FE( intlcal_set_lenient, ainfo_cal_set_lenient ) - PHP_FE( intlcal_set_minimal_days_in_first_week, ainfo_cal_set_minimal_days_in_first_week ) PHP_FE( intlcal_equals, ainfo_cal_other_cal ) PHP_FE( intlcal_from_date_time, ainfo_cal_from_date_time ) PHP_FE( intlcal_to_date_time, ainfo_cal_only_cal ) diff --git a/ext/intl/tests/calendar_const_field_field_count.phpt b/ext/intl/tests/calendar_const_field_field_count.phpt deleted file mode 100644 index bae438fbbc4cd..0000000000000 --- a/ext/intl/tests/calendar_const_field_field_count.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -IntlCalendar::FIELD_FIELD_COUNT ---INI-- -date.timezone=Atlantic/Azores ---SKIPIF-- -setMinimalDaysInFirstWeek(6), - $intlcal->getMinimalDaysInFirstWeek(), - intlcal_set_minimal_days_in_first_week($intlcal, 5), - $intlcal->getMinimalDaysInFirstWeek() -); -?> -==DONE== ---EXPECT-- -bool(true) -int(6) -bool(true) -int(5) -==DONE== diff --git a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt deleted file mode 100644 index c133558ddc5c3..0000000000000 --- a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -IntlCalendar::setMinimalDaysInFirstWeek(): bad arguments ---INI-- -date.timezone=Atlantic/Azores ---SKIPIF-- -setMinimalDaysInFirstWeek()); -var_dump($c->setMinimalDaysInFirstWeek(1, 2)); -var_dump($c->setMinimalDaysInFirstWeek(0)); - -var_dump(intlcal_set_minimal_days_in_first_week($c, 0)); -var_dump(intlcal_set_minimal_days_in_first_week(1, 2)); - ---EXPECTF-- -Warning: IntlCalendar::setMinimalDaysInFirstWeek() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: IntlCalendar::setMinimalDaysInFirstWeek(): intlcal_set_minimal_days_in_first_week: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::setMinimalDaysInFirstWeek() expects exactly 1 parameter, 2 given in %s on line %d - -Warning: IntlCalendar::setMinimalDaysInFirstWeek(): intlcal_set_minimal_days_in_first_week: bad arguments in %s on line %d -bool(false) - -Warning: IntlCalendar::setMinimalDaysInFirstWeek(): intlcal_set_minimal_days_in_first_week: invalid number of days; must be between 1 and 7 in %s on line %d -bool(false) - -Warning: intlcal_set_minimal_days_in_first_week(): intlcal_set_minimal_days_in_first_week: invalid number of days; must be between 1 and 7 in %s on line %d -bool(false) - -Catchable fatal error: Argument 1 passed to intlcal_set_minimal_days_in_first_week() must be an instance of IntlCalendar, integer given in %s on line %d - diff --git a/ext/intl/tests/transliterator_create_error.phpt b/ext/intl/tests/transliterator_create_error.phpt index 4f2d04ae78255..31aef68feb98b 100644 --- a/ext/intl/tests/transliterator_create_error.phpt +++ b/ext/intl/tests/transliterator_create_error.phpt @@ -6,15 +6,15 @@ Transliterator::create (error) ===DONE=== --CLEAN-- diff --git a/ext/ldap/tests/ldap_set_rebind_proc_error.phpt b/ext/ldap/tests/ldap_set_rebind_proc_error.phpt index c8c7985826cd5..966612f652811 100644 --- a/ext/ldap/tests/ldap_set_rebind_proc_error.phpt +++ b/ext/ldap/tests/ldap_set_rebind_proc_error.phpt @@ -35,7 +35,7 @@ function rebind_proc ($ds, $ldap_url) { $link = ldap_connect($host, $port); var_dump(ldap_set_rebind_proc($link)); var_dump(ldap_set_rebind_proc($link, "rebind_proc", "Additional data")); -var_dump(ldap_set_rebind_proc($link, "rebind_proc_inexistent")); +var_dump(ldap_set_rebind_proc($link, "rebind_proc_inexistant")); ?> ===DONE=== --EXPECTF-- @@ -45,6 +45,6 @@ bool(false) Warning: ldap_set_rebind_proc() expects exactly 2 parameters, 3 given in %s on line %d bool(false) -Warning: ldap_set_rebind_proc(): Two arguments expected for 'rebind_proc_inexistent' to be a valid callback in %s on line %d +Warning: ldap_set_rebind_proc(): Two arguments expected for 'rebind_proc_inexistant' to be a valid callback in %s on line %d bool(false) ===DONE=== diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 05b8df4d0d538..b1cb45db7645e 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -44,7 +44,6 @@ #include #ifdef LIBXML_SCHEMAS_ENABLED #include -#include #endif #include "php_libxml.h" @@ -293,8 +292,7 @@ static void *php_libxml_streams_IO_open_wrapper(const char *filename, const char php_stream_statbuf ssbuf; php_stream_context *context = NULL; php_stream_wrapper *wrapper = NULL; - char *resolved_path; - const char *path_to_open = NULL; + char *resolved_path, *path_to_open = NULL; void *ret_val = NULL; int isescaped=0; xmlURI *uri; @@ -800,11 +798,6 @@ static PHP_MINIT_FUNCTION(libxml) #endif REGISTER_LONG_CONSTANT("LIBXML_NOEMPTYTAG", LIBXML_SAVE_NOEMPTYTAG, CONST_CS | CONST_PERSISTENT); - /* Schema validation options */ -#if defined(LIBXML_SCHEMAS_ENABLED) && LIBXML_VERSION >= 20614 - REGISTER_LONG_CONSTANT("LIBXML_SCHEMA_CREATE", XML_SCHEMA_VAL_VC_I_CREATE, CONST_CS | CONST_PERSISTENT); -#endif - /* Additional constants for use with loading html */ #if LIBXML_VERSION >= 20707 REGISTER_LONG_CONSTANT("LIBXML_HTML_NOIMPLIED", HTML_PARSE_NOIMPLIED, CONST_CS | CONST_PERSISTENT); diff --git a/ext/mbstring/config.m4 b/ext/mbstring/config.m4 index 25bf238761395..5d70d45b80446 100644 --- a/ext/mbstring/config.m4 +++ b/ext/mbstring/config.m4 @@ -344,19 +344,19 @@ PHP_ARG_ENABLE(mbstring, whether to enable multibyte string support, [ --enable-mbstring Enable multibyte string support]) PHP_ARG_ENABLE([mbregex], [whether to enable multibyte regex support], -[ --disable-mbregex MBSTRING: Disable multibyte regex support], yes, no) +[ --disable-mbregex MBSTRING: Disable multibyte regex support], yes, no) PHP_ARG_ENABLE([mbregex_backtrack], [whether to check multibyte regex backtrack], [ --disable-mbregex-backtrack - MBSTRING: Disable multibyte regex backtrack check], yes, no) + MBSTRING: Disable multibyte regex backtrack check], yes, no) PHP_ARG_WITH(libmbfl, [for external libmbfl], [ --with-libmbfl[=DIR] MBSTRING: Use external libmbfl. DIR is the libmbfl base - install directory [BUNDLED]], no, no) + install directory [BUNDLED]], no, no) PHP_ARG_WITH(onig, [for external oniguruma], [ --with-onig[=DIR] MBSTRING: Use external oniguruma. DIR is the oniguruma install prefix. - If DIR is not set, the bundled oniguruma will be used], no, no) + If DIR is not set, the bundled oniguruma will be used], no, no) if test "$PHP_MBSTRING" != "no"; then AC_DEFINE([HAVE_MBSTRING],1,[whether to have multibyte string support]) diff --git a/ext/mbstring/oniguruma/HISTORY b/ext/mbstring/oniguruma/HISTORY index 7add6f9a90ead..244cd3d150d98 100644 --- a/ext/mbstring/oniguruma/HISTORY +++ b/ext/mbstring/oniguruma/HISTORY @@ -878,7 +878,7 @@ History 2004/10/18: [impl] (thanks Imai Yasumasa) enclose #include by #ifndef __BORLANDC__. 2004/10/18: [bug] (thanks Imai Yasumasa) - memory access violation in select_opt_exact_info(). + memory acess violation in select_opt_exact_info(). 2004/09/25: [dist] fix doc/API and doc/API.ja. 2004/09/25: [bug] fix OP_SEMI_END_BUF process in match_at() for the case USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE diff --git a/ext/mbstring/tests/illformed_utf_sequences.phpt b/ext/mbstring/tests/illformed_utf_sequences.phpt index 378b956d681ee..b5b9d94db8479 100644 --- a/ext/mbstring/tests/illformed_utf_sequences.phpt +++ b/ext/mbstring/tests/illformed_utf_sequences.phpt @@ -25,28 +25,28 @@ var_dump(chk_enc("\x31\x32\x33", 0)); var_dump(chk_enc("\x41\x42\x43", 0)); var_dump(chk_enc("\xc0\xb1\xc0\xb2\xc0\xb3", 6)); var_dump(chk_enc("\xc1\x81\xc1\x82\xc1\x83", 6)); -var_dump(chk_enc("\xe0\x80\xb1\xe0\x80\xb2\xe0\x80\xb3", 9)); -var_dump(chk_enc("\xe0\x81\x81\xe0\x81\x82\xe0\x81\x83", 9)); -var_dump(chk_enc("\xf0\x80\x80\xb1\xf0\x80\x80\xb2\xf0\x80\x80\xb3", 12)); -var_dump(chk_enc("\xf0\x80\x81\x81\xf0\x80\x81\x82\xf0\x81\x83", 11)); +var_dump(chk_enc("\xe0\x80\xb1\xe0\x80\xb2\xe0\x80\xb3", 6)); +var_dump(chk_enc("\xe0\x81\x81\xe0\x81\x82\xe0\x81\x83", 6)); +var_dump(chk_enc("\xf0\x80\x80\xb1\xf0\x80\x80\xb2\xf0\x80\x80\xb3", 9)); +var_dump(chk_enc("\xf0\x80\x81\x81\xf0\x80\x81\x82\xf0\x81\x83", 8)); var_dump(chk_enc("\xf8\x80\x80\x80\xb1\xf8\x80\x80\x80\xb2\xf8\x80\x80\x80\xb3", 15)); var_dump(chk_enc("\xf8\x80\x80\x81\x81\xf8\x80\x80\x81\x82\xf8\x80\x80\x81\x83", 15)); var_dump(chk_enc("\xfc\x80\x80\x80\x80\xb1\xfc\x80\x80\x80\x80\xb2\xfc\x80\x80\x80\x80\xb3", 18)); var_dump(chk_enc("\xfc\x80\x80\x80\x81\x81\xfc\x80\x80\x80\x81\x82\xfc\x80\x80\x80\x81\x83", 18)); var_dump(chk_enc("\xc2\xa2\xc2\xa3\xc2\xa5", 0)); -var_dump(chk_enc("\xe0\x82\xa2\xe0\x82\xa3\xe0\x82\xa5", 9)); -var_dump(chk_enc("\xf0\x80\x82\xa2\xf0\x80\x82\xa3\xf0\x80\x82\xa5", 12)); +var_dump(chk_enc("\xe0\x82\xa2\xe0\x82\xa3\xe0\x82\xa5", 6)); +var_dump(chk_enc("\xf0\x80\x82\xa2\xf0\x80\x82\xa3\xf0\x80\x82\xa5", 9)); var_dump(chk_enc("\xf8\x80\x80\x82\xa2\xf8\x80\x80\x82\xa3\xf8\x80\x80\x82\xa5", 15)); var_dump(chk_enc("\xfc\x80\x80\x80\x82\xa2\xfc\x80\x80\x80\x82\xa3\xfc\x80\x80\x80\x82\xa5", 18)); var_dump(chk_enc("\xc1\xbf", 2)); var_dump(chk_enc("\xc2\x80", 0)); var_dump(chk_enc("\xdf\xbf", 0)); -var_dump(chk_enc("\xe0\x9f\xff", 3)); +var_dump(chk_enc("\xe0\x9f\xff", 2)); var_dump(chk_enc("\xe0\xa0\x80", 2)); var_dump(chk_enc("\xef\xbf\xbf", 0)); -var_dump(chk_enc("\xf0\x8f\xbf\xbf", 4)); +var_dump(chk_enc("\xf0\x8f\xbf\xbf", 3)); var_dump(chk_enc("\xf0\x90\x80\x80", 0)); var_dump(chk_enc("\xf7\xbf\xbf\xbf", 4)); var_dump(chk_enc("\xf8\x87\xbf\xbf\xbf", 5)); @@ -61,7 +61,7 @@ echo "UTF-8 and surrogates area\n"; $out = ''; $cnt = 0; for ($i = 0xd7ff; $i <= 0xe000; ++$i) { - $s = chk_enc(pack('C3', 0xe0 | ($i >> 12), 0x80 | ($i >> 6) & 0x3f, 0x80 | $i & 0x3f), 3); + $s = chk_enc(pack('C3', 0xe0 | ($i >> 12), 0x80 | ($i >> 6) & 0x3f, 0x80 | $i & 0x3f), 2); if ($s === false) { $cnt++; } else { diff --git a/ext/mbstring/tests/mb_http_output.phpt b/ext/mbstring/tests/mb_http_output.phpt index 6f149bfc9fe19..7fb3335fe22ba 100644 --- a/ext/mbstring/tests/mb_http_output.phpt +++ b/ext/mbstring/tests/mb_http_output.phpt @@ -4,7 +4,7 @@ mb_http_output() --FILE-- num_persistent = 0; mssql_globals->get_column_content = php_mssql_get_column_content_with_type; - if (cfg_get_long("mssql.compatibility_mode", &compatibility_mode) == SUCCESS) { - if (compatibility_mode) { + if (cfg_get_long("mssql.compatability_mode", &compatability_mode) == SUCCESS) { + if (compatability_mode) { mssql_globals->get_column_content = php_mssql_get_column_content_without_type; } } diff --git a/ext/mssql/php_mssql.h b/ext/mssql/php_mssql.h index 2b7d3e19c3a3c..b73c8420462da 100644 --- a/ext/mssql/php_mssql.h +++ b/ext/mssql/php_mssql.h @@ -166,7 +166,7 @@ ZEND_BEGIN_MODULE_GLOBALS(mssql) long min_error_severity, min_message_severity; long cfg_min_error_severity, cfg_min_message_severity; long connect_timeout, timeout; - zend_bool compatibility_mode; + zend_bool compatability_mode; void (*get_column_content)(mssql_link *mssql_ptr,int offset,zval *result,int column_type TSRMLS_DC); long textsize, textlimit, batchsize; zend_bool datetimeconvert; diff --git a/ext/mysql/config.m4 b/ext/mysql/config.m4 index fd7f52ef3adab..5968c43346aed 100644 --- a/ext/mysql/config.m4 +++ b/ext/mysql/config.m4 @@ -40,14 +40,13 @@ AC_DEFUN([PHP_MYSQL_SOCKET_SEARCH], [ PHP_ARG_WITH(mysql, for MySQL support, -[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base +[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base directory, if no DIR is passed or the value is mysqlnd the MySQL native driver will be used]) PHP_ARG_WITH(mysql-sock, for specified location of the MySQL UNIX socket, -[ --with-mysql-sock[=SOCKPATH] - MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer. - If unspecified, the default locations are searched], no, no) +[ --with-mysql-sock[=DIR] MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer. + If unspecified, the default locations are searched], no, no) if test -z "$PHP_ZLIB_DIR"; then PHP_ARG_WITH(zlib-dir, for the location of libz, diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index 88bb9ab21ef9f..ba81a95e5f252 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -296,7 +296,7 @@ static const zend_function_entry mysql_functions[] = { #ifdef MYSQL_HAS_SET_CHARSET PHP_FE(mysql_set_charset, arginfo_mysql_set_charset) #endif - /* for downwards compatibility */ + /* for downwards compatability */ PHP_DEP_FALIAS(mysql, mysql_db_query, arginfo_mysql_db_query) PHP_DEP_FALIAS(mysql_fieldname, mysql_field_name, arginfo_mysql_field_name) PHP_DEP_FALIAS(mysql_fieldtable, mysql_field_table, arginfo_mysql_field_seek) @@ -1922,7 +1922,7 @@ PHP_FUNCTION(mysql_result) /* johannes TODO: -Do 2 zend_parse_parameters calls instead of type "z" and switch below +Do 2 zend_parse_paramters calls instead of type "z" and switch below Q: String or long first? */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &result, &row, &field) == FAILURE) { diff --git a/ext/mysqli/config.m4 b/ext/mysqli/config.m4 index f6c86e762bbbe..687b422898305 100644 --- a/ext/mysqli/config.m4 +++ b/ext/mysqli/config.m4 @@ -3,14 +3,13 @@ dnl $Id$ dnl config.m4 for extension mysqli PHP_ARG_WITH(mysqli, for MySQLi support, -[ --with-mysqli[=FILE] Include MySQLi support. FILE is the path +[ --with-mysqli[=FILE] Include MySQLi support. FILE is the path to mysql_config. If no value or mysqlnd is passed as FILE, the MySQL native driver will be used]) PHP_ARG_ENABLE(embedded_mysqli, whether to enable embedded MySQLi support, -[ --enable-embedded-mysqli - MYSQLi: Enable embedded support - Note: Does not work with MySQL native driver!], no, no) +[ --enable-embedded-mysqli MYSQLi: Enable embedded support + Note: Does not work with MySQL native driver!], no, no) if test "$PHP_MYSQLI" = "yes" || test "$PHP_MYSQLI" = "mysqlnd"; then dnl This needs to be set in any extension which wishes to use mysqlnd diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index ad4e25c66f322..4dd1a409f68f1 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -531,7 +531,7 @@ PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry *class_ #include "ext/mysqlnd/mysqlnd_reverse_api.h" static MYSQLND *mysqli_convert_zv_to_mysqlnd(zval * zv TSRMLS_DC) { - if (Z_TYPE_P(zv) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zv), mysqli_link_class_entry TSRMLS_CC)) { + if (Z_TYPE_P(zv) == IS_OBJECT && Z_OBJCE_P(zv) == mysqli_link_class_entry) { MY_MYSQL * mysql; MYSQLI_RESOURCE * my_res; mysqli_object * intern = (mysqli_object *)zend_object_store_get_object(zv TSRMLS_CC); diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index c24b974de862b..398c15919b4f7 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -562,7 +562,7 @@ PHP_FUNCTION(mysqli_query) MY_MYSQL *mysql; zval *mysql_link; MYSQLI_RESOURCE *mysqli_resource; - MYSQL_RES *result = NULL; + MYSQL_RES *result; char *query = NULL; int query_len; long resultmode = MYSQLI_STORE_RESULT; @@ -833,7 +833,7 @@ PHP_FUNCTION(mysqli_reap_async_query) MY_MYSQL *mysql; zval *mysql_link; MYSQLI_RESOURCE *mysqli_resource; - MYSQL_RES *result = NULL; + MYSQL_RES *result; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { return; diff --git a/ext/mysqli/tests/mysqli_driver.phpt b/ext/mysqli/tests/mysqli_driver.phpt index 023e4d2299954..4e266a0533e0f 100644 --- a/ext/mysqli/tests/mysqli_driver.phpt +++ b/ext/mysqli/tests/mysqli_driver.phpt @@ -53,7 +53,7 @@ require_once('skipifconnectfailure.inc'); } catch (mysqli_sql_exception $e) { $ok = true; if ('' == $e->getMessage()) - printf("[008] getMessage() has returned an empty string.\n"); + printf("[008] getMessage() has returned an emptry string.\n"); if ('' == $e->getCode()) printf("[009] getCode() has returned an empty string.\n"); if ('' == $e->getFile()) diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt index ac2e7c00015ac..fa00ecda15d23 100644 --- a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt +++ b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt @@ -17,7 +17,7 @@ mysqli_fetch_assoc() - utf8 die("skip Looks like UTF8 is not available on the server"); if (strtolower($tmp['Charset']) !== 'utf8') - die("skip Not sure if UTF8 is available, canceling the test"); + die("skip Not sure if UTF8 is available, cancelling the test"); mysqli_free_result($res); @@ -28,7 +28,7 @@ mysqli_fetch_assoc() - utf8 die("skip Looks like UCS2 is not available on the server"); if (strtolower($tmp['Charset']) !== 'ucs2') - die("skip Not sure if UCS2 is available, canceling the test"); + die("skip Not sure if UCS2 is available, cancelling the test"); mysqli_free_result($res); mysqli_close($link); diff --git a/ext/mysqli/tests/mysqli_get_client_stats.phpt b/ext/mysqli/tests/mysqli_get_client_stats.phpt index a22fc58f53fe5..ef5ef6ee69c0e 100644 --- a/ext/mysqli/tests/mysqli_get_client_stats.phpt +++ b/ext/mysqli/tests/mysqli_get_client_stats.phpt @@ -166,7 +166,7 @@ mysqlnd.collect_memory_statistics=1 mysqli_get_client_stats_assert_gt('bytes_sent', $info, $expected, $test_counter); mysqli_get_client_stats_assert_gt('bytes_received', $info, $expected, $test_counter); - // real_data_* get incremented after mysqli_*fetch*() + // real_data_* get incremeneted after mysqli_*fetch*() mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, "0", $test_counter); mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter); diff --git a/ext/mysqli/tests/mysqli_options.phpt b/ext/mysqli/tests/mysqli_options.phpt index 5daaa597fabb4..2f7986d3fe446 100644 --- a/ext/mysqli/tests/mysqli_options.phpt +++ b/ext/mysqli/tests/mysqli_options.phpt @@ -12,7 +12,7 @@ require_once('skipifconnectfailure.inc'); $valid_options = array( MYSQLI_READ_DEFAULT_GROUP => "MYSQLI_READ_DEFAULT_GROUP", - MYSQLI_READ_DEFAULT_FILE => "MYSQLI_READ_DEFAULT_FILE", + MYSQLI_READ_DEFAULT_FILE => "MYSQLI_READ_DEFAUTL_FILE", MYSQLI_OPT_CONNECT_TIMEOUT => "MYSQLI_OPT_CONNECT_TIMEOUT", MYSQLI_OPT_LOCAL_INFILE => "MYSQLI_OPT_LOCAL_INFILE", MYSQLI_INIT_COMMAND => "MYSQLI_INIT_COMMAND", diff --git a/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt b/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt deleted file mode 100644 index d7a78f1cf06d9..0000000000000 --- a/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt +++ /dev/null @@ -1,50 +0,0 @@ ---TEST-- -mysqli_stmt_prepare() ---SKIPIF-- - ---FILE-- -prepare("SHOW STATUS WHERE 1 = ? AND 1 IN {$params}")) { - - $stmt->bind_param('iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii', $model, $cleanupIds[0], $cleanupIds[1], $cleanupIds[2], $cleanupIds[3], $cleanupIds[4], $cleanupIds[5], $cleanupIds[6], $cleanupIds[7], $cleanupIds[8], $cleanupIds[9], $cleanupIds[10], $cleanupIds[11], $cleanupIds[12], $cleanupIds[13], $cleanupIds[14], $cleanupIds[15], $cleanupIds[16], $cleanupIds[17], $cleanupIds[18], $cleanupIds[19], $cleanupIds[20], $cleanupIds[21], $cleanupIds[22], $cleanupIds[23], $cleanupIds[24], $cleanupIds[25], $cleanupIds[26], $cleanupIds[27], $cleanupIds[28], $cleanupIds[29], $cleanupIds[30], $cleanupIds[31], $cleanupIds[32], $cleanupIds[33], $cleanupIds[34], $cleanupIds[35], $cleanupIds[36], $cleanupIds[37], $cleanupIds[38], $cleanupIds[39], $cleanupIds[40], $cleanupIds[41], $cleanupIds[42], $cleanupIds[43], $cleanupIds[44], $cleanupIds[45], $cleanupIds[46], $cleanupIds[47], $cleanupIds[48], $cleanupIds[49], $cleanupIds[50], $cleanupIds[51], $cleanupIds[52], $cleanupIds[53], $cleanupIds[54], $cleanupIds[55], $cleanupIds[56], $cleanupIds[57], $cleanupIds[58], $cleanupIds[59], $cleanupIds[60], $cleanupIds[61], $cleanupIds[62], $cleanupIds[63], $cleanupIds[64], $cleanupIds[65], $cleanupIds[66], $cleanupIds[67], $cleanupIds[68], $cleanupIds[69], $cleanupIds[70], $cleanupIds[71], $cleanupIds[72], $cleanupIds[73], $cleanupIds[74], $cleanupIds[75], $cleanupIds[76], $cleanupIds[77], $cleanupIds[78], $cleanupIds[79], $cleanupIds[80], $cleanupIds[81], $cleanupIds[82], $cleanupIds[83], $cleanupIds[84], $cleanupIds[85], $cleanupIds[86], $cleanupIds[87], $cleanupIds[88], $cleanupIds[89], $cleanupIds[90], $cleanupIds[91], $cleanupIds[92], $cleanupIds[93], $cleanupIds[94], $cleanupIds[95], $cleanupIds[96], $cleanupIds[97], $cleanupIds[98], $cleanupIds[99], $cleanupIds[100], $cleanupIds[101], $cleanupIds[102], $cleanupIds[103], $cleanupIds[104], $cleanupIds[105], $cleanupIds[106], $cleanupIds[107], $cleanupIds[108], $cleanupIds[109], $cleanupIds[110], $cleanupIds[111], $cleanupIds[112], $cleanupIds[113], $cleanupIds[114], $cleanupIds[115], $cleanupIds[116], $cleanupIds[117], $cleanupIds[118], $cleanupIds[119], $cleanupIds[120], $cleanupIds[121], $cleanupIds[122], $cleanupIds[123], $cleanupIds[124], $cleanupIds[125], $cleanupIds[126], $cleanupIds[127], $cleanupIds[128], $cleanupIds[129], $cleanupIds[130], $cleanupIds[131], $cleanupIds[132], $cleanupIds[133], $cleanupIds[134], $cleanupIds[135], $cleanupIds[136], $cleanupIds[137], $cleanupIds[138], $cleanupIds[139], $cleanupIds[140], $cleanupIds[141], $cleanupIds[142], $cleanupIds[143], $cleanupIds[144], $cleanupIds[145], $cleanupIds[146], $cleanupIds[147], $cleanupIds[148], $cleanupIds[149], $cleanupIds[150], $cleanupIds[151], $cleanupIds[152], $cleanupIds[153], $cleanupIds[154], $cleanupIds[155], $cleanupIds[156], $cleanupIds[157], $cleanupIds[158], $cleanupIds[159], $cleanupIds[160], $cleanupIds[161], $cleanupIds[162], $cleanupIds[163], $cleanupIds[164], $cleanupIds[165], $cleanupIds[166], $cleanupIds[167], $cleanupIds[168], $cleanupIds[169], $cleanupIds[170], $cleanupIds[171], $cleanupIds[172], $cleanupIds[173], $cleanupIds[174], $cleanupIds[175], $cleanupIds[176], $cleanupIds[177], $cleanupIds[178], $cleanupIds[179], $cleanupIds[180], $cleanupIds[181], $cleanupIds[182], $cleanupIds[183], $cleanupIds[184], $cleanupIds[185], $cleanupIds[186], $cleanupIds[187], $cleanupIds[188], $cleanupIds[189], $cleanupIds[190], $cleanupIds[191], $cleanupIds[192], $cleanupIds[193], $cleanupIds[194], $cleanupIds[195], $cleanupIds[196], $cleanupIds[197], $cleanupIds[198], $cleanupIds[199], $cleanupIds[200], $cleanupIds[201], $cleanupIds[202], $cleanupIds[203], $cleanupIds[204], $cleanupIds[205], $cleanupIds[206], $cleanupIds[207], $cleanupIds[208], $cleanupIds[209], $cleanupIds[210], $cleanupIds[211], $cleanupIds[212], $cleanupIds[213], $cleanupIds[214], $cleanupIds[215], $cleanupIds[216], $cleanupIds[217], $cleanupIds[218], $cleanupIds[219], $cleanupIds[220], $cleanupIds[221], $cleanupIds[222], $cleanupIds[223], $cleanupIds[224], $cleanupIds[225], $cleanupIds[226], $cleanupIds[227], $cleanupIds[228], $cleanupIds[229], $cleanupIds[230], $cleanupIds[231], $cleanupIds[232], $cleanupIds[233], $cleanupIds[234], $cleanupIds[235], $cleanupIds[236], $cleanupIds[237], $cleanupIds[238], $cleanupIds[239], $cleanupIds[240], $cleanupIds[241], $cleanupIds[242], $cleanupIds[243], $cleanupIds[244], $cleanupIds[245], $cleanupIds[246], $cleanupIds[247], $cleanupIds[248], $cleanupIds[249], $cleanupIds[250], $cleanupIds[251], $cleanupIds[252], $cleanupIds[253], $cleanupIds[254], $cleanupIds[255], $cleanupIds[256], $cleanupIds[257], $cleanupIds[258], $cleanupIds[259], $cleanupIds[260], $cleanupIds[261], $cleanupIds[262], $cleanupIds[263], $cleanupIds[264], $cleanupIds[265], $cleanupIds[266], $cleanupIds[267], $cleanupIds[268], $cleanupIds[269], $cleanupIds[270], $cleanupIds[271], $cleanupIds[272], $cleanupIds[273], $cleanupIds[274], $cleanupIds[275], $cleanupIds[276], $cleanupIds[277], $cleanupIds[278], $cleanupIds[279], $cleanupIds[280], $cleanupIds[281], $cleanupIds[282], $cleanupIds[283], $cleanupIds[284], $cleanupIds[285], $cleanupIds[286], $cleanupIds[287], $cleanupIds[288], $cleanupIds[289], $cleanupIds[290], $cleanupIds[291], $cleanupIds[292], $cleanupIds[293], $cleanupIds[294], $cleanupIds[295], $cleanupIds[296], $cleanupIds[297], $cleanupIds[298], $cleanupIds[299], $cleanupIds[300], $cleanupIds[301], $cleanupIds[302], $cleanupIds[303], $cleanupIds[304], $cleanupIds[305], $cleanupIds[306], $cleanupIds[307], $cleanupIds[308], $cleanupIds[309], $cleanupIds[310], $cleanupIds[311], $cleanupIds[312], $cleanupIds[313], $cleanupIds[314], $cleanupIds[315], $cleanupIds[316], $cleanupIds[317], $cleanupIds[318], $cleanupIds[319], $cleanupIds[320], $cleanupIds[321], $cleanupIds[322], $cleanupIds[323], $cleanupIds[324], $cleanupIds[325], $cleanupIds[326], $cleanupIds[327], $cleanupIds[328], $cleanupIds[329], $cleanupIds[330], $cleanupIds[331], $cleanupIds[332], $cleanupIds[333], $cleanupIds[334], $cleanupIds[335], $cleanupIds[336], $cleanupIds[337], $cleanupIds[338], $cleanupIds[339], $cleanupIds[340], $cleanupIds[341], $cleanupIds[342], $cleanupIds[343], $cleanupIds[344], $cleanupIds[345], $cleanupIds[346], $cleanupIds[347], $cleanupIds[348], $cleanupIds[349], $cleanupIds[350], $cleanupIds[351], $cleanupIds[352], $cleanupIds[353], $cleanupIds[354], $cleanupIds[355], $cleanupIds[356], $cleanupIds[357], $cleanupIds[358], $cleanupIds[359], $cleanupIds[360], $cleanupIds[361], $cleanupIds[362], $cleanupIds[363], $cleanupIds[364], $cleanupIds[365], $cleanupIds[366], $cleanupIds[367], $cleanupIds[368], $cleanupIds[369], $cleanupIds[370], $cleanupIds[371], $cleanupIds[372], $cleanupIds[373], $cleanupIds[374], $cleanupIds[375], $cleanupIds[376], $cleanupIds[377], $cleanupIds[378], $cleanupIds[379], $cleanupIds[380], $cleanupIds[381], $cleanupIds[382], $cleanupIds[383], $cleanupIds[384], $cleanupIds[385], $cleanupIds[386], $cleanupIds[387], $cleanupIds[388], $cleanupIds[389], $cleanupIds[390], $cleanupIds[391], $cleanupIds[392], $cleanupIds[393], $cleanupIds[394], $cleanupIds[395], $cleanupIds[396], $cleanupIds[397], $cleanupIds[398], $cleanupIds[399], $cleanupIds[400], $cleanupIds[401], $cleanupIds[402], $cleanupIds[403], $cleanupIds[404], $cleanupIds[405], $cleanupIds[406], $cleanupIds[407], $cleanupIds[408], $cleanupIds[409], $cleanupIds[410], $cleanupIds[411], $cleanupIds[412], $cleanupIds[413], $cleanupIds[414], $cleanupIds[415], $cleanupIds[416], $cleanupIds[417], $cleanupIds[418], $cleanupIds[419], $cleanupIds[420], $cleanupIds[421], $cleanupIds[422], $cleanupIds[423], $cleanupIds[424], $cleanupIds[425], $cleanupIds[426], $cleanupIds[427], $cleanupIds[428], $cleanupIds[429], $cleanupIds[430], $cleanupIds[431], $cleanupIds[432], $cleanupIds[433], $cleanupIds[434], $cleanupIds[435], $cleanupIds[436], $cleanupIds[437], $cleanupIds[438], $cleanupIds[439], $cleanupIds[440], $cleanupIds[441], $cleanupIds[442], $cleanupIds[443], $cleanupIds[444], $cleanupIds[445], $cleanupIds[446], $cleanupIds[447], $cleanupIds[448], $cleanupIds[449], $cleanupIds[450], $cleanupIds[451], $cleanupIds[452], $cleanupIds[453], $cleanupIds[454], $cleanupIds[455], $cleanupIds[456], $cleanupIds[457], $cleanupIds[458], $cleanupIds[459], $cleanupIds[460], $cleanupIds[461], $cleanupIds[462], $cleanupIds[463], $cleanupIds[464], $cleanupIds[465], $cleanupIds[466], $cleanupIds[467], $cleanupIds[468], $cleanupIds[469], $cleanupIds[470], $cleanupIds[471], $cleanupIds[472], $cleanupIds[473], $cleanupIds[474], $cleanupIds[475], $cleanupIds[476], $cleanupIds[477], $cleanupIds[478], $cleanupIds[479], $cleanupIds[480], $cleanupIds[481], $cleanupIds[482], $cleanupIds[483], $cleanupIds[484], $cleanupIds[485], $cleanupIds[486], $cleanupIds[487], $cleanupIds[488], $cleanupIds[489], $cleanupIds[490], $cleanupIds[491], $cleanupIds[492], $cleanupIds[493], $cleanupIds[494], $cleanupIds[495], $cleanupIds[496], $cleanupIds[497], $cleanupIds[498], $cleanupIds[499], $cleanupIds[500], $cleanupIds[501], $cleanupIds[502], $cleanupIds[503], $cleanupIds[504], $cleanupIds[505], $cleanupIds[506], $cleanupIds[507], $cleanupIds[508], $cleanupIds[509], $cleanupIds[510], $cleanupIds[511], $cleanupIds[512], $cleanupIds[513], $cleanupIds[514], $cleanupIds[515], $cleanupIds[516], $cleanupIds[517], $cleanupIds[518], $cleanupIds[519], $cleanupIds[520], $cleanupIds[521], $cleanupIds[522], $cleanupIds[523], $cleanupIds[524], $cleanupIds[525], $cleanupIds[526], $cleanupIds[527], $cleanupIds[528], $cleanupIds[529], $cleanupIds[530], $cleanupIds[531], $cleanupIds[532], $cleanupIds[533], $cleanupIds[534], $cleanupIds[535], $cleanupIds[536], $cleanupIds[537], $cleanupIds[538], $cleanupIds[539], $cleanupIds[540], $cleanupIds[541], $cleanupIds[542], $cleanupIds[543], $cleanupIds[544], $cleanupIds[545], $cleanupIds[546], $cleanupIds[547], $cleanupIds[548], $cleanupIds[549], $cleanupIds[550], $cleanupIds[551], $cleanupIds[552], $cleanupIds[553], $cleanupIds[554], $cleanupIds[555], $cleanupIds[556], $cleanupIds[557], $cleanupIds[558], $cleanupIds[559], $cleanupIds[560], $cleanupIds[561], $cleanupIds[562], $cleanupIds[563], $cleanupIds[564], $cleanupIds[565], $cleanupIds[566], $cleanupIds[567], $cleanupIds[568], $cleanupIds[569], $cleanupIds[570], $cleanupIds[571], $cleanupIds[572], $cleanupIds[573], $cleanupIds[574], $cleanupIds[575], $cleanupIds[576], $cleanupIds[577], $cleanupIds[578], $cleanupIds[579], $cleanupIds[580], $cleanupIds[581], $cleanupIds[582], $cleanupIds[583], $cleanupIds[584], $cleanupIds[585], $cleanupIds[586], $cleanupIds[587], $cleanupIds[588], $cleanupIds[589], $cleanupIds[590], $cleanupIds[591], $cleanupIds[592], $cleanupIds[593], $cleanupIds[594], $cleanupIds[595], $cleanupIds[596], $cleanupIds[597], $cleanupIds[598], $cleanupIds[599], $cleanupIds[600], $cleanupIds[601], $cleanupIds[602], $cleanupIds[603], $cleanupIds[604], $cleanupIds[605], $cleanupIds[606], $cleanupIds[607], $cleanupIds[608], $cleanupIds[609], $cleanupIds[610], $cleanupIds[611], $cleanupIds[612], $cleanupIds[613], $cleanupIds[614], $cleanupIds[615], $cleanupIds[616], $cleanupIds[617], $cleanupIds[618], $cleanupIds[619], $cleanupIds[620], $cleanupIds[621], $cleanupIds[622], $cleanupIds[623], $cleanupIds[624], $cleanupIds[625], $cleanupIds[626], $cleanupIds[627], $cleanupIds[628], $cleanupIds[629], $cleanupIds[630], $cleanupIds[631], $cleanupIds[632], $cleanupIds[633], $cleanupIds[634], $cleanupIds[635], $cleanupIds[636], $cleanupIds[637], $cleanupIds[638], $cleanupIds[639], $cleanupIds[640], $cleanupIds[641], $cleanupIds[642], $cleanupIds[643], $cleanupIds[644], $cleanupIds[645], $cleanupIds[646], $cleanupIds[647], $cleanupIds[648], $cleanupIds[649], $cleanupIds[650], $cleanupIds[651], $cleanupIds[652], $cleanupIds[653], $cleanupIds[654], $cleanupIds[655], $cleanupIds[656], $cleanupIds[657], $cleanupIds[658], $cleanupIds[659], $cleanupIds[660], $cleanupIds[661], $cleanupIds[662], $cleanupIds[663], $cleanupIds[664], $cleanupIds[665], $cleanupIds[666], $cleanupIds[667], $cleanupIds[668], $cleanupIds[669], $cleanupIds[670], $cleanupIds[671], $cleanupIds[672], $cleanupIds[673], $cleanupIds[674], $cleanupIds[675], $cleanupIds[676], $cleanupIds[677], $cleanupIds[678], $cleanupIds[679], $cleanupIds[680], $cleanupIds[681], $cleanupIds[682], $cleanupIds[683], $cleanupIds[684], $cleanupIds[685], $cleanupIds[686], $cleanupIds[687], $cleanupIds[688], $cleanupIds[689], $cleanupIds[690], $cleanupIds[691], $cleanupIds[692], $cleanupIds[693], $cleanupIds[694], $cleanupIds[695], $cleanupIds[696], $cleanupIds[697], $cleanupIds[698], $cleanupIds[699], $cleanupIds[700], $cleanupIds[701], $cleanupIds[702], $cleanupIds[703], $cleanupIds[704], $cleanupIds[705], $cleanupIds[706], $cleanupIds[707], $cleanupIds[708], $cleanupIds[709], $cleanupIds[710], $cleanupIds[711], $cleanupIds[712], $cleanupIds[713], $cleanupIds[714], $cleanupIds[715], $cleanupIds[716], $cleanupIds[717], $cleanupIds[718], $cleanupIds[719], $cleanupIds[720], $cleanupIds[721], $cleanupIds[722], $cleanupIds[723], $cleanupIds[724], $cleanupIds[725], $cleanupIds[726], $cleanupIds[727], $cleanupIds[728], $cleanupIds[729], $cleanupIds[730], $cleanupIds[731], $cleanupIds[732], $cleanupIds[733], $cleanupIds[734], $cleanupIds[735], $cleanupIds[736], $cleanupIds[737], $cleanupIds[738], $cleanupIds[739], $cleanupIds[740], $cleanupIds[741], $cleanupIds[742], $cleanupIds[743], $cleanupIds[744], $cleanupIds[745], $cleanupIds[746], $cleanupIds[747], $cleanupIds[748], $cleanupIds[749], $cleanupIds[750], $cleanupIds[751], $cleanupIds[752], $cleanupIds[753], $cleanupIds[754], $cleanupIds[755], $cleanupIds[756], $cleanupIds[757], $cleanupIds[758], $cleanupIds[759], $cleanupIds[760], $cleanupIds[761], $cleanupIds[762], $cleanupIds[763], $cleanupIds[764], $cleanupIds[765], $cleanupIds[766], $cleanupIds[767], $cleanupIds[768], $cleanupIds[769], $cleanupIds[770], $cleanupIds[771], $cleanupIds[772], $cleanupIds[773], $cleanupIds[774], $cleanupIds[775], $cleanupIds[776], $cleanupIds[777], $cleanupIds[778], $cleanupIds[779], $cleanupIds[780], $cleanupIds[781], $cleanupIds[782], $cleanupIds[783], $cleanupIds[784], $cleanupIds[785], $cleanupIds[786], $cleanupIds[787], $cleanupIds[788], $cleanupIds[789], $cleanupIds[790], $cleanupIds[791], $cleanupIds[792], $cleanupIds[793], $cleanupIds[794], $cleanupIds[795], $cleanupIds[796], $cleanupIds[797], $cleanupIds[798], $cleanupIds[799], $cleanupIds[800], $cleanupIds[801], $cleanupIds[802], $cleanupIds[803], $cleanupIds[804], $cleanupIds[805], $cleanupIds[806], $cleanupIds[807], $cleanupIds[808], $cleanupIds[809], $cleanupIds[810], $cleanupIds[811], $cleanupIds[812], $cleanupIds[813], $cleanupIds[814], $cleanupIds[815], $cleanupIds[816], $cleanupIds[817], $cleanupIds[818], $cleanupIds[819], $cleanupIds[820], $cleanupIds[821], $cleanupIds[822], $cleanupIds[823], $cleanupIds[824], $cleanupIds[825], $cleanupIds[826], $cleanupIds[827], $cleanupIds[828], $cleanupIds[829], $cleanupIds[830], $cleanupIds[831], $cleanupIds[832], $cleanupIds[833], $cleanupIds[834], $cleanupIds[835], $cleanupIds[836], $cleanupIds[837], $cleanupIds[838], $cleanupIds[839], $cleanupIds[840], $cleanupIds[841], $cleanupIds[842], $cleanupIds[843], $cleanupIds[844], $cleanupIds[845], $cleanupIds[846], $cleanupIds[847], $cleanupIds[848], $cleanupIds[849], $cleanupIds[850], $cleanupIds[851], $cleanupIds[852], $cleanupIds[853], $cleanupIds[854], $cleanupIds[855], $cleanupIds[856], $cleanupIds[857], $cleanupIds[858], $cleanupIds[859], $cleanupIds[860], $cleanupIds[861], $cleanupIds[862], $cleanupIds[863], $cleanupIds[864], $cleanupIds[865], $cleanupIds[866], $cleanupIds[867], $cleanupIds[868], $cleanupIds[869], $cleanupIds[870], $cleanupIds[871], $cleanupIds[872], $cleanupIds[873], $cleanupIds[874], $cleanupIds[875], $cleanupIds[876], $cleanupIds[877], $cleanupIds[878], $cleanupIds[879], $cleanupIds[880], $cleanupIds[881], $cleanupIds[882], $cleanupIds[883], $cleanupIds[884], $cleanupIds[885], $cleanupIds[886], $cleanupIds[887], $cleanupIds[888], $cleanupIds[889], $cleanupIds[890], $cleanupIds[891], $cleanupIds[892], $cleanupIds[893], $cleanupIds[894], $cleanupIds[895], $cleanupIds[896], $cleanupIds[897], $cleanupIds[898], $cleanupIds[899], $cleanupIds[900], $cleanupIds[901], $cleanupIds[902], $cleanupIds[903], $cleanupIds[904], $cleanupIds[905], $cleanupIds[906], $cleanupIds[907], $cleanupIds[908], $cleanupIds[909], $cleanupIds[910], $cleanupIds[911], $cleanupIds[912], $cleanupIds[913], $cleanupIds[914], $cleanupIds[915], $cleanupIds[916], $cleanupIds[917], $cleanupIds[918], $cleanupIds[919], $cleanupIds[920], $cleanupIds[921], $cleanupIds[922], $cleanupIds[923], $cleanupIds[924], $cleanupIds[925], $cleanupIds[926], $cleanupIds[927], $cleanupIds[928], $cleanupIds[929], $cleanupIds[930], $cleanupIds[931], $cleanupIds[932], $cleanupIds[933], $cleanupIds[934], $cleanupIds[935], $cleanupIds[936], $cleanupIds[937], $cleanupIds[938], $cleanupIds[939], $cleanupIds[940], $cleanupIds[941], $cleanupIds[942], $cleanupIds[943], $cleanupIds[944], $cleanupIds[945], $cleanupIds[946], $cleanupIds[947], $cleanupIds[948], $cleanupIds[949], $cleanupIds[950], $cleanupIds[951], $cleanupIds[952], $cleanupIds[953], $cleanupIds[954], $cleanupIds[955], $cleanupIds[956], $cleanupIds[957], $cleanupIds[958], $cleanupIds[959], $cleanupIds[960], $cleanupIds[961], $cleanupIds[962], $cleanupIds[963], $cleanupIds[964], $cleanupIds[965], $cleanupIds[966], $cleanupIds[967], $cleanupIds[968], $cleanupIds[969], $cleanupIds[970], $cleanupIds[971], $cleanupIds[972], $cleanupIds[973], $cleanupIds[974], $cleanupIds[975], $cleanupIds[976], $cleanupIds[977], $cleanupIds[978], $cleanupIds[979], $cleanupIds[980], $cleanupIds[981], $cleanupIds[982], $cleanupIds[983], $cleanupIds[984], $cleanupIds[985], $cleanupIds[986], $cleanupIds[987], $cleanupIds[988], $cleanupIds[989], $cleanupIds[990], $cleanupIds[991], $cleanupIds[992], $cleanupIds[993], $cleanupIds[994], $cleanupIds[995], $cleanupIds[996], $cleanupIds[997], $cleanupIds[998], $cleanupIds[999], $cleanupIds[1000], $cleanupIds[1001], $cleanupIds[1002], $cleanupIds[1003], $cleanupIds[1004], $cleanupIds[1005], $cleanupIds[1006], $cleanupIds[1007], $cleanupIds[1008], $cleanupIds[1009], $cleanupIds[1010], $cleanupIds[1011], $cleanupIds[1012], $cleanupIds[1013], $cleanupIds[1014], $cleanupIds[1015], $cleanupIds[1016], $cleanupIds[1017], $cleanupIds[1018], $cleanupIds[1019], $cleanupIds[1020], $cleanupIds[1021], $cleanupIds[1022], $cleanupIds[1023], $cleanupIds[1024], $cleanupIds[1025], $cleanupIds[1026], $cleanupIds[1027], $cleanupIds[1028], $cleanupIds[1029], $cleanupIds[1030], $cleanupIds[1031], $cleanupIds[1032], $cleanupIds[1033], $cleanupIds[1034], $cleanupIds[1035], $cleanupIds[1036], $cleanupIds[1037], $cleanupIds[1038], $cleanupIds[1039], $cleanupIds[1040], $cleanupIds[1041], $cleanupIds[1042], $cleanupIds[1043], $cleanupIds[1044], $cleanupIds[1045], $cleanupIds[1046], $cleanupIds[1047], $cleanupIds[1048], $cleanupIds[1049], $cleanupIds[1050], $cleanupIds[1051], $cleanupIds[1052], $cleanupIds[1053], $cleanupIds[1054], $cleanupIds[1055], $cleanupIds[1056], $cleanupIds[1057], $cleanupIds[1058], $cleanupIds[1059], $cleanupIds[1060], $cleanupIds[1061], $cleanupIds[1062], $cleanupIds[1063], $cleanupIds[1064], $cleanupIds[1065], $cleanupIds[1066], $cleanupIds[1067], $cleanupIds[1068], $cleanupIds[1069], $cleanupIds[1070], $cleanupIds[1071], $cleanupIds[1072], $cleanupIds[1073], $cleanupIds[1074], $cleanupIds[1075], $cleanupIds[1076], $cleanupIds[1077], $cleanupIds[1078], $cleanupIds[1079], $cleanupIds[1080], $cleanupIds[1081], $cleanupIds[1082], $cleanupIds[1083], $cleanupIds[1084], $cleanupIds[1085], $cleanupIds[1086], $cleanupIds[1087], $cleanupIds[1088], $cleanupIds[1089], $cleanupIds[1090], $cleanupIds[1091], $cleanupIds[1092], $cleanupIds[1093], $cleanupIds[1094], $cleanupIds[1095], $cleanupIds[1096], $cleanupIds[1097], $cleanupIds[1098], $cleanupIds[1099], $cleanupIds[1100], $cleanupIds[1101], $cleanupIds[1102], $cleanupIds[1103], $cleanupIds[1104], $cleanupIds[1105], $cleanupIds[1106], $cleanupIds[1107], $cleanupIds[1108], $cleanupIds[1109], $cleanupIds[1110], $cleanupIds[1111], $cleanupIds[1112], $cleanupIds[1113], $cleanupIds[1114], $cleanupIds[1115], $cleanupIds[1116], $cleanupIds[1117], $cleanupIds[1118], $cleanupIds[1119], $cleanupIds[1120], $cleanupIds[1121], $cleanupIds[1122], $cleanupIds[1123], $cleanupIds[1124], $cleanupIds[1125], $cleanupIds[1126], $cleanupIds[1127], $cleanupIds[1128], $cleanupIds[1129], $cleanupIds[1130], $cleanupIds[1131], $cleanupIds[1132], $cleanupIds[1133], $cleanupIds[1134], $cleanupIds[1135], $cleanupIds[1136], $cleanupIds[1137], $cleanupIds[1138], $cleanupIds[1139], $cleanupIds[1140], $cleanupIds[1141], $cleanupIds[1142], $cleanupIds[1143], $cleanupIds[1144], $cleanupIds[1145], $cleanupIds[1146], $cleanupIds[1147], $cleanupIds[1148], $cleanupIds[1149], $cleanupIds[1150], $cleanupIds[1151], $cleanupIds[1152], $cleanupIds[1153], $cleanupIds[1154], $cleanupIds[1155], $cleanupIds[1156], $cleanupIds[1157], $cleanupIds[1158], $cleanupIds[1159], $cleanupIds[1160], $cleanupIds[1161], $cleanupIds[1162], $cleanupIds[1163], $cleanupIds[1164], $cleanupIds[1165], $cleanupIds[1166], $cleanupIds[1167], $cleanupIds[1168], $cleanupIds[1169], $cleanupIds[1170], $cleanupIds[1171], $cleanupIds[1172], $cleanupIds[1173], $cleanupIds[1174], $cleanupIds[1175], $cleanupIds[1176], $cleanupIds[1177], $cleanupIds[1178], $cleanupIds[1179], $cleanupIds[1180], $cleanupIds[1181], $cleanupIds[1182], $cleanupIds[1183], $cleanupIds[1184], $cleanupIds[1185], $cleanupIds[1186], $cleanupIds[1187], $cleanupIds[1188], $cleanupIds[1189], $cleanupIds[1190], $cleanupIds[1191], $cleanupIds[1192], $cleanupIds[1193], $cleanupIds[1194], $cleanupIds[1195], $cleanupIds[1196], $cleanupIds[1197], $cleanupIds[1198], $cleanupIds[1199], $cleanupIds[1200], $cleanupIds[1201], $cleanupIds[1202], $cleanupIds[1203], $cleanupIds[1204], $cleanupIds[1205], $cleanupIds[1206], $cleanupIds[1207], $cleanupIds[1208], $cleanupIds[1209], $cleanupIds[1210], $cleanupIds[1211], $cleanupIds[1212], $cleanupIds[1213], $cleanupIds[1214], $cleanupIds[1215], $cleanupIds[1216], $cleanupIds[1217], $cleanupIds[1218], $cleanupIds[1219], $cleanupIds[1220], $cleanupIds[1221], $cleanupIds[1222], $cleanupIds[1223], $cleanupIds[1224], $cleanupIds[1225], $cleanupIds[1226], $cleanupIds[1227], $cleanupIds[1228], $cleanupIds[1229], $cleanupIds[1230], $cleanupIds[1231], $cleanupIds[1232], $cleanupIds[1233], $cleanupIds[1234], $cleanupIds[1235], $cleanupIds[1236], $cleanupIds[1237], $cleanupIds[1238], $cleanupIds[1239], $cleanupIds[1240], $cleanupIds[1241], $cleanupIds[1242], $cleanupIds[1243], $cleanupIds[1244], $cleanupIds[1245], $cleanupIds[1246], $cleanupIds[1247], $cleanupIds[1248], $cleanupIds[1249], $cleanupIds[1250], $cleanupIds[1251], $cleanupIds[1252], $cleanupIds[1253], $cleanupIds[1254], $cleanupIds[1255], $cleanupIds[1256], $cleanupIds[1257], $cleanupIds[1258], $cleanupIds[1259], $cleanupIds[1260], $cleanupIds[1261], $cleanupIds[1262], $cleanupIds[1263], $cleanupIds[1264], $cleanupIds[1265], $cleanupIds[1266], $cleanupIds[1267], $cleanupIds[1268], $cleanupIds[1269], $cleanupIds[1270], $cleanupIds[1271], $cleanupIds[1272], $cleanupIds[1273], $cleanupIds[1274], $cleanupIds[1275], $cleanupIds[1276], $cleanupIds[1277], $cleanupIds[1278], $cleanupIds[1279], $cleanupIds[1280], $cleanupIds[1281], $cleanupIds[1282], $cleanupIds[1283], $cleanupIds[1284], $cleanupIds[1285], $cleanupIds[1286], $cleanupIds[1287], $cleanupIds[1288], $cleanupIds[1289], $cleanupIds[1290], $cleanupIds[1291], $cleanupIds[1292], $cleanupIds[1293], $cleanupIds[1294], $cleanupIds[1295], $cleanupIds[1296], $cleanupIds[1297], $cleanupIds[1298], $cleanupIds[1299], $cleanupIds[1300], $cleanupIds[1301], $cleanupIds[1302], $cleanupIds[1303], $cleanupIds[1304], $cleanupIds[1305], $cleanupIds[1306], $cleanupIds[1307], $cleanupIds[1308], $cleanupIds[1309], $cleanupIds[1310], $cleanupIds[1311], $cleanupIds[1312], $cleanupIds[1313], $cleanupIds[1314], $cleanupIds[1315], $cleanupIds[1316], $cleanupIds[1317], $cleanupIds[1318], $cleanupIds[1319], $cleanupIds[1320], $cleanupIds[1321], $cleanupIds[1322], $cleanupIds[1323], $cleanupIds[1324], $cleanupIds[1325], $cleanupIds[1326], $cleanupIds[1327], $cleanupIds[1328], $cleanupIds[1329], $cleanupIds[1330], $cleanupIds[1331], $cleanupIds[1332], $cleanupIds[1333], $cleanupIds[1334], $cleanupIds[1335], $cleanupIds[1336], $cleanupIds[1337], $cleanupIds[1338], $cleanupIds[1339], $cleanupIds[1340], $cleanupIds[1341], $cleanupIds[1342], $cleanupIds[1343], $cleanupIds[1344], $cleanupIds[1345], $cleanupIds[1346], $cleanupIds[1347], $cleanupIds[1348], $cleanupIds[1349], $cleanupIds[1350], $cleanupIds[1351], $cleanupIds[1352], $cleanupIds[1353], $cleanupIds[1354], $cleanupIds[1355], $cleanupIds[1356], $cleanupIds[1357], $cleanupIds[1358], $cleanupIds[1359], $cleanupIds[1360], $cleanupIds[1361], $cleanupIds[1362], $cleanupIds[1363], $cleanupIds[1364], $cleanupIds[1365], $cleanupIds[1366], $cleanupIds[1367], $cleanupIds[1368], $cleanupIds[1369], $cleanupIds[1370], $cleanupIds[1371], $cleanupIds[1372], $cleanupIds[1373], $cleanupIds[1374], $cleanupIds[1375], $cleanupIds[1376], $cleanupIds[1377], $cleanupIds[1378], $cleanupIds[1379], $cleanupIds[1380], $cleanupIds[1381], $cleanupIds[1382], $cleanupIds[1383], $cleanupIds[1384], $cleanupIds[1385], $cleanupIds[1386], $cleanupIds[1387], $cleanupIds[1388], $cleanupIds[1389], $cleanupIds[1390], $cleanupIds[1391], $cleanupIds[1392], $cleanupIds[1393], $cleanupIds[1394], $cleanupIds[1395], $cleanupIds[1396], $cleanupIds[1397], $cleanupIds[1398], $cleanupIds[1399], $cleanupIds[1400], $cleanupIds[1401], $cleanupIds[1402], $cleanupIds[1403], $cleanupIds[1404], $cleanupIds[1405], $cleanupIds[1406], $cleanupIds[1407], $cleanupIds[1408], $cleanupIds[1409], $cleanupIds[1410], $cleanupIds[1411], $cleanupIds[1412], $cleanupIds[1413], $cleanupIds[1414], $cleanupIds[1415], $cleanupIds[1416], $cleanupIds[1417], $cleanupIds[1418], $cleanupIds[1419], $cleanupIds[1420], $cleanupIds[1421], $cleanupIds[1422], $cleanupIds[1423], $cleanupIds[1424], $cleanupIds[1425], $cleanupIds[1426], $cleanupIds[1427], $cleanupIds[1428], $cleanupIds[1429], $cleanupIds[1430], $cleanupIds[1431], $cleanupIds[1432], $cleanupIds[1433], $cleanupIds[1434], $cleanupIds[1435], $cleanupIds[1436], $cleanupIds[1437], $cleanupIds[1438], $cleanupIds[1439], $cleanupIds[1440], $cleanupIds[1441], $cleanupIds[1442], $cleanupIds[1443], $cleanupIds[1444], $cleanupIds[1445], $cleanupIds[1446], $cleanupIds[1447], $cleanupIds[1448], $cleanupIds[1449], $cleanupIds[1450], $cleanupIds[1451], $cleanupIds[1452], $cleanupIds[1453], $cleanupIds[1454], $cleanupIds[1455], $cleanupIds[1456], $cleanupIds[1457], $cleanupIds[1458], $cleanupIds[1459], $cleanupIds[1460], $cleanupIds[1461], $cleanupIds[1462], $cleanupIds[1463], $cleanupIds[1464], $cleanupIds[1465], $cleanupIds[1466], $cleanupIds[1467], $cleanupIds[1468], $cleanupIds[1469], $cleanupIds[1470], $cleanupIds[1471], $cleanupIds[1472], $cleanupIds[1473], $cleanupIds[1474], $cleanupIds[1475], $cleanupIds[1476], $cleanupIds[1477], $cleanupIds[1478], $cleanupIds[1479], $cleanupIds[1480], $cleanupIds[1481], $cleanupIds[1482], $cleanupIds[1483], $cleanupIds[1484], $cleanupIds[1485], $cleanupIds[1486], $cleanupIds[1487], $cleanupIds[1488], $cleanupIds[1489], $cleanupIds[1490], $cleanupIds[1491], $cleanupIds[1492], $cleanupIds[1493], $cleanupIds[1494], $cleanupIds[1495], $cleanupIds[1496], $cleanupIds[1497], $cleanupIds[1498], $cleanupIds[1499], $cleanupIds[1500], $cleanupIds[1501], $cleanupIds[1502], $cleanupIds[1503], $cleanupIds[1504], $cleanupIds[1505], $cleanupIds[1506], $cleanupIds[1507], $cleanupIds[1508], $cleanupIds[1509], $cleanupIds[1510], $cleanupIds[1511], $cleanupIds[1512], $cleanupIds[1513], $cleanupIds[1514], $cleanupIds[1515], $cleanupIds[1516], $cleanupIds[1517], $cleanupIds[1518], $cleanupIds[1519], $cleanupIds[1520], $cleanupIds[1521], $cleanupIds[1522], $cleanupIds[1523], $cleanupIds[1524], $cleanupIds[1525], $cleanupIds[1526], $cleanupIds[1527], $cleanupIds[1528], $cleanupIds[1529], $cleanupIds[1530], $cleanupIds[1531], $cleanupIds[1532], $cleanupIds[1533], $cleanupIds[1534], $cleanupIds[1535], $cleanupIds[1536], $cleanupIds[1537], $cleanupIds[1538], $cleanupIds[1539], $cleanupIds[1540], $cleanupIds[1541], $cleanupIds[1542], $cleanupIds[1543], $cleanupIds[1544], $cleanupIds[1545], $cleanupIds[1546], $cleanupIds[1547], $cleanupIds[1548], $cleanupIds[1549], $cleanupIds[1550], $cleanupIds[1551], $cleanupIds[1552], $cleanupIds[1553], $cleanupIds[1554], $cleanupIds[1555], $cleanupIds[1556], $cleanupIds[1557], $cleanupIds[1558], $cleanupIds[1559], $cleanupIds[1560], $cleanupIds[1561], $cleanupIds[1562], $cleanupIds[1563], $cleanupIds[1564], $cleanupIds[1565], $cleanupIds[1566], $cleanupIds[1567], $cleanupIds[1568], $cleanupIds[1569], $cleanupIds[1570], $cleanupIds[1571], $cleanupIds[1572], $cleanupIds[1573], $cleanupIds[1574], $cleanupIds[1575], $cleanupIds[1576], $cleanupIds[1577], $cleanupIds[1578], $cleanupIds[1579], $cleanupIds[1580], $cleanupIds[1581], $cleanupIds[1582], $cleanupIds[1583], $cleanupIds[1584], $cleanupIds[1585], $cleanupIds[1586], $cleanupIds[1587], $cleanupIds[1588], $cleanupIds[1589], $cleanupIds[1590], $cleanupIds[1591], $cleanupIds[1592], $cleanupIds[1593], $cleanupIds[1594], $cleanupIds[1595], $cleanupIds[1596], $cleanupIds[1597], $cleanupIds[1598], $cleanupIds[1599], $cleanupIds[1600], $cleanupIds[1601], $cleanupIds[1602], $cleanupIds[1603], $cleanupIds[1604], $cleanupIds[1605], $cleanupIds[1606], $cleanupIds[1607], $cleanupIds[1608], $cleanupIds[1609], $cleanupIds[1610], $cleanupIds[1611], $cleanupIds[1612], $cleanupIds[1613], $cleanupIds[1614], $cleanupIds[1615], $cleanupIds[1616], $cleanupIds[1617], $cleanupIds[1618], $cleanupIds[1619], $cleanupIds[1620], $cleanupIds[1621], $cleanupIds[1622], $cleanupIds[1623], $cleanupIds[1624], $cleanupIds[1625], $cleanupIds[1626], $cleanupIds[1627], $cleanupIds[1628], $cleanupIds[1629], $cleanupIds[1630], $cleanupIds[1631], $cleanupIds[1632], $cleanupIds[1633], $cleanupIds[1634], $cleanupIds[1635], $cleanupIds[1636], $cleanupIds[1637], $cleanupIds[1638], $cleanupIds[1639], $cleanupIds[1640], $cleanupIds[1641], $cleanupIds[1642], $cleanupIds[1643], $cleanupIds[1644], $cleanupIds[1645], $cleanupIds[1646], $cleanupIds[1647], $cleanupIds[1648], $cleanupIds[1649], $cleanupIds[1650], $cleanupIds[1651], $cleanupIds[1652], $cleanupIds[1653], $cleanupIds[1654], $cleanupIds[1655], $cleanupIds[1656], $cleanupIds[1657], $cleanupIds[1658], $cleanupIds[1659], $cleanupIds[1660], $cleanupIds[1661], $cleanupIds[1662], $cleanupIds[1663], $cleanupIds[1664], $cleanupIds[1665], $cleanupIds[1666], $cleanupIds[1667], $cleanupIds[1668], $cleanupIds[1669], $cleanupIds[1670], $cleanupIds[1671], $cleanupIds[1672], $cleanupIds[1673], $cleanupIds[1674], $cleanupIds[1675], $cleanupIds[1676], $cleanupIds[1677], $cleanupIds[1678], $cleanupIds[1679], $cleanupIds[1680], $cleanupIds[1681], $cleanupIds[1682], $cleanupIds[1683], $cleanupIds[1684], $cleanupIds[1685], $cleanupIds[1686], $cleanupIds[1687], $cleanupIds[1688], $cleanupIds[1689], $cleanupIds[1690], $cleanupIds[1691], $cleanupIds[1692], $cleanupIds[1693], $cleanupIds[1694], $cleanupIds[1695], $cleanupIds[1696], $cleanupIds[1697], $cleanupIds[1698], $cleanupIds[1699], $cleanupIds[1700], $cleanupIds[1701], $cleanupIds[1702], $cleanupIds[1703], $cleanupIds[1704], $cleanupIds[1705], $cleanupIds[1706], $cleanupIds[1707], $cleanupIds[1708], $cleanupIds[1709], $cleanupIds[1710], $cleanupIds[1711], $cleanupIds[1712], $cleanupIds[1713], $cleanupIds[1714], $cleanupIds[1715], $cleanupIds[1716], $cleanupIds[1717], $cleanupIds[1718], $cleanupIds[1719], $cleanupIds[1720], $cleanupIds[1721], $cleanupIds[1722], $cleanupIds[1723], $cleanupIds[1724], $cleanupIds[1725], $cleanupIds[1726], $cleanupIds[1727], $cleanupIds[1728], $cleanupIds[1729], $cleanupIds[1730], $cleanupIds[1731], $cleanupIds[1732], $cleanupIds[1733], $cleanupIds[1734], $cleanupIds[1735], $cleanupIds[1736], $cleanupIds[1737], $cleanupIds[1738], $cleanupIds[1739], $cleanupIds[1740], $cleanupIds[1741], $cleanupIds[1742], $cleanupIds[1743], $cleanupIds[1744], $cleanupIds[1745], $cleanupIds[1746], $cleanupIds[1747], $cleanupIds[1748], $cleanupIds[1749], $cleanupIds[1750], $cleanupIds[1751], $cleanupIds[1752], $cleanupIds[1753], $cleanupIds[1754], $cleanupIds[1755], $cleanupIds[1756], $cleanupIds[1757], $cleanupIds[1758], $cleanupIds[1759], $cleanupIds[1760], $cleanupIds[1761], $cleanupIds[1762], $cleanupIds[1763], $cleanupIds[1764], $cleanupIds[1765], $cleanupIds[1766], $cleanupIds[1767], $cleanupIds[1768], $cleanupIds[1769], $cleanupIds[1770], $cleanupIds[1771], $cleanupIds[1772], $cleanupIds[1773], $cleanupIds[1774], $cleanupIds[1775], $cleanupIds[1776], $cleanupIds[1777], $cleanupIds[1778], $cleanupIds[1779], $cleanupIds[1780], $cleanupIds[1781], $cleanupIds[1782], $cleanupIds[1783], $cleanupIds[1784], $cleanupIds[1785], $cleanupIds[1786], $cleanupIds[1787], $cleanupIds[1788], $cleanupIds[1789], $cleanupIds[1790], $cleanupIds[1791], $cleanupIds[1792], $cleanupIds[1793], $cleanupIds[1794], $cleanupIds[1795], $cleanupIds[1796], $cleanupIds[1797], $cleanupIds[1798], $cleanupIds[1799], $cleanupIds[1800], $cleanupIds[1801], $cleanupIds[1802], $cleanupIds[1803], $cleanupIds[1804], $cleanupIds[1805], $cleanupIds[1806], $cleanupIds[1807], $cleanupIds[1808], $cleanupIds[1809], $cleanupIds[1810], $cleanupIds[1811], $cleanupIds[1812], $cleanupIds[1813], $cleanupIds[1814], $cleanupIds[1815], $cleanupIds[1816], $cleanupIds[1817], $cleanupIds[1818], $cleanupIds[1819], $cleanupIds[1820], $cleanupIds[1821], $cleanupIds[1822], $cleanupIds[1823], $cleanupIds[1824], $cleanupIds[1825], $cleanupIds[1826], $cleanupIds[1827], $cleanupIds[1828], $cleanupIds[1829], $cleanupIds[1830], $cleanupIds[1831], $cleanupIds[1832], $cleanupIds[1833], $cleanupIds[1834], $cleanupIds[1835], $cleanupIds[1836], $cleanupIds[1837], $cleanupIds[1838], $cleanupIds[1839], $cleanupIds[1840], $cleanupIds[1841], $cleanupIds[1842], $cleanupIds[1843], $cleanupIds[1844], $cleanupIds[1845], $cleanupIds[1846], $cleanupIds[1847], $cleanupIds[1848], $cleanupIds[1849], $cleanupIds[1850], $cleanupIds[1851], $cleanupIds[1852], $cleanupIds[1853], $cleanupIds[1854], $cleanupIds[1855], $cleanupIds[1856], $cleanupIds[1857], $cleanupIds[1858], $cleanupIds[1859], $cleanupIds[1860], $cleanupIds[1861], $cleanupIds[1862], $cleanupIds[1863], $cleanupIds[1864], $cleanupIds[1865], $cleanupIds[1866], $cleanupIds[1867], $cleanupIds[1868], $cleanupIds[1869], $cleanupIds[1870], $cleanupIds[1871], $cleanupIds[1872], $cleanupIds[1873], $cleanupIds[1874], $cleanupIds[1875], $cleanupIds[1876], $cleanupIds[1877], $cleanupIds[1878], $cleanupIds[1879], $cleanupIds[1880], $cleanupIds[1881], $cleanupIds[1882], $cleanupIds[1883], $cleanupIds[1884], $cleanupIds[1885], $cleanupIds[1886], $cleanupIds[1887], $cleanupIds[1888], $cleanupIds[1889], $cleanupIds[1890], $cleanupIds[1891], $cleanupIds[1892], $cleanupIds[1893], $cleanupIds[1894], $cleanupIds[1895], $cleanupIds[1896], $cleanupIds[1897], $cleanupIds[1898], $cleanupIds[1899], $cleanupIds[1900], $cleanupIds[1901], $cleanupIds[1902], $cleanupIds[1903], $cleanupIds[1904], $cleanupIds[1905], $cleanupIds[1906], $cleanupIds[1907], $cleanupIds[1908], $cleanupIds[1909], $cleanupIds[1910], $cleanupIds[1911], $cleanupIds[1912], $cleanupIds[1913], $cleanupIds[1914], $cleanupIds[1915], $cleanupIds[1916], $cleanupIds[1917], $cleanupIds[1918], $cleanupIds[1919], $cleanupIds[1920], $cleanupIds[1921], $cleanupIds[1922], $cleanupIds[1923], $cleanupIds[1924], $cleanupIds[1925], $cleanupIds[1926], $cleanupIds[1927], $cleanupIds[1928], $cleanupIds[1929], $cleanupIds[1930], $cleanupIds[1931], $cleanupIds[1932], $cleanupIds[1933], $cleanupIds[1934], $cleanupIds[1935], $cleanupIds[1936], $cleanupIds[1937], $cleanupIds[1938], $cleanupIds[1939], $cleanupIds[1940], $cleanupIds[1941], $cleanupIds[1942], $cleanupIds[1943], $cleanupIds[1944], $cleanupIds[1945], $cleanupIds[1946], $cleanupIds[1947], $cleanupIds[1948], $cleanupIds[1949], $cleanupIds[1950], $cleanupIds[1951], $cleanupIds[1952], $cleanupIds[1953], $cleanupIds[1954], $cleanupIds[1955], $cleanupIds[1956], $cleanupIds[1957], $cleanupIds[1958], $cleanupIds[1959], $cleanupIds[1960], $cleanupIds[1961], $cleanupIds[1962], $cleanupIds[1963], $cleanupIds[1964], $cleanupIds[1965], $cleanupIds[1966], $cleanupIds[1967], $cleanupIds[1968], $cleanupIds[1969], $cleanupIds[1970], $cleanupIds[1971], $cleanupIds[1972], $cleanupIds[1973], $cleanupIds[1974], $cleanupIds[1975], $cleanupIds[1976], $cleanupIds[1977], $cleanupIds[1978], $cleanupIds[1979], $cleanupIds[1980], $cleanupIds[1981], $cleanupIds[1982], $cleanupIds[1983], $cleanupIds[1984], $cleanupIds[1985], $cleanupIds[1986], $cleanupIds[1987], $cleanupIds[1988], $cleanupIds[1989], $cleanupIds[1990], $cleanupIds[1991], $cleanupIds[1992], $cleanupIds[1993], $cleanupIds[1994], $cleanupIds[1995], $cleanupIds[1996], $cleanupIds[1997], $cleanupIds[1998], $cleanupIds[1999], $cleanupIds[2000], $cleanupIds[2001], $cleanupIds[2002], $cleanupIds[2003], $cleanupIds[2004], $cleanupIds[2005], $cleanupIds[2006]); - - /* execute query */ - $stmt->execute(); - - /* close statement */ - $stmt->close(); - } - - mysqli_close($link); - print "done!"; -?> ---CLEAN-- - ---EXPECTF-- -done! diff --git a/ext/mysqlnd/config9.m4 b/ext/mysqlnd/config9.m4 index 0e08b977af94d..3fc767b231d68 100644 --- a/ext/mysqlnd/config9.m4 +++ b/ext/mysqlnd/config9.m4 @@ -8,11 +8,11 @@ PHP_ARG_ENABLE(mysqlnd, whether to enable mysqlnd, PHP_ARG_ENABLE(mysqlnd_compression_support, whether to disable compressed protocol support in mysqlnd, [ --disable-mysqlnd-compression-support - Disable support for the MySQL compressed protocol in mysqlnd], yes, no) + Disable support for the MySQL compressed protocol in mysqlnd], yes, no) if test -z "$PHP_ZLIB_DIR"; then PHP_ARG_WITH(zlib-dir, for the location of libz, - [ --with-zlib-dir[=DIR] mysqlnd: Set the path to libz install prefix], no, no) + [ --with-zlib-dir[=DIR] mysqlnd: Set the path to libz install prefix], no, no) fi dnl If some extension uses mysqlnd it will get compiled in PHP core @@ -48,4 +48,16 @@ fi if test "$PHP_MYSQLND" != "no" || test "$PHP_MYSQLND_ENABLED" = "yes" || test "$PHP_MYSQLI" != "no"; then PHP_ADD_BUILD_DIR([ext/mysqlnd], 1) + + dnl This creates a file so it has to be after above macros + PHP_CHECK_TYPES([int8 uint8 int16 uint16 int32 uint32 uchar ulong int8_t uint8_t int16_t uint16_t int32_t uint32_t int64_t uint64_t], [ + ext/mysqlnd/php_mysqlnd_config.h + ],[ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_STDINT_H +#include +#endif + ]) fi diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index b41e5424f590e..1d4e387d2317e 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -1180,7 +1180,7 @@ static enum_func_status MYSQLND_METHOD(mysqlnd_conn_data, send_query)(MYSQLND_CONN_DATA * conn, const char * query, unsigned int query_len TSRMLS_DC) { size_t this_func = STRUCT_OFFSET(struct st_mysqlnd_conn_data_methods, send_query); - enum_func_status ret = FAIL; + enum_func_status ret; DBG_ENTER("mysqlnd_conn_data::send_query"); DBG_INF_FMT("conn=%llu query=%s", conn->thread_id, query); @@ -1225,7 +1225,6 @@ MYSQLND_METHOD(mysqlnd_conn_data, reap_query)(MYSQLND_CONN_DATA * conn TSRMLS_DC #include "php_network.h" -/* {{{ mysqlnd_stream_array_to_fd_set */ MYSQLND ** mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array TSRMLS_DC) { int cnt = 0; @@ -1256,17 +1255,14 @@ MYSQLND ** mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array TSRMLS } return ret; } -/* }}} */ -/* {{{ mysqlnd_stream_array_to_fd_set */ +/* {{{ stream_select mysqlnd_stream_array_to_fd_set functions */ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, php_socket_t * max_fd TSRMLS_DC) { php_socket_t this_fd; - php_stream *stream = NULL; - unsigned int cnt = 0; + int cnt = 0; MYSQLND **p = conn_array; - DBG_ENTER("mysqlnd_stream_array_to_fd_set"); while (*p) { /* get the fd. @@ -1274,9 +1270,7 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p * when casting. It is only used here so that the buffered data warning * is not displayed. * */ - stream = (*p)->data->net->data->m.get_stream((*p)->data->net TSRMLS_CC); - DBG_INF_FMT("conn=%llu stream=%p", (*p)->data->thread_id, stream); - if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, + if (SUCCESS == php_stream_cast((*p)->data->net->data->m.get_stream((*p)->data->net TSRMLS_CC), PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd >= 0) { PHP_SAFE_FD_SET(this_fd, fds); @@ -1288,25 +1282,20 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p } p++; } - DBG_RETURN(cnt ? 1 : 0); + return cnt ? 1 : 0; } -/* }}} */ - -/* {{{ mysqlnd_stream_array_from_fd_set */ static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds TSRMLS_DC) { php_socket_t this_fd; - php_stream *stream = NULL; int ret = 0; zend_bool disproportion = FALSE; + + MYSQLND **fwd = conn_array, **bckwd = conn_array; - DBG_ENTER("mysqlnd_stream_array_from_fd_set"); while (*fwd) { - stream = (*fwd)->data->net->data->m.get_stream((*fwd)->data->net TSRMLS_CC); - DBG_INF_FMT("conn=%llu stream=%p", (*fwd)->data->thread_id, stream); - if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, + if (SUCCESS == php_stream_cast((*fwd)->data->net->data->m.get_stream((*fwd)->data->net TSRMLS_CC), PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd >= 0) { if (PHP_SAFE_FD_ISSET(this_fd, fds)) { if (disproportion) { @@ -1323,7 +1312,7 @@ static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds } *bckwd = NULL;/* NULL-terminate the list */ - DBG_RETURN(ret); + return ret; } /* }}} */ @@ -1598,7 +1587,7 @@ static ulong MYSQLND_METHOD(mysqlnd_conn_data, escape_string)(MYSQLND_CONN_DATA * const conn, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC) { size_t this_func = STRUCT_OFFSET(struct st_mysqlnd_conn_data_methods, escape_string); - ulong ret = FAIL; + ulong ret; DBG_ENTER("mysqlnd_conn_data::escape_string"); DBG_INF_FMT("conn=%llu", conn->thread_id); diff --git a/ext/mysqlnd/mysqlnd_enum_n_def.h b/ext/mysqlnd/mysqlnd_enum_n_def.h index c9127ef93c0ca..4ace69adcf9a0 100644 --- a/ext/mysqlnd/mysqlnd_enum_n_def.h +++ b/ext/mysqlnd/mysqlnd_enum_n_def.h @@ -104,7 +104,7 @@ #define MYSQLND_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_TRANSACTIONS | \ CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION | \ - CLIENT_MULTI_RESULTS | CLIENT_LOCAL_FILES | CLIENT_PLUGIN_AUTH) + CLIENT_MULTI_RESULTS | CLIENT_PS_MULTI_RESULTS | CLIENT_LOCAL_FILES | CLIENT_PLUGIN_AUTH) #define MYSQLND_NET_FLAG_USE_COMPRESSION 1 diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c index fabceb4c8d661..ba2b1745ef490 100644 --- a/ext/mysqlnd/mysqlnd_net.c +++ b/ext/mysqlnd/mysqlnd_net.c @@ -805,7 +805,7 @@ MYSQLND_METHOD(mysqlnd_net, consume_uneaten_data)(MYSQLND_NET * const net, enum /* Switch to non-blocking mode and try to consume something from the line, if possible, then continue. This saves us from looking for - the actual place where out-of-order packets have been sent. + the actuall place where out-of-order packets have been sent. If someone is completely sure that everything is fine, he can switch it off. */ diff --git a/ext/mysqlnd/mysqlnd_portability.h b/ext/mysqlnd/mysqlnd_portability.h index 72a156a79500d..b9479150ae03a 100644 --- a/ext/mysqlnd/mysqlnd_portability.h +++ b/ext/mysqlnd/mysqlnd_portability.h @@ -36,6 +36,8 @@ This file is public domain and comes with NO WARRANTY of any kind */ #if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32) # include "ext/mysqlnd/config-win.h" +#else +# include #endif /* _WIN32... */ #if __STDC_VERSION__ < 199901L && !defined(atoll) @@ -43,7 +45,14 @@ This file is public domain and comes with NO WARRANTY of any kind */ #define atoll atol #endif -#include "php_stdint.h" + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif #if SIZEOF_LONG_LONG > 4 && !defined(_LONG_LONG) #define _LONG_LONG 1 /* For AIX string library */ @@ -61,6 +70,102 @@ This file is public domain and comes with NO WARRANTY of any kind */ #define HAVE_LONG_LONG 1 #endif + +/* Typdefs for easyier portability */ +#ifndef HAVE_INT8_T +#ifndef HAVE_INT8 +typedef signed char int8_t; /* Signed integer >= 8 bits */ +#else +typedef int8 int8_t; /* Signed integer >= 8 bits */ +#endif +#endif + +#ifndef HAVE_UINT8_T +#ifndef HAVE_UINT8 +typedef unsigned char uint8_t; /* Unsigned integer >= 8 bits */ +#else +typedef uint8 uint8_t; /* Signed integer >= 8 bits */ +#endif +#endif + +#ifndef HAVE_INT16_T +#ifndef HAVE_INT16 +typedef signed short int16_t; /* Signed integer >= 16 bits */ +#else +typedef int16 int16_t; /* Signed integer >= 16 bits */ +#endif +#endif + +#ifndef HAVE_UINT16_T +#ifndef HAVE_UINT16 +typedef unsigned short uint16_t; /* Signed integer >= 16 bits */ +#else +typedef uint16 uint16_t; /* Signed integer >= 16 bits */ +#endif +#endif + + +#ifndef HAVE_INT32_T +#ifdef HAVE_INT32 +typedef int32 int32_t; +#elif SIZEOF_INT == 4 +typedef signed int int32_t; +#elif SIZEOF_LONG == 4 +typedef signed long int32_t; +#else +error "Neither int nor long is of 4 bytes width" +#endif +#endif /* HAVE_INT32_T */ + +#ifndef HAVE_UINT32_T +#ifdef HAVE_UINT32 +typedef uint32 uint32_t; +#elif SIZEOF_INT == 4 +typedef unsigned int uint32_t; +#elif SIZEOF_LONG == 4 +typedef unsigned long uint32_t; +#else +#error "Neither int nor long is of 4 bytes width" +#endif +#endif /* HAVE_UINT32_T */ + +#ifndef HAVE_INT64_T +#ifdef HAVE_INT64 +typedef int64 int64_t; +#elif SIZEOF_INT == 8 +typedef signed int int64_t; +#elif SIZEOF_LONG == 8 +typedef signed long int64_t; +#elif SIZEOF_LONG_LONG == 8 +#ifdef PHP_WIN32 +typedef __int64 int64_t; +#else +typedef signed long long int64_t; +#endif +#else +#error "Neither int nor long nor long long is of 8 bytes width" +#endif +#endif /* HAVE_INT64_T */ + +#ifndef HAVE_UINT64_T +#ifdef HAVE_UINT64 +typedef uint64 uint64_t; +#elif SIZEOF_INT == 8 +typedef unsigned int uint64_t; +#elif SIZEOF_LONG == 8 +typedef unsigned long uint64_t; +#elif SIZEOF_LONG_LONG == 8 +#ifdef PHP_WIN32 +typedef unsigned __int64 uint64_t; +#else +typedef unsigned long long uint64_t; +#endif +#else +#error "Neither int nor long nor long long is of 8 bytes width" +#endif +#endif /* HAVE_INT64_T */ + + #ifdef PHP_WIN32 #define MYSQLND_LLU_SPEC "%I64u" #define MYSQLND_LL_SPEC "%I64d" diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c index d8ad06c608102..9961d68e43834 100644 --- a/ext/mysqlnd/mysqlnd_ps_codec.c +++ b/ext/mysqlnd/mysqlnd_ps_codec.c @@ -559,7 +559,6 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar *p += null_count; } - left = (*buf_len - (*p - *buf)); /* 1. Store type information */ /* check if need to send the types even if stmt->send_types_to_server is 0. This is because diff --git a/ext/oci8/README b/ext/oci8/README index af5beeb5c0745..420d5dac58e41 100644 --- a/ext/oci8/README +++ b/ext/oci8/README @@ -6,8 +6,8 @@ Use the OCI8 extension to access Oracle Database. Documentation is at http://php.net/oci8 The extension can be built with PHP versions 4.3.9 to 5.x using Oracle -Database 9.2, 10, 11 or 12 client libraries. Oracle's standard -cross-version connectivity applies. For example PHP linked with -Oracle 11.2 client libraries can connect to Oracle Database 9.2 -onwards. See Oracle's note "Oracle Client / Server Interoperability -Support" (ID 207303.1) for details. +9.2, 10, or 11 client libraries. Oracle's standard cross-version +connectivity applies. For example PHP linked with Oracle 11.2 client +libraries can connect to Oracle Database 9.2 onwards. See Oracle's +note "Oracle Client / Server Interoperability Support" (ID 207303.1) +for details. diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4 index b76db64638544..34ae76c44b021 100644 --- a/ext/oci8/config.m4 +++ b/ext/oci8/config.m4 @@ -103,7 +103,7 @@ dnl --with-oci8=shared,instantclient,/path/to/client/dir/lib dnl or dnl --with-oci8=shared,/path/to/oracle/home PHP_ARG_WITH(oci8, for Oracle Database OCI8 support, -[ --with-oci8[=DIR] Include Oracle Database OCI8 support. DIR defaults to \$ORACLE_HOME. +[ --with-oci8[=DIR] Include Oracle Database OCI8 support. DIR defaults to \$ORACLE_HOME. Use --with-oci8=instantclient,/path/to/instant/client/lib to use an Oracle Instant Client installation]) @@ -140,29 +140,12 @@ if test "$PHP_OCI8" != "no"; then if test "$oci8_php_version" -lt "4003009"; then AC_MSG_ERROR([You need at least PHP 4.3.9 to be able to use this version of OCI8. PHP $php_version found]) + elif test "$oci8_php_version" -ge "6000000"; then + AC_MSG_ERROR([This version of OCI8 is not compatible with PHP 6 or higher]) else AC_MSG_RESULT([$php_version, ok]) fi - dnl conditionally define PHP_INIT_DTRACE. - dnl This prevents 'configure' failing for PECL installs on older PHP versions. - dnl Note DTrace support can't be enabled on older PHP versions. - AC_PROVIDE_IFELSE([PHP_INIT_DTRACE], [], [AC_DEFUN([PHP_INIT_DTRACE], )]) - - if test "$PHP_DTRACE" = "yes"; then - if test "$oci8_php_version" -lt "5004000"; then - AC_MSG_ERROR([You need at least PHP 5.4 to be able to use DTrace with PHP OCI8]) - else - AC_CHECK_HEADERS([sys/sdt.h], [ - PHP_INIT_DTRACE([ext/oci8/oci8_dtrace.d],[ext/oci8/oci8_dtrace_gen.h],[ext/oci8/oci8.c \ - ext/oci8/oci8_interface.c ext/oci8/oci8_collection.c ext/oci8/oci8_lob.c ext/oci8/oci8_statement.c]) - ], [ - AC_MSG_ERROR( - [Cannot find sys/sdt.h which is required for DTrace support]) - ]) - fi - fi - dnl Set some port specific directory components for use later AC_CHECK_SIZEOF(long int, 4) diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index ad00c02d72860..44bfa713983a9 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -12,7 +12,7 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Stig S�ther Bakken | + | Authors: Stig S�ther Bakken | | Thies C. Arntzen | | Maxim Maletsky | | | @@ -37,6 +37,13 @@ #include "php_ini.h" #include "ext/standard/php_smart_str.h" +#ifdef HAVE_STDINT_H +#include +#endif +#ifdef PHP_WIN32 +#include "win32/php_stdint.h" +#endif + #if HAVE_OCI8 #if PHP_MAJOR_VERSION > 5 @@ -51,17 +58,11 @@ #include "php_oci8_int.h" #include "zend_hash.h" -#if defined(__PTRDIFF_TYPE__) -# define OCI8_INT_TO_PTR(I) ((void*)(__PTRDIFF_TYPE__)(I)) -# define OCI8_PTR_TO_INT(P) ((int)(__PTRDIFF_TYPE__)(P)) -#elif !defined(__GNUC__) -#define OCI8_INT_TO_PTR(I) ((void*)&((char*)0)[I]) -#define OCI8_PTR_TO_INT(P) ((int)(((char*)P)-(char*)0)) -#elif defined(HAVE_STDINT_H) -#define OCI8_INT_TO_PTR(I) ((void*)(intptr_t)(I)) +#if defined(HAVE_STDINT_H) || defined(PHP_WIN32) +#define OCI8_INT_TO_PTR(I) ((void *)(intptr_t)(I)) #define OCI8_PTR_TO_INT(P) ((int)(intptr_t)(P)) #else -#define OCI8_INT_TO_PTR(I) ((void*)(I)) +#define OCI8_INT_TO_PTR(I) ((void *)(I)) #define OCI8_PTR_TO_INT(P) ((int)(P)) #endif @@ -127,7 +128,7 @@ zend_class_entry *oci_coll_class_entry_ptr; #define PHP_OCI_INIT_MODE (OCI_DEFAULT | OCI_OBJECT) #endif -/* {{{ static protos */ +/* static protos {{{ */ static void php_oci_connection_list_dtor (zend_rsrc_list_entry * TSRMLS_DC); static void php_oci_pconnection_list_dtor (zend_rsrc_list_entry * TSRMLS_DC); static void php_oci_pconnection_list_np_dtor (zend_rsrc_list_entry * TSRMLS_DC); @@ -424,10 +425,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_parse, 0, 0, 2) ZEND_ARG_INFO(0, sql_text) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_get_implicit_resultset, 0, 0, 1) -ZEND_ARG_INFO(0, statement_resource) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_set_prefetch, 0, 0, 2) ZEND_ARG_INFO(0, statement_resource) ZEND_ARG_INFO(0, number_of_rows) @@ -701,7 +698,6 @@ static unsigned char arginfo_oci_bind_array_by_name[] = { 3, BYREF_NONE, BYREF_N #define arginfo_oci_error NULL #define arginfo_oci_num_fields NULL #define arginfo_oci_parse NULL -#define arginfo_oci_get_implicit_resultset NULL #define arginfo_oci_set_prefetch NULL #define arginfo_oci_set_client_identifier NULL #define arginfo_oci_set_edition NULL @@ -790,7 +786,6 @@ PHP_FUNCTION(oci_rollback); PHP_FUNCTION(oci_new_descriptor); PHP_FUNCTION(oci_num_fields); PHP_FUNCTION(oci_parse); -PHP_FUNCTION(oci_get_implicit_resultset); PHP_FUNCTION(oci_new_cursor); PHP_FUNCTION(oci_result); PHP_FUNCTION(oci_client_version); @@ -867,7 +862,6 @@ zend_function_entry php_oci_functions[] = { PHP_FE(oci_internal_debug, arginfo_oci_internal_debug) PHP_FE(oci_num_fields, arginfo_oci_num_fields) PHP_FE(oci_parse, arginfo_oci_parse) - PHP_FE(oci_get_implicit_resultset, arginfo_oci_get_implicit_resultset) PHP_FE(oci_new_cursor, arginfo_oci_new_cursor) PHP_FE(oci_result, arginfo_oci_result) PHP_FE(oci_client_version, arginfo_oci_client_version) @@ -1061,12 +1055,8 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY( "oci8.statement_cache_size", "20", PHP_INI_SYSTEM, ONUPDATELONGFUNC, statement_cache_size, zend_oci_globals, oci_globals) STD_PHP_INI_ENTRY( "oci8.default_prefetch", "100", PHP_INI_SYSTEM, ONUPDATELONGFUNC, default_prefetch, zend_oci_globals, oci_globals) STD_PHP_INI_BOOLEAN("oci8.old_oci_close_semantics", "0", PHP_INI_SYSTEM, OnUpdateBool, old_oci_close_semantics,zend_oci_globals, oci_globals) -#if (OCI_MAJOR_VERSION >= 11) STD_PHP_INI_ENTRY( "oci8.connection_class", "", PHP_INI_ALL, OnUpdateString, connection_class, zend_oci_globals, oci_globals) -#endif -#if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2))) STD_PHP_INI_BOOLEAN("oci8.events", "0", PHP_INI_SYSTEM, OnUpdateBool, events, zend_oci_globals, oci_globals) -#endif PHP_INI_END() /* }}} */ @@ -1115,10 +1105,10 @@ static void php_oci_init_global_handles(TSRMLS_D) */ OCICPool *cpoolh; ub4 cpoolmode = 0x80000000; /* Pass invalid mode to OCIConnectionPoolCreate */ - PHP_OCI_CALL(OCIHANDLEALLOC, OCIHandleAlloc, (OCI_G(env), (dvoid **) &cpoolh, OCI_HTYPE_CPOOL, (size_t) 0, (dvoid **) 0)); - PHP_OCI_CALL(OCICONNECTIONPOOLCREATE, OCIConnectionPoolCreate, (OCI_G(env), OCI_G(err), cpoolh, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, NULL, 0, cpoolmode)); - PHP_OCI_CALL(OCICONNECTIONPOOLDESTROY, OCIConnectionPoolDestroy, (cpoolh, OCI_G(err), OCI_DEFAULT)); - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, (cpoolh, OCI_HTYPE_CPOOL)); + PHP_OCI_CALL(OCIHandleAlloc, (OCI_G(env), (dvoid **) &cpoolh, OCI_HTYPE_CPOOL, (size_t) 0, (dvoid **) 0)); + PHP_OCI_CALL(OCIConnectionPoolCreate, (OCI_G(env), OCI_G(err), cpoolh, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, NULL, 0, cpoolmode)); + PHP_OCI_CALL(OCIConnectionPoolDestroy, (cpoolh, OCI_G(err), OCI_DEFAULT)); + PHP_OCI_CALL(OCIHandleFree, (cpoolh, OCI_HTYPE_CPOOL)); #endif } else { OCIErrorGet(OCI_G(env), (ub4)1, NULL, &ora_error_code, tmp_buf, (ub4)OCI_ERROR_MAXMSG_SIZE, (ub4)OCI_HTYPE_ERROR); @@ -1142,8 +1132,7 @@ static void php_oci_init_global_handles(TSRMLS_D) } } } -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_cleanup_global_handles() * @@ -1152,16 +1141,15 @@ static void php_oci_init_global_handles(TSRMLS_D) static void php_oci_cleanup_global_handles(TSRMLS_D) { if (OCI_G(err)) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) OCI_G(err), OCI_HTYPE_ERROR)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) OCI_G(err), OCI_HTYPE_ERROR)); OCI_G(err) = NULL; } if (OCI_G(env)) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) OCI_G(env), OCI_HTYPE_ENV)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) OCI_G(env), OCI_HTYPE_ENV)); OCI_G(env) = NULL; } -} -/* }}} */ +} /* }}} */ /* {{{ PHP_GINIT_FUNCTION * @@ -1348,15 +1336,18 @@ PHP_RSHUTDOWN_FUNCTION(oci) PHP_MINFO_FUNCTION(oci) { char buf[32]; -#if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2))) char *ver; -#endif php_info_print_table_start(); php_info_print_table_row(2, "OCI8 Support", "enabled"); - php_info_print_table_row(2, "OCI8 Version", PHP_OCI8_VERSION); + php_info_print_table_row(2, "Version", PHP_OCI8_VERSION); php_info_print_table_row(2, "Revision", "$Id$"); + snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent)); + php_info_print_table_row(2, "Active Persistent Connections", buf); + snprintf(buf, sizeof(buf), "%ld", OCI_G(num_links)); + php_info_print_table_row(2, "Active Connections", buf); + #if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2))) php_oci_client_get_version(&ver TSRMLS_CC); php_info_print_table_row(2, "Oracle Run-time Client Library Version", ver); @@ -1370,9 +1361,9 @@ PHP_MINFO_FUNCTION(oci) snprintf(buf, sizeof(buf), "Unknown"); #endif #if defined(HAVE_OCI_INSTANT_CLIENT) - php_info_print_table_row(2, "Oracle Compile-time Instant Client Version", buf); + php_info_print_table_row(2, "Oracle Instant Client Version", buf); #else - php_info_print_table_row(2, "Oracle Compile-time Version", buf); + php_info_print_table_row(2, "Oracle Version", buf); #endif #if !defined(PHP_WIN32) && !defined(HAVE_OCI_INSTANT_CLIENT) @@ -1384,21 +1375,14 @@ PHP_MINFO_FUNCTION(oci) #endif #endif + php_info_print_table_row(2, "Temporary Lob support", "enabled"); + php_info_print_table_row(2, "Collections support", "enabled"); php_info_print_table_end(); - DISPLAY_INI_ENTRIES(); - - php_info_print_table_start(); - php_info_print_table_header(2, "Statistics", ""); - snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent)); - php_info_print_table_row(2, "Active Persistent Connections", buf); - snprintf(buf, sizeof(buf), "%ld", OCI_G(num_links)); - php_info_print_table_row(2, "Active Connections", buf); - php_info_print_table_end(); } /* }}} */ -/* {{{ list destructors */ +/* list destructors {{{ */ /* {{{ php_oci_connection_list_dtor() * @@ -1412,8 +1396,7 @@ static void php_oci_connection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC) php_oci_connection_close(connection TSRMLS_CC); OCI_G(num_links)--; } -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_pconnection_list_dtor() * @@ -1428,8 +1411,7 @@ static void php_oci_pconnection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC) OCI_G(num_persistent)--; OCI_G(num_links)--; } -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_pconnection_list_np_dtor() * @@ -1467,12 +1449,11 @@ static void php_oci_pconnection_list_np_dtor(zend_rsrc_list_entry *entry TSRMLS_ OCI_G(num_persistent)--; } -#ifdef HAVE_DTRACE - if (DTRACE_OCI8_CONNECT_P_DTOR_CLOSE_ENABLED()) { - DTRACE_OCI8_CONNECT_P_DTOR_CLOSE(connection); + if (OCI_G(debug_mode)) { + php_printf ("OCI8 DEBUG L1: np_dtor cleaning up: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__); } -#endif /* HAVE_DTRACE */ - } else { + } + else { /* * Release the connection to underlying pool. We do this unconditionally so that * out-of-scope pconnects are now consistent with oci_close and out-of-scope new connect @@ -1484,14 +1465,11 @@ static void php_oci_pconnection_list_np_dtor(zend_rsrc_list_entry *entry TSRMLS_ */ php_oci_connection_release(connection TSRMLS_CC); -#ifdef HAVE_DTRACE - if (DTRACE_OCI8_CONNECT_P_DTOR_RELEASE_ENABLED()) { - DTRACE_OCI8_CONNECT_P_DTOR_RELEASE(connection); + if (OCI_G(debug_mode)) { + php_printf ("OCI8 DEBUG L1: np_dtor releasing: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__); } -#endif /* HAVE_DTRACE */ } -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_statement_list_dtor() * @@ -1501,8 +1479,7 @@ static void php_oci_statement_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC) { php_oci_statement *statement = (php_oci_statement *)entry->ptr; php_oci_statement_free(statement TSRMLS_CC); -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_descriptor_list_dtor() * @@ -1512,8 +1489,7 @@ static void php_oci_descriptor_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC) { php_oci_descriptor *descriptor = (php_oci_descriptor *)entry->ptr; php_oci_lob_free(descriptor TSRMLS_CC); -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_list_dtor() * @@ -1523,12 +1499,11 @@ static void php_oci_collection_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC) { php_oci_collection *collection = (php_oci_collection *)entry->ptr; php_oci_collection_close(collection TSRMLS_CC); -} -/* }}} */ +} /* }}} */ /* }}} */ -/* {{{ Hash Destructors */ +/* Hash Destructors {{{ */ /* {{{ php_oci_define_hash_dtor() * @@ -1630,6 +1605,7 @@ void php_oci_connection_descriptors_free(php_oci_connection *connection TSRMLS_D } /* }}} */ + /* {{{ php_oci_error() * * Fetch & print out error message if we get an error @@ -1686,13 +1662,6 @@ sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown OCI error code: %d", status); break; } - -#ifdef HAVE_DTRACE - if (DTRACE_OCI8_ERROR_ENABLED()) { - DTRACE_OCI8_ERROR(status, errcode); - } -#endif /* HAVE_DTRACE */ - return errcode; } /* }}} */ @@ -1707,7 +1676,7 @@ sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC) text err_buf[PHP_OCI_ERRBUF_LEN]; memset(err_buf, 0, sizeof(err_buf)); - PHP_OCI_CALL(OCIERRORGET, OCIErrorGet, (error_handle, (ub4)1, NULL, &error_code, err_buf, (ub4)PHP_OCI_ERRBUF_LEN, (ub4)OCI_HTYPE_ERROR)); + PHP_OCI_CALL(OCIErrorGet, (error_handle, (ub4)1, NULL, &error_code, err_buf, (ub4)PHP_OCI_ERRBUF_LEN, (ub4)OCI_HTYPE_ERROR)); if (error_code) { int err_buf_len = strlen((char *)err_buf); @@ -1721,8 +1690,7 @@ sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC) } } return error_code; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_fetch_sqltext_offset() * @@ -1734,7 +1702,7 @@ int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, u *sqltext = NULL; *error_offset = 0; - PHP_OCI_CALL_RETURN(OCIATTRGET, errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *) sqltext, (ub4 *)0, OCI_ATTR_STATEMENT, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *) sqltext, (ub4 *)0, OCI_ATTR_STATEMENT, statement->err)); if (errstatus != OCI_SUCCESS) { statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); @@ -1742,7 +1710,7 @@ int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, u return 1; } - PHP_OCI_CALL_RETURN(OCIATTRGET, errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)error_offset, (ub4 *)0, OCI_ATTR_PARSE_ERROR_OFFSET, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)error_offset, (ub4 *)0, OCI_ATTR_PARSE_ERROR_OFFSET, statement->err)); if (errstatus != OCI_SUCCESS) { statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); @@ -1750,8 +1718,7 @@ int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, u return 1; } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_do_connect() * @@ -1771,32 +1738,18 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus return; } -#ifdef HAVE_DTRACE - if (DTRACE_OCI8_CONNECT_START_ENABLED()) { - DTRACE_OCI8_CONNECT_START(username, dbname, charset, session_mode, persistent, exclusive); - } -#endif /* HAVE_DTRACE */ - if (!charset_len) { charset = NULL; } connection = php_oci_do_connect_ex(username, username_len, password, password_len, NULL, 0, dbname, dbname_len, charset, session_mode, persistent, exclusive TSRMLS_CC); -#ifdef HAVE_DTRACE - if (DTRACE_OCI8_CONNECT_DONE_ENABLED()) { - DTRACE_OCI8_CONNECT_DONE(); - } -#endif /* HAVE_DTRACE */ - - if (!connection) { RETURN_FALSE; } - RETURN_RESOURCE(connection->id); + RETURN_RESOURCE(connection->rsrc_id); -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_do_connect_ex() * @@ -1904,7 +1857,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char smart_str_appendl_ex(&hashed_details, "**", sizeof("**") - 1, 0); if (charset && *charset) { - PHP_OCI_CALL_RETURN(OCINLSCHARSETNAMETOID, charsetid, OCINlsCharSetNameToId, (OCI_G(env), (CONST oratext *)charset)); + PHP_OCI_CALL_RETURN(charsetid, OCINlsCharSetNameToId, (OCI_G(env), (CONST oratext *)charset)); if (!charsetid) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid character set name: %s", charset); } else { @@ -1917,7 +1870,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char size_t rsize = 0; sword result; - PHP_OCI_CALL_RETURN(OCINLSENVIRONMENTVARIABLEGET, result, OCINlsEnvironmentVariableGet, (&charsetid_nls_lang, 0, OCI_NLS_CHARSET_ID, 0, &rsize)); + PHP_OCI_CALL_RETURN(result, OCINlsEnvironmentVariableGet, (&charsetid_nls_lang, 0, OCI_NLS_CHARSET_ID, 0, &rsize)); if (result != OCI_SUCCESS) { charsetid_nls_lang = 0; } @@ -1955,11 +1908,16 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char } } -#ifdef HAVE_DTRACE - if (DTRACE_OCI8_CONNECT_LOOKUP_ENABLED()) { - DTRACE_OCI8_CONNECT_LOOKUP(connection, connection && connection->is_stub ? 1 : 0); - } -#endif /* HAVE_DTRACE */ + /* Debug statements {{{ */ + if (OCI_G(debug_mode)) { + if (connection && connection->is_stub) { + php_printf ("OCI8 DEBUG L1: Got a cached stub: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__); + } else if (connection) { + php_printf ("OCI8 DEBUG L1: Got a cached connection: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__); + } else { + php_printf ("OCI8 DEBUG L1: Got NO cached connection at (%s:%d) \n", __FILE__, __LINE__); + } + } /* }}} */ /* If we got a pconnection stub, then 'load'(OCISessionGet) the real connection from its * private spool A connection is a stub if it is only a cached structure and the real @@ -2005,20 +1963,24 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char /* okay, the connection is open and the server is still alive */ connection->used_this_request = 1; - tmp = (php_oci_connection *)zend_list_find(connection->id, &rsrc_type); + tmp = (php_oci_connection *)zend_list_find(connection->rsrc_id, &rsrc_type); if (tmp != NULL && rsrc_type == le_pconnection && strlen(tmp->hash_key) == hashed_details.len && - memcmp(tmp->hash_key, hashed_details.c, hashed_details.len) == 0 && zend_list_addref(connection->id) == SUCCESS) { + memcmp(tmp->hash_key, hashed_details.c, hashed_details.len) == 0 && zend_list_addref(connection->rsrc_id) == SUCCESS) { /* do nothing */ } else { - PHP_OCI_REGISTER_RESOURCE(connection, le_pconnection); +#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) + connection->rsrc_id = zend_list_insert(connection, le_pconnection TSRMLS_CC); +#else + connection->rsrc_id = zend_list_insert(connection, le_pconnection); +#endif /* Persistent connections: For old close semantics we artificially * bump up the refcount to prevent the non-persistent destructor * from getting called until request shutdown. The refcount is * decremented in the persistent helper */ if (OCI_G(old_oci_close_semantics)) { - zend_list_addref(connection->id); + zend_list_addref(connection->rsrc_id); } } smart_str_free_ex(&hashed_details, 0); @@ -2029,7 +1991,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char } else { /* we do not ping non-persistent connections */ smart_str_free_ex(&hashed_details, 0); - zend_list_addref(connection->id); + zend_list_addref(connection->rsrc_id); return connection; } } /* is_open is true? */ @@ -2046,7 +2008,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char /* We have to do a hash_del but need to preserve the resource if there is a positive * refcount. Set the data pointer in the list entry to NULL */ - if (connection == zend_list_find(connection->id, &rsrc_type) && rsrc_type == le_pconnection) { + if (connection == zend_list_find(connection->rsrc_id, &rsrc_type) && rsrc_type == le_pconnection) { le->ptr = NULL; } @@ -2123,8 +2085,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char smart_str_free_ex(&hashed_details, 0); return NULL; } - } - /* }}} */ + } /* }}} */ connection->idle_expiry = (OCI_G(persistent_timeout) > 0) ? (timestamp + OCI_G(persistent_timeout)) : 0; @@ -2163,34 +2124,50 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char new_le.ptr = connection; new_le.type = le_pconnection; connection->used_this_request = 1; - PHP_OCI_REGISTER_RESOURCE(connection, le_pconnection); +#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) + connection->rsrc_id = zend_list_insert(connection, le_pconnection TSRMLS_CC); +#else + connection->rsrc_id = zend_list_insert(connection, le_pconnection); +#endif /* Persistent connections: For old close semantics we artificially bump up the refcount to * prevent the non-persistent destructor from getting called until request shutdown. The * refcount is decremented in the persistent helper */ if (OCI_G(old_oci_close_semantics)) { - zend_list_addref(connection->id); + zend_list_addref(connection->rsrc_id); } zend_hash_update(&EG(persistent_list), connection->hash_key, strlen(connection->hash_key)+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL); OCI_G(num_persistent)++; OCI_G(num_links)++; } else if (!exclusive) { - PHP_OCI_REGISTER_RESOURCE(connection, le_connection); - new_le.ptr = OCI8_INT_TO_PTR(connection->id); +#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) + connection->rsrc_id = zend_list_insert(connection, le_connection TSRMLS_CC); +#else + connection->rsrc_id = zend_list_insert(connection, le_connection); +#endif + new_le.ptr = OCI8_INT_TO_PTR(connection->rsrc_id); new_le.type = le_index_ptr; zend_hash_update(&EG(regular_list), connection->hash_key, strlen(connection->hash_key)+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL); OCI_G(num_links)++; } else { - PHP_OCI_REGISTER_RESOURCE(connection, le_connection); +#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) + connection->rsrc_id = zend_list_insert(connection, le_connection TSRMLS_CC); +#else + connection->rsrc_id = zend_list_insert(connection, le_connection); +#endif OCI_G(num_links)++; } -#ifdef HAVE_DTRACE - if (DTRACE_OCI8_CONNECT_TYPE_ENABLED()) { - DTRACE_OCI8_CONNECT_TYPE(connection->is_persistent ? 1 : 0, exclusive ? 1 : 0, connection, OCI_G(num_persistent), OCI_G(num_links)); - } -#endif /* HAVE_DTRACE */ + /* Debug statements {{{ */ + if (OCI_G(debug_mode)) { + if (connection->is_persistent) { + php_printf ("OCI8 DEBUG L1: New Persistent Connection address: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__); + } else { + php_printf ("OCI8 DEBUG L1: New Non-Persistent Connection address: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__); + } + php_printf ("OCI8 DEBUG L1: num_persistent=(%ld), num_links=(%ld) at (%s:%d) \n", OCI_G(num_persistent), OCI_G(num_links), __FILE__, __LINE__); + } /* }}} */ return connection; } @@ -2208,11 +2185,11 @@ static int php_oci_connection_ping(php_oci_connection *connection TSRMLS_DC) * Pre-10.2 clients */ #if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2))) /* OCIPing available 10.2 onwards */ - PHP_OCI_CALL_RETURN(OCIPING, OCI_G(errcode), OCIPing, (connection->svc, OCI_G(err), OCI_DEFAULT)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIPing, (connection->svc, OCI_G(err), OCI_DEFAULT)); #else char version[256]; /* use good old OCIServerVersion() */ - PHP_OCI_CALL_RETURN(OCISERVERVERSION, OCI_G(errcode), OCIServerVersion, (connection->svc, OCI_G(err), (text *)version, sizeof(version), OCI_HTYPE_SVCCTX)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIServerVersion, (connection->svc, OCI_G(err), (text *)version, sizeof(version), OCI_HTYPE_SVCCTX)); #endif if (OCI_G(errcode) == OCI_SUCCESS) { @@ -2243,7 +2220,7 @@ static int php_oci_connection_status(php_oci_connection *connection TSRMLS_DC) ub4 ss = 0; /* get OCI_ATTR_SERVER_STATUS */ - PHP_OCI_CALL_RETURN(OCIATTRGET, OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->server, OCI_HTYPE_SERVER, (dvoid *)&ss, (ub4 *)0, OCI_ATTR_SERVER_STATUS, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->server, OCI_HTYPE_SERVER, (dvoid *)&ss, (ub4 *)0, OCI_ATTR_SERVER_STATUS, OCI_G(err))); if (OCI_G(errcode) == OCI_SUCCESS && ss == OCI_SERVER_NORMAL) { return 1; @@ -2261,8 +2238,8 @@ static int php_oci_connection_status(php_oci_connection *connection TSRMLS_DC) */ int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC) { - PHP_OCI_CALL_RETURN(OCITRANSROLLBACK, connection->errcode, OCITransRollback, (connection->svc, connection->err, (ub4) 0)); - connection->rb_on_disconnect = 0; + PHP_OCI_CALL_RETURN(connection->errcode, OCITransRollback, (connection->svc, connection->err, (ub4) 0)); + connection->needs_commit = 0; if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -2270,8 +2247,7 @@ int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC) return 1; } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_connection_commit() * @@ -2279,8 +2255,8 @@ int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC) */ int php_oci_connection_commit(php_oci_connection *connection TSRMLS_DC) { - PHP_OCI_CALL_RETURN(OCITRANSCOMMIT, connection->errcode, OCITransCommit, (connection->svc, connection->err, (ub4) 0)); - connection->rb_on_disconnect = 0; + PHP_OCI_CALL_RETURN(connection->errcode, OCITransCommit, (connection->svc, connection->err, (ub4) 0)); + connection->needs_commit = 0; if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -2288,8 +2264,7 @@ int php_oci_connection_commit(php_oci_connection *connection TSRMLS_DC) return 1; } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_connection_close() * @@ -2306,36 +2281,36 @@ static int php_oci_connection_close(php_oci_connection *connection TSRMLS_DC) } if (!connection->using_spool && connection->svc) { - PHP_OCI_CALL(OCISESSIONEND, OCISessionEnd, (connection->svc, connection->err, connection->session, (ub4) 0)); + PHP_OCI_CALL(OCISessionEnd, (connection->svc, connection->err, connection->session, (ub4) 0)); } if (connection->err) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) connection->err, (ub4) OCI_HTYPE_ERROR)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->err, (ub4) OCI_HTYPE_ERROR)); } if (connection->authinfo) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) connection->authinfo, (ub4) OCI_HTYPE_AUTHINFO)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->authinfo, (ub4) OCI_HTYPE_AUTHINFO)); } /* No Handlefrees for session pool connections */ if (!connection->using_spool) { if (connection->session) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) connection->session, OCI_HTYPE_SESSION)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->session, OCI_HTYPE_SESSION)); } if (connection->is_attached) { - PHP_OCI_CALL(OCISERVERDETACH, OCIServerDetach, (connection->server, OCI_G(err), OCI_DEFAULT)); + PHP_OCI_CALL(OCIServerDetach, (connection->server, OCI_G(err), OCI_DEFAULT)); } if (connection->svc) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX)); } if (connection->server) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) connection->server, (ub4) OCI_HTYPE_SERVER)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->server, (ub4) OCI_HTYPE_SERVER)); } if (connection->env) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) connection->env, OCI_HTYPE_ENV)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->env, OCI_HTYPE_ENV)); } } else if (connection->private_spool) { /* Keep this as the last member to be freed, as there are dependencies @@ -2358,8 +2333,7 @@ static int php_oci_connection_close(php_oci_connection *connection TSRMLS_DC) connection = NULL; OCI_G(in_call) = in_call_save; return result; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_connection_release() * @@ -2383,7 +2357,7 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC) if (connection->svc) { /* rollback outstanding transactions */ - if (connection->rb_on_disconnect) { + if (connection->needs_commit) { if (php_oci_connection_rollback(connection TSRMLS_CC)) { /* rollback failed */ result = 1; @@ -2424,7 +2398,7 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC) #endif if (connection->svc) { - PHP_OCI_CALL(OCISESSIONRELEASE, OCISessionRelease, (connection->svc, connection->err, NULL, + PHP_OCI_CALL(OCISessionRelease, (connection->svc, connection->err, NULL, 0, rlsMode)); } /* It no longer has relation with the database session. However authinfo and env are @@ -2434,7 +2408,7 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC) connection->server = NULL; connection->session = NULL; - connection->is_attached = connection->is_open = connection->rb_on_disconnect = connection->used_this_request = 0; + connection->is_attached = connection->is_open = connection->needs_commit = connection->used_this_request = 0; connection->is_stub = 1; /* Cut the link between the connection structure and the time_t structure allocated within @@ -2445,8 +2419,7 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC) OCI_G(in_call) = in_call_save; return result; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_password_change() * @@ -2454,7 +2427,7 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC) */ int php_oci_password_change(php_oci_connection *connection, char *user, int user_len, char *pass_old, int pass_old_len, char *pass_new, int pass_new_len TSRMLS_DC) { - PHP_OCI_CALL_RETURN(OCIPASSWORDCHANGE, connection->errcode, OCIPasswordChange, (connection->svc, connection->err, (text *)user, user_len, (text *)pass_old, pass_old_len, (text *)pass_new, pass_new_len, OCI_DEFAULT)); + PHP_OCI_CALL_RETURN(connection->errcode, OCIPasswordChange, (connection->svc, connection->err, (text *)user, user_len, (text *)pass_old, pass_old_len, (text *)pass_new, pass_new_len, OCI_DEFAULT)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -2463,8 +2436,8 @@ int php_oci_password_change(php_oci_connection *connection, char *user, int user } connection->passwd_changed = 1; return 0; -} -/* }}} */ +} /* }}} */ + /* {{{ php_oci_client_get_version() * @@ -2473,21 +2446,21 @@ int php_oci_password_change(php_oci_connection *connection, char *user, int user void php_oci_client_get_version(char **version TSRMLS_DC) { char version_buff[256]; -#if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2))) /* OCIClientVersion only available 10.2 onwards */ sword major_version = 0; sword minor_version = 0; sword update_num = 0; sword patch_num = 0; sword port_update_num = 0; - PHP_OCI_CALL(OCICLIENTVERSION, OCIClientVersion, (&major_version, &minor_version, &update_num, &patch_num, &port_update_num)); +#if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2))) /* OCIClientVersion only available 10.2 onwards */ + PHP_OCI_CALL(OCIClientVersion, (&major_version, &minor_version, &update_num, &patch_num, &port_update_num)); snprintf(version_buff, sizeof(version_buff), "%d.%d.%d.%d.%d", major_version, minor_version, update_num, patch_num, port_update_num); #else memcpy(version_buff, "Unknown", sizeof("Unknown")); #endif *version = estrdup(version_buff); -} -/* }}} */ +} /* }}} */ + /* {{{ php_oci_server_get_version() * @@ -2497,7 +2470,7 @@ int php_oci_server_get_version(php_oci_connection *connection, char **version TS { char version_buff[256]; - PHP_OCI_CALL_RETURN(OCISERVERVERSION, connection->errcode, OCIServerVersion, (connection->svc, connection->err, (text *)version_buff, sizeof(version_buff), OCI_HTYPE_SVCCTX)); + PHP_OCI_CALL_RETURN(connection->errcode, OCIServerVersion, (connection->svc, connection->err, (text *)version_buff, sizeof(version_buff), OCI_HTYPE_SVCCTX)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -2507,8 +2480,7 @@ int php_oci_server_get_version(php_oci_connection *connection, char **version TS *version = estrdup(version_buff); return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_column_to_zval() * @@ -2592,19 +2564,14 @@ int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSR } /* }}} */ - /* {{{ php_oci_fetch_row() * * Fetch the next row from the given statement - * Has logic for Oracle 12c Implicit Result Sets */ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_args) { zval *z_statement, *array; - php_oci_statement *statement; /* statement that will be fetched from */ -#if (OCI_MAJOR_VERSION >= 12) - php_oci_statement *invokedstatement; /* statement this function was invoked with */ -#endif /* OCI_MAJOR_VERSION */ + php_oci_statement *statement; php_oci_out_column *column; ub4 nrows = 1; int i; @@ -2650,64 +2617,12 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg } } -#if (OCI_MAJOR_VERSION < 12) PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); if (php_oci_statement_fetch(statement, nrows TSRMLS_CC)) { - RETURN_FALSE; /* end of fetch */ - } -#else /* OCI_MAJOR_VERSION */ - PHP_OCI_ZVAL_TO_STATEMENT(z_statement, invokedstatement); - - if (invokedstatement->impres_flag == PHP_OCI_IMPRES_NO_CHILDREN) { - /* Already know there are no Implicit Result Sets */ - statement = invokedstatement; - } else if (invokedstatement->impres_flag == PHP_OCI_IMPRES_HAS_CHILDREN) { - /* Previously saw an Implicit Result Set in an earlier invocation of php_oci_fetch_row */ - statement = (php_oci_statement *)invokedstatement->impres_child_stmt; - } else { - sword errstatus; - - /* Check for an Implicit Result Set on this statement handle */ - PHP_OCI_CALL_RETURN(OCIATTRGET, errstatus, OCIAttrGet, ((dvoid *)invokedstatement->stmt, OCI_HTYPE_STMT, - (dvoid *) &invokedstatement->impres_count, - (ub4 *)NULL, OCI_ATTR_IMPLICIT_RESULT_COUNT, invokedstatement->err)); - if (errstatus) { - RETURN_FALSE; - } - if (invokedstatement->impres_count > 0) { - /* Make it so the fetch occurs on the first Implicit Result Set */ - statement = php_oci_get_implicit_resultset(invokedstatement TSRMLS_CC); - if (!statement || php_oci_statement_execute(statement, (ub4)OCI_DEFAULT TSRMLS_CC)) - RETURN_FALSE; - invokedstatement->impres_count--; - invokedstatement->impres_child_stmt = (struct php_oci_statement *)statement; - invokedstatement->impres_flag = PHP_OCI_IMPRES_HAS_CHILDREN; - } else { - statement = invokedstatement; /* didn't find Implicit Result Sets */ - invokedstatement->impres_flag = PHP_OCI_IMPRES_NO_CHILDREN; /* Don't bother checking again */ - } + RETURN_FALSE; } - if (php_oci_statement_fetch(statement, nrows TSRMLS_CC)) { - /* End of fetch */ - if (invokedstatement->impres_count > 0) { - /* Check next Implicit Result Set */ - statement = php_oci_get_implicit_resultset(invokedstatement TSRMLS_CC); - if (!statement || php_oci_statement_execute(statement, (ub4)OCI_DEFAULT TSRMLS_CC)) - RETURN_FALSE; - invokedstatement->impres_count--; - invokedstatement->impres_child_stmt = (struct php_oci_statement *)statement; - if (php_oci_statement_fetch(statement, nrows TSRMLS_CC)) { - /* End of all fetches */ - RETURN_FALSE; - } - } else { - RETURN_FALSE; - } - } -#endif /* OCI_MAJOR_VERSION */ - array_init(return_value); for (i = 0; i < statement->ncolumns; i++) { @@ -2773,11 +2688,9 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC) connection = (php_oci_connection *)le->ptr; if (!connection->used_this_request && OCI_G(persistent_timeout) != -1) { -#ifdef HAVE_DTRACE - if (DTRACE_OCI8_CONNECT_EXPIRY_ENABLED()) { - DTRACE_OCI8_CONNECT_EXPIRY(connection, connection->is_stub ? 1 : 0, connection->idle_expiry, timestamp); + if (OCI_G(debug_mode)) { + php_printf ("OCI8 DEBUG L1: persistent_helper processing for timeout: (%p stub=%d) at (%s:%d) \n", connection, connection->is_stub, __FILE__, __LINE__); } -#endif /* HAVE_DTRACE */ if (connection->idle_expiry < timestamp) { /* connection has timed out */ return ZEND_HASH_APPLY_REMOVE; @@ -2785,8 +2698,7 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC) } } return ZEND_HASH_APPLY_KEEP; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_create_spool() * @@ -2822,7 +2734,7 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha } /* Allocate the pool handle */ - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, (session_pool->env, (dvoid **) &session_pool->poolh, OCI_HTYPE_SPOOL, (size_t) 0, (dvoid **) 0)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (session_pool->env, (dvoid **) &session_pool->poolh, OCI_HTYPE_SPOOL, (size_t) 0, (dvoid **) 0)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -2834,7 +2746,7 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha * generic bug which can free up the OCI_G(err) variable before destroying connections. We * cannot use this for other roundtrip calls as there is no way the user can access this error */ - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, ((dvoid *) session_pool->env, (dvoid **)&(session_pool->err), (ub4) OCI_HTYPE_ERROR,(size_t) 0, (dvoid **) 0)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, ((dvoid *) session_pool->env, (dvoid **)&(session_pool->err), (ub4) OCI_HTYPE_ERROR,(size_t) 0, (dvoid **) 0)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -2850,53 +2762,49 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha #endif #if ((OCI_MAJOR_VERSION > 11) || ((OCI_MAJOR_VERSION == 11) && (OCI_MINOR_VERSION >= 2))) - /* {{{ Allocate auth handle for session pool */ - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, (session_pool->env, (dvoid **)&(spoolAuth), OCI_HTYPE_AUTHINFO, 0, NULL)); + /* Allocate auth handle for session pool {{{ */ + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (session_pool->env, (dvoid **)&(spoolAuth), OCI_HTYPE_AUTHINFO, 0, NULL)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); iserror = 1; goto exit_create_spool; - } - /* }}} */ + } /* }}} */ - /* {{{ Set the edition attribute on the auth handle */ + /* Set the edition attribute on the auth handle {{{ */ if (OCI_G(edition)) { - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode),OCIAttrSet, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO, (dvoid *) OCI_G(edition), (ub4)(strlen(OCI_G(edition))), (ub4)OCI_ATTR_EDITION, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode),OCIAttrSet, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO, (dvoid *) OCI_G(edition), (ub4)(strlen(OCI_G(edition))), (ub4)OCI_ATTR_EDITION, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); iserror = 1; goto exit_create_spool; } - } - /* }}} */ + } /* }}} */ - /* {{{ Set the driver name attribute on the auth handle */ - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO, (dvoid *) PHP_OCI8_DRIVER_NAME, (ub4) sizeof(PHP_OCI8_DRIVER_NAME)-1, (ub4) OCI_ATTR_DRIVER_NAME, OCI_G(err))); + /* Set the driver name attribute on the auth handle {{{ */ + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO, (dvoid *) PHP_OCI8_DRIVER_NAME, (ub4) sizeof(PHP_OCI8_DRIVER_NAME)-1, (ub4) OCI_ATTR_DRIVER_NAME, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); iserror = 1; goto exit_create_spool; - } - /* }}} */ + } /* }}} */ - /* {{{ Set the auth handle on the session pool */ - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode),OCIAttrSet, ((dvoid *) (session_pool->poolh),(ub4) OCI_HTYPE_SPOOL, (dvoid *) spoolAuth, (ub4)0, (ub4)OCI_ATTR_SPOOL_AUTH, OCI_G(err))); + /* Set the auth handle on the session pool {{{ */ + PHP_OCI_CALL_RETURN(OCI_G(errcode),OCIAttrSet, ((dvoid *) (session_pool->poolh),(ub4) OCI_HTYPE_SPOOL, (dvoid *) spoolAuth, (ub4)0, (ub4)OCI_ATTR_SPOOL_AUTH, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); iserror = 1; goto exit_create_spool; - } - /* }}} */ + } /* }}} */ #endif /* Create the homogeneous session pool - We have different session pools for every different * username, password, charset and dbname. */ - PHP_OCI_CALL_RETURN(OCISESSIONPOOLCREATE, OCI_G(errcode), OCISessionPoolCreate,(session_pool->env, OCI_G(err), session_pool->poolh, (OraText **)&session_pool->poolname, &session_pool->poolname_len, (OraText *)dbname, (ub4)dbname_len, 0, UB4MAXVAL, 1,(OraText *)username, (ub4)username_len, (OraText *)password,(ub4)password_len, poolmode)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionPoolCreate,(session_pool->env, OCI_G(err), session_pool->poolh, (OraText **)&session_pool->poolname, &session_pool->poolname_len, (OraText *)dbname, (ub4)dbname_len, 0, UB4MAXVAL, 1,(OraText *)username, (ub4)username_len, (OraText *)password,(ub4)password_len, poolmode)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -2910,18 +2818,15 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha } if (spoolAuth) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO)); } -#ifdef HAVE_DTRACE - if (DTRACE_OCI8_SESSPOOL_CREATE_ENABLED()) { - DTRACE_OCI8_SESSPOOL_CREATE(session_pool); + if (OCI_G(debug_mode)) { + php_printf ("OCI8 DEBUG L1: create_spool: (%p) at (%s:%d) \n", session_pool, __FILE__, __LINE__); } -#endif /* HAVE_DTRACE */ return session_pool; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_get_spool() * @@ -2936,7 +2841,7 @@ static php_oci_spool *php_oci_get_spool(char *username, int username_len, char * zend_rsrc_list_entry *spool_out_le = NULL; zend_bool iserror = 0; - /* {{{ Create the spool hash key */ + /* Create the spool hash key {{{ */ smart_str_appendl_ex(&spool_hashed_details, "oci8spool***", sizeof("oci8spool***") - 1, 0); smart_str_appendl_ex(&spool_hashed_details, username, username_len, 0); smart_str_appendl_ex(&spool_hashed_details, "**", sizeof("**") - 1, 0); @@ -2975,7 +2880,11 @@ static php_oci_spool *php_oci_get_spool(char *username, int username_len, char * } spool_le.ptr = session_pool; spool_le.type = le_psessionpool; - PHP_OCI_REGISTER_RESOURCE(session_pool, le_psessionpool); +#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) + zend_list_insert(session_pool, le_psessionpool TSRMLS_CC); +#else + zend_list_insert(session_pool, le_psessionpool); +#endif zend_hash_update(&EG(persistent_list), session_pool->spool_hash_key, strlen(session_pool->spool_hash_key)+1,(void *)&spool_le, sizeof(zend_rsrc_list_entry),NULL); } else if (spool_out_le->type == le_psessionpool && strlen(((php_oci_spool *)(spool_out_le->ptr))->spool_hash_key) == spool_hashed_details.len && @@ -2993,8 +2902,7 @@ static php_oci_spool *php_oci_get_spool(char *username, int username_len, char * return session_pool; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_create_env() * @@ -3005,7 +2913,7 @@ static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC) OCIEnv *retenv = NULL; /* create an environment using the character set id */ - PHP_OCI_CALL_RETURN(OCIENVNLSCREATE, OCI_G(errcode), OCIEnvNlsCreate, (&retenv, OCI_G(events) ? PHP_OCI_INIT_MODE | OCI_EVENTS : PHP_OCI_INIT_MODE, 0, NULL, NULL, NULL, 0, NULL, charsetid, charsetid)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIEnvNlsCreate, (&retenv, OCI_G(events) ? PHP_OCI_INIT_MODE | OCI_EVENTS : PHP_OCI_INIT_MODE, 0, NULL, NULL, NULL, 0, NULL, charsetid, charsetid)); if (OCI_G(errcode) != OCI_SUCCESS) { sb4 ora_error_code = 0; @@ -3025,8 +2933,7 @@ static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC) return NULL; } return retenv; -} -/* }}} */ +}/* }}} */ /* {{{ php_oci_old_create_session() * @@ -3037,139 +2944,131 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna { ub4 statement_cache_size = (OCI_G(statement_cache_size) > 0) ? OCI_G(statement_cache_size) : 0; + if (OCI_G(debug_mode)) { + php_printf ("OCI8 DEBUG: Bypassing client-side session pool for session create at (%s:%d) \n", __FILE__, __LINE__); + } + /* Create the OCI environment separate for each connection */ if (!(connection->env = php_oci_create_env(connection->charset TSRMLS_CC))) { return 1; } - /* {{{ Allocate our server handle */ - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->server), OCI_HTYPE_SERVER, 0, NULL)); + /* Allocate our server handle {{{ */ + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->server), OCI_HTYPE_SERVER, 0, NULL)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; - } - /* }}} */ + } /* }}} */ - /* {{{ Attach to the server */ - PHP_OCI_CALL_RETURN(OCISERVERATTACH, OCI_G(errcode), OCIServerAttach, (connection->server, OCI_G(err), (text *)dbname, dbname_len, (ub4) OCI_DEFAULT)); + /* Attach to the server {{{ */ + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIServerAttach, (connection->server, OCI_G(err), (text *)dbname, dbname_len, (ub4) OCI_DEFAULT)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; - } - /* }}} */ + } /* }}} */ connection->is_attached = 1; - /* {{{ Allocate our session handle */ - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->session), OCI_HTYPE_SESSION, 0, NULL)); + /* Allocate our session handle {{{ */ + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->session), OCI_HTYPE_SESSION, 0, NULL)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; - } - /* }}} */ + } /* }}} */ - /* {{{ Allocate our private error-handle */ - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->err), OCI_HTYPE_ERROR, 0, NULL)); + /* Allocate our private error-handle {{{ */ + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->err), OCI_HTYPE_ERROR, 0, NULL)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; - } - /* }}} */ + } /* }}} */ - /* {{{ Allocate our service-context */ - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->svc), OCI_HTYPE_SVCCTX, 0, NULL)); + /* Allocate our service-context {{{ */ + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->svc), OCI_HTYPE_SVCCTX, 0, NULL)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; - } - /* }}} */ + } /* }}} */ - /* {{{ Set the username */ + /* Set the username {{{ */ if (username) { - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) username, (ub4) username_len, (ub4) OCI_ATTR_USERNAME, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) username, (ub4) username_len, (ub4) OCI_ATTR_USERNAME, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; } - } - /* }}} */ + }/* }}} */ - /* {{{ Set the password */ + /* Set the password {{{ */ if (password) { - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) password, (ub4) password_len, (ub4) OCI_ATTR_PASSWORD, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) password, (ub4) password_len, (ub4) OCI_ATTR_PASSWORD, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; } - } - /* }}} */ + }/* }}} */ - /* {{{ Set the edition attribute on the session handle */ + /* Set the edition attribute on the session handle {{{ */ #if ((OCI_MAJOR_VERSION > 11) || ((OCI_MAJOR_VERSION == 11) && (OCI_MINOR_VERSION >= 2))) if (OCI_G(edition)) { - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) OCI_G(edition), (ub4) (strlen(OCI_G(edition))), (ub4) OCI_ATTR_EDITION, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) OCI_G(edition), (ub4) (strlen(OCI_G(edition))), (ub4) OCI_ATTR_EDITION, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; } } -#endif -/* }}} */ +#endif /* }}} */ - /* {{{ Set the driver name attribute on the session handle */ + /* Set the driver name attribute on the session handle {{{ */ #if (OCI_MAJOR_VERSION >= 11) - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) PHP_OCI8_DRIVER_NAME, (ub4) sizeof(PHP_OCI8_DRIVER_NAME)-1, (ub4) OCI_ATTR_DRIVER_NAME, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) PHP_OCI8_DRIVER_NAME, (ub4) sizeof(PHP_OCI8_DRIVER_NAME)-1, (ub4) OCI_ATTR_DRIVER_NAME, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; } -#endif -/* }}} */ +#endif /* }}} */ - /* {{{ Set the server handle in the service handle */ - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, (connection->svc, OCI_HTYPE_SVCCTX, connection->server, 0, OCI_ATTR_SERVER, OCI_G(err))); + /* Set the server handle in the service handle {{{ */ + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, (connection->svc, OCI_HTYPE_SVCCTX, connection->server, 0, OCI_ATTR_SERVER, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; - } - /* }}} */ + } /* }}} */ - /* {{{ Set the authentication handle in the service handle */ - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, (connection->svc, OCI_HTYPE_SVCCTX, connection->session, 0, OCI_ATTR_SESSION, OCI_G(err))); + /* Set the authentication handle in the service handle {{{ */ + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, (connection->svc, OCI_HTYPE_SVCCTX, connection->session, 0, OCI_ATTR_SESSION, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; - } - /* }}} */ + } /* }}} */ if (new_password) { - /* {{{ Try to change password if new one was provided */ - PHP_OCI_CALL_RETURN(OCIPASSWORDCHANGE, OCI_G(errcode), OCIPasswordChange, (connection->svc, OCI_G(err), (text *)username, username_len, (text *)password, password_len, (text *)new_password, new_password_len, OCI_AUTH)); + /* Try to change password if new one was provided {{{ */ + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIPasswordChange, (connection->svc, OCI_G(err), (text *)username, username_len, (text *)password, password_len, (text *)new_password, new_password_len, OCI_AUTH)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; } - PHP_OCI_CALL_RETURN(OCIATTRGET, OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->session), (ub4 *)0, OCI_ATTR_SESSION, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->session), (ub4 *)0, OCI_ATTR_SESSION, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; - } - /* }}} */ + } /* }}} */ } else { - /* {{{ start the session */ + /* start the session {{{ */ ub4 cred_type = OCI_CRED_RDBMS; /* Extract the overloaded session_mode parameter into valid Oracle credential and session mode values */ @@ -3180,7 +3079,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna session_mode |= OCI_STMT_CACHE; - PHP_OCI_CALL_RETURN(OCISESSIONBEGIN, OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) cred_type, (ub4) session_mode)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) cred_type, (ub4) session_mode)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3190,8 +3089,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna if (OCI_G(errcode) != OCI_SUCCESS_WITH_INFO) { return 1; } - } - /* }}} */ + } /* }}} */ } /* Brand new connection: Init and update the next_ping in the connection */ @@ -3200,7 +3098,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna return 1; } - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &statement_cache_size, 0, (ub4) OCI_ATTR_STMTCACHESIZE, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &statement_cache_size, 0, (ub4) OCI_ATTR_STMTCACHESIZE, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3209,8 +3107,7 @@ static int php_oci_old_create_session(php_oci_connection *connection, char *dbna /* Successfully created session */ return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_create_session() * @@ -3241,18 +3138,20 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool connection->using_spool = 1; } -#ifdef HAVE_DTRACE - if (DTRACE_OCI8_SESSPOOL_TYPE_ENABLED()) { - DTRACE_OCI8_SESSPOOL_TYPE(session_pool ? 1 : 0, session_pool ? session_pool : connection->private_spool); + if (OCI_G(debug_mode)) { + if (session_pool) { + php_printf ("OCI8 DEBUG L1: using shared pool: (%p) at (%s:%d) \n", session_pool, __FILE__, __LINE__); + } else { + php_printf ("OCI8 DEBUG L1: using private pool: (%p) at (%s:%d) \n", connection->private_spool, __FILE__, __LINE__); + } } -#endif /* HAVE_DTRACE */ /* The passed in "connection" can be a cached stub from plist or freshly created. In the former * case, we do not have to allocate any handles */ if (!connection->err) { - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->err), OCI_HTYPE_ERROR, 0, NULL)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->err), OCI_HTYPE_ERROR, 0, NULL)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3262,7 +3161,7 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool /* {{{ Allocate and initialize the connection-private authinfo handle if not allocated yet */ if (!connection->authinfo) { - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->authinfo), OCI_HTYPE_AUTHINFO, 0, NULL)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->authinfo), OCI_HTYPE_AUTHINFO, 0, NULL)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3271,7 +3170,7 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool /* Set the Connection class and purity if OCI client version >= 11g */ #if (OCI_MAJOR_VERSION > 10) - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode),OCIAttrSet, ((dvoid *) connection->authinfo,(ub4) OCI_HTYPE_SESSION, (dvoid *) OCI_G(connection_class), (ub4)(strlen(OCI_G(connection_class))), (ub4)OCI_ATTR_CONNECTION_CLASS, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode),OCIAttrSet, ((dvoid *) connection->authinfo,(ub4) OCI_HTYPE_SESSION, (dvoid *) OCI_G(connection_class), (ub4)(strlen(OCI_G(connection_class))), (ub4)OCI_ATTR_CONNECTION_CLASS, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3283,27 +3182,23 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool else purity = OCI_ATTR_PURITY_NEW; - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode),OCIAttrSet, ((dvoid *) connection->authinfo,(ub4) OCI_HTYPE_AUTHINFO, (dvoid *) &purity, (ub4)0, (ub4)OCI_ATTR_PURITY, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode),OCIAttrSet, ((dvoid *) connection->authinfo,(ub4) OCI_HTYPE_AUTHINFO, (dvoid *) &purity, (ub4)0, (ub4)OCI_ATTR_PURITY, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; } #endif - } - /* }}} */ + } /* }}} */ - /* {{{ Debug statements */ -#ifdef HAVE_DTRACE - if (DTRACE_OCI8_SESSPOOL_STATS_ENABLED()) { + /* Debug statements {{{ */ + if (OCI_G(debug_mode)) { ub4 numfree = 0, numbusy = 0, numopen = 0; - PHP_OCI_CALL_RETURN(OCIATTRGET, OCI_G(errcode), OCIAttrGet, ((dvoid *)actual_spool->poolh, OCI_HTYPE_SPOOL, (dvoid *)&numopen, (ub4 *)0, OCI_ATTR_SPOOL_OPEN_COUNT, OCI_G(err))); - PHP_OCI_CALL_RETURN(OCIATTRGET, OCI_G(errcode), OCIAttrGet, ((dvoid *)actual_spool->poolh, OCI_HTYPE_SPOOL, (dvoid *)&numbusy, (ub4 *)0, OCI_ATTR_SPOOL_BUSY_COUNT, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)actual_spool->poolh, OCI_HTYPE_SPOOL, (dvoid *)&numopen, (ub4 *)0, OCI_ATTR_SPOOL_OPEN_COUNT, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)actual_spool->poolh, OCI_HTYPE_SPOOL, (dvoid *)&numbusy, (ub4 *)0, OCI_ATTR_SPOOL_BUSY_COUNT, OCI_G(err))); numfree = numopen - numbusy; /* number of free connections in the pool */ - DTRACE_OCI8_SESSPOOL_STATS(numfree, numbusy, numopen); - } -#endif /* HAVE_DTRACE */ - /* }}} */ + php_printf ("OCI8 DEBUG L1: (numopen=%d)(numbusy=%d)(numfree=%d) at (%s:%d) \n", numopen, numbusy, numfree, __FILE__, __LINE__); + } /* }}} */ /* Ping loop: Ping and loop till we get a good connection. When a database instance goes * down, it can leave several bad connections that need to be flushed out before getting a @@ -3313,7 +3208,7 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool */ do { /* Continue to use the global error handle as the connection is closed when an error occurs */ - PHP_OCI_CALL_RETURN(OCISESSIONGET, OCI_G(errcode),OCISessionGet, (connection->env, OCI_G(err), &(connection->svc), (OCIAuthInfo *)connection->authinfo, (OraText *)actual_spool->poolname, (ub4)actual_spool->poolname_len, NULL, 0, NULL, NULL, NULL, OCI_SESSGET_SPOOL)); + PHP_OCI_CALL_RETURN(OCI_G(errcode),OCISessionGet, (connection->env, OCI_G(err), &(connection->svc), (OCIAuthInfo *)connection->authinfo, (OraText *)actual_spool->poolname, (ub4)actual_spool->poolname_len, NULL, 0, NULL, NULL, NULL, OCI_SESSGET_SPOOL)); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3328,12 +3223,11 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool } /* {{{ Populate the session and server fields of the connection */ - PHP_OCI_CALL_RETURN(OCIATTRGET, OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->server), (ub4 *)0, OCI_ATTR_SERVER, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->server), (ub4 *)0, OCI_ATTR_SERVER, OCI_G(err))); - PHP_OCI_CALL_RETURN(OCIATTRGET, OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->session), (ub4 *)0, OCI_ATTR_SESSION, OCI_G(err))); - /* }}} */ + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->session), (ub4 *)0, OCI_ATTR_SESSION, OCI_G(err))); /* }}} */ - PHP_OCI_CALL_RETURN(OCICONTEXTGETVALUE, OCI_G(errcode), OCIContextGetValue, (connection->session, OCI_G(err), (ub1 *)"NEXT_PING", (ub1)sizeof("NEXT_PING"), (void **)&(connection->next_pingp))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIContextGetValue, (connection->session, OCI_G(err), (ub1 *)"NEXT_PING", (ub1)sizeof("NEXT_PING"), (void **)&(connection->next_pingp))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); return 1; @@ -3351,7 +3245,7 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool *(connection->next_pingp) = timestamp + OCI_G(ping_interval); } else { /* Bad connection - remove from pool */ - PHP_OCI_CALL(OCISESSIONRELEASE, OCISessionRelease, (connection->svc, connection->err, NULL,0, (ub4) OCI_SESSRLS_DROPSESS)); + PHP_OCI_CALL(OCISessionRelease, (connection->svc, connection->err, NULL,0, (ub4) OCI_SESSRLS_DROPSESS)); connection->svc = NULL; connection->server = NULL; connection->session = NULL; @@ -3359,7 +3253,7 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool } /* If ping applicable */ } while (!(connection->svc)); - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &statement_cache_size, 0, (ub4) OCI_ATTR_STMTCACHESIZE, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &statement_cache_size, 0, (ub4) OCI_ATTR_STMTCACHESIZE, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -3371,8 +3265,7 @@ static int php_oci_create_session(php_oci_connection *connection, php_oci_spool connection->is_attached = connection->is_open = 1; return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_spool_list_dtor() * @@ -3387,8 +3280,7 @@ static void php_oci_spool_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC) } return; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_spool_close() * @@ -3397,20 +3289,20 @@ static void php_oci_spool_list_dtor(zend_rsrc_list_entry *entry TSRMLS_DC) static void php_oci_spool_close(php_oci_spool *session_pool TSRMLS_DC) { if (session_pool->poolname_len) { - PHP_OCI_CALL(OCISESSIONPOOLDESTROY, OCISessionPoolDestroy, ((dvoid *) session_pool->poolh, + PHP_OCI_CALL(OCISessionPoolDestroy, ((dvoid *) session_pool->poolh, (dvoid *) session_pool->err, OCI_SPD_FORCE)); } if (session_pool->poolh) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) session_pool->poolh, OCI_HTYPE_SPOOL)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) session_pool->poolh, OCI_HTYPE_SPOOL)); } if (session_pool->err) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) session_pool->err, OCI_HTYPE_ERROR)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) session_pool->err, OCI_HTYPE_ERROR)); } if (session_pool->env) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) session_pool->env, OCI_HTYPE_ENV)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) session_pool->env, OCI_HTYPE_ENV)); } if (session_pool->spool_hash_key) { @@ -3418,8 +3310,7 @@ static void php_oci_spool_close(php_oci_spool *session_pool TSRMLS_DC) } free(session_pool); -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_ping_init() * @@ -3431,14 +3322,14 @@ static sword php_oci_ping_init(php_oci_connection *connection, OCIError *errh TS { time_t *next_pingp = NULL; - PHP_OCI_CALL_RETURN(OCICONTEXTGETVALUE, OCI_G(errcode), OCIContextGetValue, (connection->session, errh, (ub1 *)"NEXT_PING", (ub1)sizeof("NEXT_PING"), (void **)&next_pingp)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIContextGetValue, (connection->session, errh, (ub1 *)"NEXT_PING", (ub1)sizeof("NEXT_PING"), (void **)&next_pingp)); if (OCI_G(errcode) != OCI_SUCCESS) { return OCI_G(errcode); } /* This must be a brand-new connection. Allocate memory for the ping */ if (!next_pingp) { - PHP_OCI_CALL_RETURN(OCIMEMORYALLOC, OCI_G(errcode), OCIMemoryAlloc, (connection->session, errh, (void **)&next_pingp, OCI_DURATION_SESSION, sizeof(time_t), OCI_MEMORY_CLEARED)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIMemoryAlloc, (connection->session, errh, (void **)&next_pingp, OCI_DURATION_SESSION, sizeof(time_t), OCI_MEMORY_CLEARED)); if (OCI_G(errcode) != OCI_SUCCESS) { return OCI_G(errcode); } @@ -3452,7 +3343,7 @@ static sword php_oci_ping_init(php_oci_connection *connection, OCIError *errh TS } /* Set the new ping value into the connection */ - PHP_OCI_CALL_RETURN(OCICONTEXTSETVALUE, OCI_G(errcode), OCIContextSetValue, (connection->session, errh, OCI_DURATION_SESSION, (ub1 *)"NEXT_PING", (ub1)sizeof("NEXT_PING"), next_pingp)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIContextSetValue, (connection->session, errh, OCI_DURATION_SESSION, (ub1 *)"NEXT_PING", (ub1)sizeof("NEXT_PING"), next_pingp)); if (OCI_G(errcode) != OCI_SUCCESS) { OCIMemoryFree(connection->session, errh, next_pingp); return OCI_G(errcode); @@ -3462,8 +3353,7 @@ static sword php_oci_ping_init(php_oci_connection *connection, OCIError *errh TS connection->next_pingp = next_pingp; return OCI_SUCCESS; -} -/* }}} */ +} /* }}} */ #endif /* HAVE_OCI8 */ diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c index 27430e8823801..763e12e9249d7 100644 --- a/ext/oci8/oci8_collection.c +++ b/ext/oci8/oci8_collection.c @@ -55,10 +55,10 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c collection->connection = connection; collection->collection = NULL; - zend_list_addref(collection->connection->id); + zend_list_addref(collection->connection->rsrc_id); /* get type handle by name */ - PHP_OCI_CALL_RETURN(OCITYPEBYNAME, connection->errcode, OCITypeByName, + PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByName, ( connection->env, connection->err, @@ -80,14 +80,14 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c } /* allocate describe handle */ - PHP_OCI_CALL_RETURN(OCIHANDLEALLOC, connection->errcode, OCIHandleAlloc, (connection->env, (dvoid **) &dschp1, (ub4) OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0)); + PHP_OCI_CALL_RETURN(connection->errcode, OCIHandleAlloc, (connection->env, (dvoid **) &dschp1, (ub4) OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0)); if (connection->errcode != OCI_SUCCESS) { goto CLEANUP; } /* describe TDO */ - PHP_OCI_CALL_RETURN(OCIDESCRIBEANY, connection->errcode, OCIDescribeAny, + PHP_OCI_CALL_RETURN(connection->errcode, OCIDescribeAny, ( connection->svc, connection->err, @@ -105,14 +105,14 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c } /* get first parameter handle */ - PHP_OCI_CALL_RETURN(OCIATTRGET, connection->errcode, OCIAttrGet, ((dvoid *) dschp1, (ub4) OCI_HTYPE_DESCRIBE, (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM, connection->err)); + PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, ((dvoid *) dschp1, (ub4) OCI_HTYPE_DESCRIBE, (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM, connection->err)); if (connection->errcode != OCI_SUCCESS) { goto CLEANUP; } /* get the collection type code of the attribute */ - PHP_OCI_CALL_RETURN(OCIATTRGET, connection->errcode, OCIAttrGet, + PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, ( (dvoid*) parmp1, (ub4) OCI_DTYPE_PARAM, @@ -131,7 +131,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c case OCI_TYPECODE_TABLE: case OCI_TYPECODE_VARRAY: /* get collection element handle */ - PHP_OCI_CALL_RETURN(OCIATTRGET, connection->errcode, OCIAttrGet, + PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, ( (dvoid*) parmp1, (ub4) OCI_DTYPE_PARAM, @@ -147,7 +147,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c } /* get REF of the TDO for the type */ - PHP_OCI_CALL_RETURN(OCIATTRGET, connection->errcode, OCIAttrGet, + PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, ( (dvoid*) parmp2, (ub4) OCI_DTYPE_PARAM, @@ -163,7 +163,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c } /* get the TDO (only header) */ - PHP_OCI_CALL_RETURN(OCITYPEBYREF, connection->errcode, OCITypeByRef, + PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByRef, ( connection->env, connection->err, @@ -179,7 +179,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c } /* get typecode */ - PHP_OCI_CALL_RETURN(OCIATTRGET, connection->errcode, OCIAttrGet, + PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, ( (dvoid*) parmp2, (ub4) OCI_DTYPE_PARAM, @@ -201,7 +201,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c } /* Create object to hold return table */ - PHP_OCI_CALL_RETURN(OCIOBJECTNEW, connection->errcode, OCIObjectNew, + PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectNew, ( connection->env, connection->err, @@ -220,7 +220,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c } /* free the describe handle (Bug #44113) */ - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE)); PHP_OCI_REGISTER_RESOURCE(collection, le_collection); return collection; @@ -228,14 +228,13 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c if (dschp1) { /* free the describe handle (Bug #44113) */ - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE)); + PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE)); } connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); php_oci_collection_close(collection TSRMLS_CC); return NULL; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_size() Return size of the collection */ @@ -243,7 +242,7 @@ int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC) { php_oci_connection *connection = collection->connection; - PHP_OCI_CALL_RETURN(OCICOLLSIZE, connection->errcode, OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size)); + PHP_OCI_CALL_RETURN(connection->errcode, OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -251,8 +250,7 @@ int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC) return 1; } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_max() Return max number of elements in the collection */ @@ -260,12 +258,11 @@ int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC) { php_oci_connection *connection = collection->connection; - PHP_OCI_CALL_RETURN(OCICOLLMAX, *max, OCICollMax, (connection->env, collection->collection)); + PHP_OCI_CALL_RETURN(*max, OCICollMax, (connection->env, collection->collection)); /* error handling is not necessary here? */ return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_trim() Trim collection to the given number of elements */ @@ -273,7 +270,7 @@ int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRML { php_oci_connection *connection = collection->connection; - PHP_OCI_CALL_RETURN(OCICOLLTRIM, connection->errcode, OCICollTrim, (connection->env, connection->err, trim_size, collection->collection)); + PHP_OCI_CALL_RETURN(connection->errcode, OCICollTrim, (connection->env, connection->err, trim_size, collection->collection)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -281,8 +278,7 @@ int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRML return 1; } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_append_null() Append NULL element to the end of the collection */ @@ -292,7 +288,7 @@ int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC) php_oci_connection *connection = collection->connection; /* append NULL element */ - PHP_OCI_CALL_RETURN(OCICOLLAPPEND, connection->errcode, OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection)); + PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -300,8 +296,7 @@ int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC) return 1; } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_append_date() Append DATE element to the end of the collection (use "DD-MON-YY" format) */ @@ -312,7 +307,7 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i php_oci_connection *connection = collection->connection; /* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */ - PHP_OCI_CALL_RETURN(OCIDATEFROMTEXT, connection->errcode, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date)); if (connection->errcode != OCI_SUCCESS) { /* failed to convert string to date */ @@ -321,7 +316,7 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i return 1; } - PHP_OCI_CALL_RETURN(OCICOLLAPPEND, connection->errcode, OCICollAppend, + PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, ( connection->env, connection->err, @@ -338,8 +333,7 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_append_number() Append NUMBER to the end of the collection */ @@ -358,7 +352,7 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe element_double = zend_strtod(number, NULL); #endif - PHP_OCI_CALL_RETURN(OCINUMBERFROMREAL, connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); + PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -366,7 +360,7 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe return 1; } - PHP_OCI_CALL_RETURN(OCICOLLAPPEND, connection->errcode, OCICollAppend, + PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, ( connection->env, connection->err, @@ -383,8 +377,7 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_append_string() Append STRING to the end of the collection */ @@ -394,7 +387,7 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme OCIString *ocistr = (OCIString *)0; php_oci_connection *connection = collection->connection; - PHP_OCI_CALL_RETURN(OCISTRINGASSIGNTEXT, connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr)); + PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -402,7 +395,7 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme return 1; } - PHP_OCI_CALL_RETURN(OCICOLLAPPEND, connection->errcode, OCICollAppend, + PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, ( connection->env, connection->err, @@ -419,8 +412,7 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_append() Append wrapper. Appends any supported element to the end of the collection */ @@ -460,8 +452,7 @@ int php_oci_collection_append(php_oci_collection *collection, char *element, int } /* never reached */ return 1; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_element_get() Get the element with the given index */ @@ -477,7 +468,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z MAKE_STD_ZVAL(*result_element); ZVAL_NULL(*result_element); - PHP_OCI_CALL_RETURN(OCICOLLGETELEM, connection->errcode, OCICollGetElem, + PHP_OCI_CALL_RETURN(connection->errcode, OCICollGetElem, ( connection->env, connection->err, @@ -509,7 +500,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z switch (collection->element_typecode) { case OCI_TYPECODE_DATE: - PHP_OCI_CALL_RETURN(OCIDATETOTEXT, connection->errcode, OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff)); + PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -529,7 +520,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z OCIString *oci_string = *(OCIString **)element; text *str; - PHP_OCI_CALL_RETURN(OCISTRINGPTR, str, OCIStringPtr, (connection->env, oci_string)); + PHP_OCI_CALL_RETURN(str, OCIStringPtr, (connection->env, oci_string)); if (str) { ZVAL_STRING(*result_element, (char *)str, 1); @@ -552,7 +543,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z { double double_number; - PHP_OCI_CALL_RETURN(OCINUMBERTOREAL, connection->errcode, OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number)); + PHP_OCI_CALL_RETURN(connection->errcode, OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -574,8 +565,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z } /* never reached */ return 1; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_element_set_null() Set the element with the given index to NULL */ @@ -585,7 +575,7 @@ int php_oci_collection_element_set_null(php_oci_collection *collection, long ind php_oci_connection *connection = collection->connection; /* set NULL element */ - PHP_OCI_CALL_RETURN(OCICOLLASSIGNELEM, connection->errcode, OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection)); + PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -593,8 +583,7 @@ int php_oci_collection_element_set_null(php_oci_collection *collection, long ind return 1; } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_element_set_date() Change element's value to the given DATE */ @@ -605,7 +594,7 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind php_oci_connection *connection = collection->connection; /* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */ - PHP_OCI_CALL_RETURN(OCIDATEFROMTEXT, connection->errcode, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date)); if (connection->errcode != OCI_SUCCESS) { /* failed to convert string to date */ @@ -614,7 +603,7 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind return 1; } - PHP_OCI_CALL_RETURN(OCICOLLASSIGNELEM, connection->errcode, OCICollAssignElem, + PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, ( connection->env, connection->err, @@ -632,8 +621,7 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_element_set_number() Change element's value to the given NUMBER */ @@ -652,7 +640,7 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i element_double = zend_strtod(number, NULL); #endif - PHP_OCI_CALL_RETURN(OCINUMBERFROMREAL, connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); + PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -660,7 +648,7 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i return 1; } - PHP_OCI_CALL_RETURN(OCICOLLASSIGNELEM, connection->errcode, OCICollAssignElem, + PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, ( connection->env, connection->err, @@ -678,8 +666,7 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_element_set_string() Change element's value to the given string */ @@ -689,7 +676,7 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i OCIString *ocistr = (OCIString *)0; php_oci_connection *connection = collection->connection; - PHP_OCI_CALL_RETURN(OCISTRINGASSIGNTEXT, connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr)); + PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -697,7 +684,7 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i return 1; } - PHP_OCI_CALL_RETURN(OCICOLLASSIGNELEM, connection->errcode, OCICollAssignElem, + PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, ( connection->env, connection->err, @@ -715,8 +702,7 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_element_set() Collection element setter */ @@ -756,8 +742,7 @@ int php_oci_collection_element_set(php_oci_collection *collection, long index, c } /* never reached */ return 1; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_assign() Assigns a value to the collection from another collection */ @@ -765,7 +750,7 @@ int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_colle { php_oci_connection *connection = collection_dest->connection; - PHP_OCI_CALL_RETURN(OCICOLLASSIGN, connection->errcode, OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection)); + PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -773,8 +758,7 @@ int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_colle return 1; } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_collection_close() Destroy collection and all associated resources */ @@ -783,7 +767,7 @@ void php_oci_collection_close(php_oci_collection *collection TSRMLS_DC) php_oci_connection *connection = collection->connection; if (collection->collection) { - PHP_OCI_CALL_RETURN(OCIOBJECTFREE, connection->errcode, OCIObjectFree, (connection->env, connection->err, (dvoid *)collection->collection, (ub2)OCI_OBJECTFREE_FORCE)); + PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectFree, (connection->env, connection->err, (dvoid *)collection->collection, (ub2)OCI_OBJECTFREE_FORCE)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -791,12 +775,11 @@ void php_oci_collection_close(php_oci_collection *collection TSRMLS_DC) } } - zend_list_delete(collection->connection->id); + zend_list_delete(collection->connection->rsrc_id); efree(collection); return; -} -/* }}} */ +} /* }}} */ #endif /* HAVE_OCI8 */ diff --git a/ext/oci8/oci8_dtrace.d b/ext/oci8/oci8_dtrace.d deleted file mode 100644 index 61f42ae17c85e..0000000000000 --- a/ext/oci8/oci8_dtrace.d +++ /dev/null @@ -1,195 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 2013 Zend Technologies Ltd. (http://www.zend.com) | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.zend.com/license/3_01.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Christopher Jones | - +----------------------------------------------------------------------+ -*/ - -provider php { - probe oci8__connect_start(char *username, char *dbname, char *charset, long session_mode, int persistent, int exclusive); - probe oci8__connect_done(); - probe oci8__sqltext(char *sql); - probe oci8__error(int status, long errcode); - probe oci8__execute_mode(unsigned int mode); - - probe oci8__connect_p_dtor_close(void *connection); - probe oci8__connect_p_dtor_release(void *connection); - probe oci8__connect_lookup(void *connection, int is_stub); - probe oci8__connect_expiry(void *connection, int is_stub, time_t idle_expiry, time_t timestamp); - probe oci8__connect_type(int is_persistent, int exclusive, void *connection, long num_persistent, long num_links); - probe oci8__sesspool_create(void *session_pool); - probe oci8__sesspool_stats(unsigned long free, unsigned long busy, unsigned long open); - probe oci8__sesspool_type(int type, void *session_pool); - - probe oci8__ociattrget_start(); - probe oci8__ociattrget_done(); - probe oci8__ociattrset_start(); - probe oci8__ociattrset_done(); - probe oci8__ocibindbyname_start(); - probe oci8__ocibindbyname_done(); - probe oci8__ocibinddynamic_start(); - probe oci8__ocibinddynamic_done(); - probe oci8__ocibindobject_start(); - probe oci8__ocibindobject_done(); - probe oci8__ociclientversion_start(); - probe oci8__ociclientversion_done(); - probe oci8__ocicollappend_start(); - probe oci8__ocicollappend_done(); - probe oci8__ocicollassign_start(); - probe oci8__ocicollassign_done(); - probe oci8__ocicollassignelem_start(); - probe oci8__ocicollassignelem_done(); - probe oci8__ocicollgetelem_start(); - probe oci8__ocicollgetelem_done(); - probe oci8__ocicollmax_start(); - probe oci8__ocicollmax_done(); - probe oci8__ocicollsize_start(); - probe oci8__ocicollsize_done(); - probe oci8__ocicolltrim_start(); - probe oci8__ocicolltrim_done(); - probe oci8__ocicontextgetvalue_start(); - probe oci8__ocicontextgetvalue_done(); - probe oci8__ocicontextsetvalue_start(); - probe oci8__ocicontextsetvalue_done(); - probe oci8__ocidatefromtext_start(); - probe oci8__ocidatefromtext_done(); - probe oci8__ocidatetotext_start(); - probe oci8__ocidatetotext_done(); - probe oci8__ocidefinebypos_start(); - probe oci8__ocidefinebypos_done(); - probe oci8__ocidefinedynamic_start(); - probe oci8__ocidefinedynamic_done(); - probe oci8__ocidescribeany_start(); - probe oci8__ocidescribeany_done(); - probe oci8__ocidescriptoralloc_start(); - probe oci8__ocidescriptoralloc_done(); - probe oci8__ocidescriptorfree_start(); - probe oci8__ocidescriptorfree_done(); - probe oci8__ocienvnlscreate_start(); - probe oci8__ocienvnlscreate_done(); - probe oci8__ocierrorget_start(); - probe oci8__ocierrorget_done(); - probe oci8__ocihandlealloc_start(); - probe oci8__ocihandlealloc_done(); - probe oci8__ocihandlefree_start(); - probe oci8__ocihandlefree_done(); - probe oci8__ocilobappend_start(); - probe oci8__ocilobappend_done(); - probe oci8__ocilobcharsetid_start(); - probe oci8__ocilobcharsetid_done(); - probe oci8__ocilobclose_start(); - probe oci8__ocilobclose_done(); - probe oci8__ocilobcopy_start(); - probe oci8__ocilobcopy_done(); - probe oci8__ocilobcreatetemporary_start(); - probe oci8__ocilobcreatetemporary_done(); - probe oci8__ocilobdisablebuffering_start(); - probe oci8__ocilobdisablebuffering_done(); - probe oci8__ocilobenablebuffering_start(); - probe oci8__ocilobenablebuffering_done(); - probe oci8__ociloberase_start(); - probe oci8__ociloberase_done(); - probe oci8__ocilobfileclose_start(); - probe oci8__ocilobfileclose_done(); - probe oci8__ocilobfileopen_start(); - probe oci8__ocilobfileopen_done(); - probe oci8__ocilobflushbuffer_start(); - probe oci8__ocilobflushbuffer_done(); - probe oci8__ocilobfreetemporary_start(); - probe oci8__ocilobfreetemporary_done(); - probe oci8__ocilobgetchunksize_start(); - probe oci8__ocilobgetchunksize_done(); - probe oci8__ocilobgetlength_start(); - probe oci8__ocilobgetlength_done(); - probe oci8__ocilobisequal_start(); - probe oci8__ocilobisequal_done(); - probe oci8__ocilobistemporary_start(); - probe oci8__ocilobistemporary_done(); - probe oci8__ocilobopen_start(); - probe oci8__ocilobopen_done(); - probe oci8__ocilobread2_start(); - probe oci8__ocilobread2_done(); - probe oci8__ocilobtrim_start(); - probe oci8__ocilobtrim_done(); - probe oci8__ocilobwrite_start(); - probe oci8__ocilobwrite_done(); - probe oci8__ocimemoryalloc_start(); - probe oci8__ocimemoryalloc_done(); - probe oci8__ocimemoryfree_start(); - probe oci8__ocimemoryfree_done(); - probe oci8__ocinlscharsetnametoid_start(); - probe oci8__ocinlscharsetnametoid_done(); - probe oci8__ocinlsenvironmentvariableget_start(); - probe oci8__ocinlsenvironmentvariableget_done(); - probe oci8__ocinlsnumericinfoget_start(); - probe oci8__ocinlsnumericinfoget_done(); - probe oci8__ocinumberfromreal_start(); - probe oci8__ocinumberfromreal_done(); - probe oci8__ocinumbertoreal_start(); - probe oci8__ocinumbertoreal_done(); - probe oci8__ociobjectfree_start(); - probe oci8__ociobjectfree_done(); - probe oci8__ociobjectnew_start(); - probe oci8__ociobjectnew_done(); - probe oci8__ociparamget_start(); - probe oci8__ociparamget_done(); - probe oci8__ocipasswordchange_start(); - probe oci8__ocipasswordchange_done(); - probe oci8__ociping_start(); - probe oci8__ociping_done(); - probe oci8__ociserverattach_start(); - probe oci8__ociserverattach_done(); - probe oci8__ociserverdetach_start(); - probe oci8__ociserverdetach_done(); - probe oci8__ociserverversion_start(); - probe oci8__ociserverversion_done(); - probe oci8__ocisessionbegin_start(); - probe oci8__ocisessionbegin_done(); - probe oci8__ocisessionend_start(); - probe oci8__ocisessionend_done(); - probe oci8__ocisessionget_start(); - probe oci8__ocisessionget_done(); - probe oci8__ocisessionpoolcreate_start(); - probe oci8__ocisessionpoolcreate_done(); - probe oci8__ocisessionpooldestroy_start(); - probe oci8__ocisessionpooldestroy_done(); - probe oci8__ocisessionrelease_start(); - probe oci8__ocisessionrelease_done(); - probe oci8__ocistmtexecute_start(); - probe oci8__ocistmtexecute_done(); - probe oci8__ocistmtfetch_start(); - probe oci8__ocistmtfetch_done(); - probe oci8__ocistmtgetnextresult_start(); - probe oci8__ocistmtgetnextresult_done(); - probe oci8__ocistmtgetpieceinfo_start(); - probe oci8__ocistmtgetpieceinfo_done(); - probe oci8__ocistmtprepare2_start(); - probe oci8__ocistmtprepare2_done(); - probe oci8__ocistmtrelease_start(); - probe oci8__ocistmtrelease_done(); - probe oci8__ocistmtsetpieceinfo_start(); - probe oci8__ocistmtsetpieceinfo_done(); - probe oci8__ocistringassigntext_start(); - probe oci8__ocistringassigntext_done(); - probe oci8__ocistringptr_start(); - probe oci8__ocistringptr_done(); - probe oci8__ocitranscommit_start(); - probe oci8__ocitranscommit_done(); - probe oci8__ocitransrollback_start(); - probe oci8__ocitransrollback_done(); - probe oci8__ocitypebyname_start(); - probe oci8__ocitypebyname_done(); - probe oci8__ocitypebyref_start(); - probe oci8__ocitypebyref_done(); -}; diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index 70ec4b5093cfd..e51d3c92f5272 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -1583,7 +1583,7 @@ PHP_FUNCTION(oci_close) } PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - zend_list_delete(connection->id); + zend_list_delete(connection->rsrc_id); ZVAL_NULL(z_connection); @@ -1591,7 +1591,7 @@ PHP_FUNCTION(oci_close) } /* }}} */ -/* {{{ proto resource oci_new_connect(string user, string pass [, string db, string charset [, int session_mode ]]) +/* {{{ proto resource oci_new_connect(string user, string pass [, string db]) Connect to an Oracle database and log on. Returns a new session. */ PHP_FUNCTION(oci_new_connect) { @@ -1607,7 +1607,7 @@ PHP_FUNCTION(oci_connect) } /* }}} */ -/* {{{ proto resource oci_pconnect(string user, string pass [, string db [, string charset [, int session_mode ]]) +/* {{{ proto resource oci_pconnect(string user, string pass [, string db [, string charset ]]) Connect to an Oracle database using a persistent connection and log on. Returns a new session. */ PHP_FUNCTION(oci_pconnect) { @@ -1744,12 +1744,7 @@ PHP_FUNCTION(oci_set_prefetch) PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - if (size < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of rows to be prefetched has to be greater than or equal to 0"); - return; - } - - if (php_oci_statement_set_prefetch(statement, (ub4)size TSRMLS_CC)) { + if (php_oci_statement_set_prefetch(statement, size TSRMLS_CC)) { RETURN_FALSE; } RETURN_TRUE; @@ -1771,7 +1766,7 @@ PHP_FUNCTION(oci_set_client_identifier) PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) client_id, (ub4) client_id_len, (ub4) OCI_ATTR_CLIENT_IDENTIFIER, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) client_id, (ub4) client_id_len, (ub4) OCI_ATTR_CLIENT_IDENTIFIER, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -1814,7 +1809,7 @@ PHP_FUNCTION(oci_set_edition) /* }}} */ /* {{{ proto bool oci_set_module_name(resource connection, string value) - Sets the module attribute on the connection for end-to-end tracing */ + Sets the module attribute on the connection */ PHP_FUNCTION(oci_set_module_name) { #if (OCI_MAJOR_VERSION >= 10) @@ -1829,7 +1824,7 @@ PHP_FUNCTION(oci_set_module_name) PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) module, (ub4) module_len, (ub4) OCI_ATTR_MODULE, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) module, (ub4) module_len, (ub4) OCI_ATTR_MODULE, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -1845,7 +1840,7 @@ PHP_FUNCTION(oci_set_module_name) /* }}} */ /* {{{ proto bool oci_set_action(resource connection, string value) - Sets the action attribute on the connection for end-to-end tracing */ + Sets the action attribute on the connection */ PHP_FUNCTION(oci_set_action) { #if (OCI_MAJOR_VERSION >= 10) @@ -1860,7 +1855,7 @@ PHP_FUNCTION(oci_set_action) PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) action, (ub4) action_len, (ub4) OCI_ATTR_ACTION, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) action, (ub4) action_len, (ub4) OCI_ATTR_ACTION, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -1876,7 +1871,7 @@ PHP_FUNCTION(oci_set_action) /* }}} */ /* {{{ proto bool oci_set_client_info(resource connection, string value) - Sets the client info attribute on the connection for end-to-end tracing */ + Sets the client info attribute on the connection */ PHP_FUNCTION(oci_set_client_info) { #if (OCI_MAJOR_VERSION >= 10) @@ -1891,7 +1886,7 @@ PHP_FUNCTION(oci_set_client_info) PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - PHP_OCI_CALL_RETURN(OCIATTRSET, OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) client_info, (ub4) client_info_len, (ub4) OCI_ATTR_CLIENT_INFO, OCI_G(err))); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) client_info, (ub4) client_info_len, (ub4) OCI_ATTR_CLIENT_INFO, OCI_G(err))); if (OCI_G(errcode) != OCI_SUCCESS) { php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -1962,7 +1957,7 @@ PHP_FUNCTION(oci_password_change) if (!connection) { RETURN_FALSE; } - RETURN_RESOURCE(connection->id); + RETURN_RESOURCE(connection->rsrc_id); } WRONG_PARAM_COUNT; } @@ -2400,32 +2395,6 @@ PHP_FUNCTION(oci_new_collection) } /* }}} */ -/* {{{ proto bool oci_get_implicit(resource stmt) - Get the next statement resource from an Oracle 12c PL/SQL Implicit Result Set */ -PHP_FUNCTION(oci_get_implicit_resultset) -{ - zval *z_statement; - php_oci_statement *statement; - php_oci_statement *imp_statement; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_statement) == FAILURE) { - return; - } - - PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - - imp_statement = php_oci_get_implicit_resultset(statement TSRMLS_CC); - - if (imp_statement) { - if (php_oci_statement_execute(imp_statement, (ub4)OCI_DEFAULT TSRMLS_CC)) - RETURN_FALSE; - RETURN_RESOURCE(imp_statement->id); - } - RETURN_FALSE; -} - -/* }}} */ - #endif /* HAVE_OCI8 */ /* diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c index bd5b7065f431e..d05e053919217 100644 --- a/ext/oci8/oci8_lob.c +++ b/ext/oci8/oci8_lob.c @@ -70,9 +70,9 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ descriptor = ecalloc(1, sizeof(php_oci_descriptor)); descriptor->type = type; descriptor->connection = connection; - zend_list_addref(descriptor->connection->id); + zend_list_addref(descriptor->connection->rsrc_id); - PHP_OCI_CALL_RETURN(OCIDESCRIPTORALLOC, OCI_G(errcode), OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0)); + PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0)); if (OCI_G(errcode) != OCI_SUCCESS) { OCI_G(errcode) = php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); @@ -109,8 +109,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ } return descriptor; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_lob_get_length() Get length of the LOB. The length is cached so we don't need to ask Oracle every time */ @@ -125,7 +124,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D return 0; } else { if (descriptor->type == OCI_DTYPE_FILE) { - PHP_OCI_CALL_RETURN(OCILOBFILEOPEN, connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); @@ -133,7 +132,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D } } - PHP_OCI_CALL_RETURN(OCILOBGETLENGTH, connection->errcode, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -144,7 +143,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D descriptor->lob_size = *length; if (descriptor->type == OCI_DTYPE_FILE) { - PHP_OCI_CALL_RETURN(OCILOBFILECLOSE, connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -154,8 +153,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D } } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_lob_callback() Append LOB portion to a memory buffer */ @@ -205,8 +203,7 @@ sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece) } /* }}} */ -/* {{{ php_oci_lob_calculate_buffer() - Work out the size for LOB buffering */ +/* {{{ php_oci_lob_calculate_buffer() */ static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, long read_length TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; @@ -217,7 +214,7 @@ static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, l } if (!descriptor->chunk_size) { - PHP_OCI_CALL_RETURN(OCILOBGETCHUNKSIZE, connection->errcode, OCILobGetChunkSize, (connection->svc, connection->err, descriptor->descriptor, &chunk_size)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobGetChunkSize, (connection->svc, connection->err, descriptor->descriptor, &chunk_size)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -289,7 +286,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini offset = initial_offset; if (descriptor->type == OCI_DTYPE_FILE) { - PHP_OCI_CALL_RETURN(OCILOBFILEOPEN, connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -299,7 +296,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini } else { ub2 charset_id = 0; - PHP_OCI_CALL_RETURN(OCILOBCHARSETID, connection->errcode, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -313,7 +310,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini } if (is_clob) { - PHP_OCI_CALL_RETURN(OCINLSNUMERICINFOGET, connection->errcode, OCINlsNumericInfoGet, (connection->env, connection->err, &bytes_per_char, OCI_NLS_CHARSET_MAXBYTESZ)); + PHP_OCI_CALL_RETURN(connection->errcode, OCINlsNumericInfoGet, (connection->env, connection->err, &bytes_per_char, OCI_NLS_CHARSET_MAXBYTESZ)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -340,7 +337,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size TSRMLS_CC); /* use chunk size */ bufp = (ub1 *) ecalloc(1, buffer_size); - PHP_OCI_CALL_RETURN(OCILOBREAD2, connection->errcode, OCILobRead2, + PHP_OCI_CALL_RETURN(connection->errcode, OCILobRead2, ( connection->svc, connection->err, @@ -373,7 +370,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size TSRMLS_CC); /* use chunk size */ bufp = (ub1 *) ecalloc(1, buffer_size); - PHP_OCI_CALL_RETURN(OCILOBREAD, connection->errcode, OCILobRead, + PHP_OCI_CALL_RETURN(connection->errcode, OCILobRead, ( connection->svc, connection->err, @@ -408,7 +405,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini descriptor->lob_current_position = (int)offset; if (descriptor->type == OCI_DTYPE_FILE) { - PHP_OCI_CALL_RETURN(OCILOBFILECLOSE, connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -423,8 +420,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_lob_write() Write data to the LOB */ @@ -451,7 +447,7 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i offset = descriptor->lob_current_position; } - PHP_OCI_CALL_RETURN(OCILOBWRITE, connection->errcode, OCILobWrite, + PHP_OCI_CALL_RETURN(connection->errcode, OCILobWrite, ( connection->svc, connection->err, @@ -487,8 +483,7 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_lob_set_buffering() Turn buffering off/onn for this particular LOB */ @@ -507,9 +502,9 @@ int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off TSRMLS } if (on_off) { - PHP_OCI_CALL_RETURN(OCILOBENABLEBUFFERING, connection->errcode, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor)); } else { - PHP_OCI_CALL_RETURN(OCILOBDISABLEBUFFERING, connection->errcode, OCILobDisableBuffering, (connection->svc, connection->err, descriptor->descriptor)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobDisableBuffering, (connection->svc, connection->err, descriptor->descriptor)); } if (connection->errcode != OCI_SUCCESS) { @@ -519,8 +514,7 @@ int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off TSRMLS } descriptor->buffering = on_off ? PHP_OCI_LOB_BUFFER_ENABLED : PHP_OCI_LOB_BUFFER_DISABLED; return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_lob_get_buffering() Return current buffering state for the LOB */ @@ -531,8 +525,7 @@ int php_oci_lob_get_buffering (php_oci_descriptor *descriptor) } else { return 0; } -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_lob_copy() Copy one LOB (or its part) to another one */ @@ -560,7 +553,7 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d return 1; } - PHP_OCI_CALL_RETURN(OCILOBCOPY, connection->errcode, OCILobCopy, + PHP_OCI_CALL_RETURN(connection->errcode, OCILobCopy, ( connection->svc, connection->err, @@ -579,8 +572,7 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_lob_close() Close LOB */ @@ -589,7 +581,7 @@ int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC) php_oci_connection *connection = descriptor->connection; if (descriptor->is_open) { - PHP_OCI_CALL_RETURN(OCILOBCLOSE, connection->errcode, OCILobClose, (connection->svc, connection->err, descriptor->descriptor)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobClose, (connection->svc, connection->err, descriptor->descriptor)); } if (connection->errcode != OCI_SUCCESS) { @@ -603,8 +595,7 @@ int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC) } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_temp_lob_close() Close Temporary LOB */ @@ -613,7 +604,7 @@ int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC) php_oci_connection *connection = descriptor->connection; int is_temporary; - PHP_OCI_CALL_RETURN(OCILOBISTEMPORARY, connection->errcode, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -622,7 +613,7 @@ int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC) } if (is_temporary) { - PHP_OCI_CALL_RETURN(OCILOBFREETEMPORARY, connection->errcode, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -631,8 +622,8 @@ int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC) } } return 0; -} -/* }}} */ +} /* }}} */ + /* {{{ php_oci_lob_flush() Flush buffers for the LOB (only if they have been used) */ @@ -663,7 +654,7 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC) return 0; } - PHP_OCI_CALL_RETURN(OCILOBFLUSHBUFFER, connection->errcode, OCILobFlushBuffer, (connection->svc, connection->err, lob, flush_flag)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobFlushBuffer, (connection->svc, connection->err, lob, flush_flag)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -674,8 +665,7 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC) /* marking buffer as enabled and not used */ descriptor->buffering = PHP_OCI_LOB_BUFFER_ENABLED; return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_lob_free() Close LOB descriptor and free associated resources */ @@ -717,12 +707,11 @@ void php_oci_lob_free (php_oci_descriptor *descriptor TSRMLS_DC) php_oci_temp_lob_close(descriptor TSRMLS_CC); } - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (descriptor->descriptor, descriptor->type)); + PHP_OCI_CALL(OCIDescriptorFree, (descriptor->descriptor, descriptor->type)); - zend_list_delete(descriptor->connection->id); + zend_list_delete(descriptor->connection->rsrc_id); efree(descriptor); -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_lob_import() Import LOB contents from the given file */ @@ -750,7 +739,7 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC } while ((loblen = read(fp, &buf, sizeof(buf))) > 0) { - PHP_OCI_CALL_RETURN(OCILOBWRITE, connection->errcode, + PHP_OCI_CALL_RETURN(connection->errcode, OCILobWrite, ( connection->svc, @@ -779,8 +768,7 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC close(fp); return 0; -} - /* }}} */ +} /* }}} */ /* {{{ php_oci_lob_append() Append data to the end of the LOB */ @@ -803,7 +791,7 @@ int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor return 0; } - PHP_OCI_CALL_RETURN(OCILOBAPPEND, connection->errcode, OCILobAppend, (connection->svc, connection->err, lob_dest, lob_from)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobAppend, (connection->svc, connection->err, lob_dest, lob_from)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -811,8 +799,7 @@ int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor return 1; } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_lob_truncate() Truncate LOB to the given length */ @@ -840,7 +827,7 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TS return 1; } - PHP_OCI_CALL_RETURN(OCILOBTRIM, connection->errcode, OCILobTrim, (connection->svc, connection->err, lob, new_lob_length)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobTrim, (connection->svc, connection->err, lob, new_lob_length)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -850,8 +837,7 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TS descriptor->lob_size = new_lob_length; return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_lob_erase() Erase (or fill with whitespaces, depending on LOB type) the LOB (or its part) */ @@ -875,7 +861,7 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, ub4 length, length = lob_length; } - PHP_OCI_CALL_RETURN(OCILOBERASE, connection->errcode, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, offset+1)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, offset+1)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -885,8 +871,7 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, ub4 length, *bytes_erased = length; return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_lob_is_equal() Compare two LOB descriptors and figure out if they are pointing to the same LOB */ @@ -896,7 +881,7 @@ int php_oci_lob_is_equal (php_oci_descriptor *descriptor_first, php_oci_descript OCILobLocator *first_lob = descriptor_first->descriptor; OCILobLocator *second_lob = descriptor_second->descriptor; - PHP_OCI_CALL_RETURN(OCILOBISEQUAL, connection->errcode, OCILobIsEqual, (connection->env, first_lob, second_lob, result)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsEqual, (connection->env, first_lob, second_lob, result)); if (connection->errcode) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -904,8 +889,7 @@ int php_oci_lob_is_equal (php_oci_descriptor *descriptor_first, php_oci_descript return 1; } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_lob_write_tmp() Create temporary LOB and write data to it */ @@ -930,7 +914,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data return 1; } - PHP_OCI_CALL_RETURN(OCILOBCREATETEMPORARY, connection->errcode, OCILobCreateTemporary, + PHP_OCI_CALL_RETURN(connection->errcode, OCILobCreateTemporary, ( connection->svc, connection->err, @@ -949,7 +933,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data return 1; } - PHP_OCI_CALL_RETURN(OCILOBOPEN, connection->errcode, OCILobOpen, (connection->svc, connection->err, lob, OCI_LOB_READWRITE)); + PHP_OCI_CALL_RETURN(connection->errcode, OCILobOpen, (connection->svc, connection->err, lob, OCI_LOB_READWRITE)); if (connection->errcode) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); @@ -960,8 +944,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data descriptor->is_open = 1; return php_oci_lob_write(descriptor, 0, data, data_len, &bytes_written TSRMLS_CC); -} -/* }}} */ +} /* }}} */ #endif /* HAVE_OCI8 */ diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index 561abab675027..89facb0703431 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -43,7 +43,7 @@ /* {{{ php_oci_statement_create() Create statemend handle and allocate necessary resources */ -php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, int query_len TSRMLS_DC) +php_oci_statement *php_oci_statement_create (php_oci_connection *connection, char *query, int query_len TSRMLS_DC) { php_oci_statement *statement; @@ -51,19 +51,13 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char if (!query_len) { /* do not allocate stmt handle for refcursors, we'll get it from OCIStmtPrepare2() */ - PHP_OCI_CALL(OCIHANDLEALLOC, OCIHandleAlloc, (connection->env, (dvoid **)&(statement->stmt), OCI_HTYPE_STMT, 0, NULL)); - } else { -#ifdef HAVE_DTRACE - if (DTRACE_OCI8_SQLTEXT_ENABLED()) { - DTRACE_OCI8_SQLTEXT(query); - } -#endif /* HAVE_DTRACE */ + PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->stmt), OCI_HTYPE_STMT, 0, NULL)); } - PHP_OCI_CALL(OCIHANDLEALLOC, OCIHandleAlloc, (connection->env, (dvoid **)&(statement->err), OCI_HTYPE_ERROR, 0, NULL)); + PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->err), OCI_HTYPE_ERROR, 0, NULL)); if (query_len > 0) { - PHP_OCI_CALL_RETURN(OCISTMTPREPARE2, connection->errcode, OCIStmtPrepare2, + PHP_OCI_CALL_RETURN(connection->errcode, OCIStmtPrepare2, ( connection->svc, &(statement->stmt), @@ -79,8 +73,8 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_CALL(OCISTMTRELEASE, OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT)); - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree,(statement->err, OCI_HTYPE_ERROR)); + PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT)); + PHP_OCI_CALL(OCIHandleFree,(statement->err, OCI_HTYPE_ERROR)); efree(statement); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); @@ -101,15 +95,10 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char statement->has_data = 0; statement->has_descr = 0; statement->parent_stmtid = 0; - statement->impres_child_stmt = NULL; - statement->impres_count = 0; - statement->impres_flag = PHP_OCI_IMPRES_UNKNOWN; /* may or may not have Implicit Result Set children */ - zend_list_addref(statement->connection->id); + zend_list_addref(statement->connection->rsrc_id); if (OCI_G(default_prefetch) >= 0) { - php_oci_statement_set_prefetch(statement, (ub4)OCI_G(default_prefetch) TSRMLS_CC); - } else { - php_oci_statement_set_prefetch(statement, (ub4)100 TSRMLS_CC); /* semi-arbitrary, "sensible default" */ + php_oci_statement_set_prefetch(statement, OCI_G(default_prefetch) TSRMLS_CC); } PHP_OCI_REGISTER_RESOURCE(statement, le_statement); @@ -120,81 +109,25 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char } /* }}} */ -/* {{{ php_oci_get_implicit_resultset() - Fetch implicit result set statement resource */ -php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement TSRMLS_DC) +/* {{{ php_oci_statement_set_prefetch() + Set prefetch buffer size for the statement (we're assuming that one row is ~1K sized) */ +int php_oci_statement_set_prefetch(php_oci_statement *statement, long size TSRMLS_DC) { - void *result; - ub4 rtype; - php_oci_statement *statement2; /* implicit result set statement handle */ + ub4 prefetch = size; -#if (OCI_MAJOR_VERSION < 12) - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Implicit results are available in Oracle Database 12c onwards"); - return NULL; -#else - PHP_OCI_CALL_RETURN(OCISTMTGETNEXTRESULT, statement->errcode, OCIStmtGetNextResult, (statement->stmt, statement->err, &result, &rtype, OCI_DEFAULT)); - if (statement->errcode == OCI_NO_DATA) { - return NULL; + if (size < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of rows to be prefetched has to be greater than or equal to 0"); + return 1; } - - if (rtype != OCI_RESULT_TYPE_SELECT) { - /* Only OCI_RESULT_TYPE_SELECT is supported by Oracle DB 12cR1 */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unexpected implicit result type returned from Oracle Database"); - return NULL; - } else { - statement2 = ecalloc(1,sizeof(php_oci_statement)); - - PHP_OCI_CALL(OCIHANDLEALLOC, OCIHandleAlloc, (statement->connection->env, (dvoid **)&(statement2->err), OCI_HTYPE_ERROR, 0, NULL)); - statement2->stmt = (OCIStmt *)result; - statement2->parent_stmtid = statement->id; - statement2->impres_child_stmt = NULL; - statement2->impres_count = 0; - statement2->impres_flag = PHP_OCI_IMPRES_IS_CHILD; - statement2->connection = statement->connection; - statement2->errcode = 0; - statement2->last_query = NULL; - statement2->last_query_len = 0; - statement2->columns = NULL; - statement2->binds = NULL; - statement2->defines = NULL; - statement2->ncolumns = 0; - statement2->executed = 0; - statement2->has_data = 0; - statement2->has_descr = 0; - statement2->stmttype = 0; - - zend_list_addref(statement->id); - zend_list_addref(statement2->connection->id); - - php_oci_statement_set_prefetch(statement2, statement->prefetch_count TSRMLS_CC); - - PHP_OCI_REGISTER_RESOURCE(statement2, le_statement); - OCI_G(num_statements)++; - - return statement2; - } -#endif /* OCI_MAJOR_VERSION < 12 */ -} -/* }}} */ - -/* {{{ php_oci_statement_set_prefetch() - Set prefetch buffer size for the statement */ -int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 prefetch TSRMLS_DC) -{ - if (prefetch > 20000) { - prefetch = 20000; /* keep it somewhat sane */ - } - - PHP_OCI_CALL_RETURN(OCIATTRSET, statement->errcode, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, statement->err)); + PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, statement->err)); if (statement->errcode != OCI_SUCCESS) { statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - statement->prefetch_count = 0; return 1; } - statement->prefetch_count = prefetch; + return 0; } /* }}} */ @@ -230,8 +163,8 @@ int php_oci_cleanup_pre_fetch(void *data TSRMLS_DC) } return ZEND_HASH_APPLY_KEEP; -} -/* }}} */ +} /* }}} */ + /* {{{ php_oci_statement_fetch() Fetch a row from the statement */ @@ -249,7 +182,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) zend_hash_apply(statement->columns, (apply_func_t) php_oci_cleanup_pre_fetch TSRMLS_CC); } - PHP_OCI_CALL_RETURN(OCISTMTFETCH, statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT)); + PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT)); if ( statement->errcode == OCI_NO_DATA || nrows == 0 ) { if (statement->last_query == NULL) { @@ -276,7 +209,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) /* reset length for all piecewise columns */ for (i = 0; i < statement->ncolumns; i++) { column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC); - if (column && column->piecewise) { + if (column->piecewise) { column->retlen4 = 0; piecewisecols = 1; } @@ -284,7 +217,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) while (statement->errcode == OCI_NEED_DATA) { if (piecewisecols) { - PHP_OCI_CALL_RETURN(OCISTMTGETPIECEINFO,statement->errcode, + PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtGetPieceInfo, ( statement->stmt, @@ -301,7 +234,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) /* scan through our columns for a piecewise column with a matching handle */ for (i = 0; i < statement->ncolumns; i++) { column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC); - if (column && column->piecewise && handlepp == column->oci_define) { + if (column->piecewise && handlepp == column->oci_define) { if (!column->data) { column->data = (text *) ecalloc(1, PHP_OCI_PIECE_SIZE + 1); } else { @@ -310,7 +243,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) column->cb_retlen = PHP_OCI_PIECE_SIZE; /* and instruct fetch to fetch waiting piece into our buffer */ - PHP_OCI_CALL(OCISTMTSETPIECEINFO, OCIStmtSetPieceInfo, + PHP_OCI_CALL(OCIStmtSetPieceInfo, ( (void *) column->oci_define, OCI_HTYPE_DEFINE, @@ -326,7 +259,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) } } - PHP_OCI_CALL_RETURN(OCISTMTFETCH, statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT)); + PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT)); if (piecewisecols) { for (i = 0; i < statement->ncolumns; i++) { @@ -399,7 +332,7 @@ php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, l } /* }}} */ -/* {{{ php_oci_define_callback() */ +/* php_oci_define_callback() {{{ */ sb4 php_oci_define_callback(dvoid *ctx, OCIDefine *define, ub4 iter, dvoid **bufpp, ub4 **alenpp, ub1 *piecep, dvoid **indpp, ub2 **rcpp) { php_oci_out_column *outcol = (php_oci_out_column *)ctx; @@ -488,11 +421,6 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) case OCI_DESCRIBE_ONLY: case OCI_DEFAULT: /* only these are allowed */ -#ifdef HAVE_DTRACE - if (DTRACE_OCI8_EXECUTE_MODE_ENABLED()) { - DTRACE_OCI8_EXECUTE_MODE(mode); - } -#endif /* HAVE_DTRACE */ break; default: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid execute mode given: %d", mode); @@ -502,7 +430,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) if (!statement->stmttype) { /* get statement type */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err)); + PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err)); if (statement->errcode != OCI_SUCCESS) { statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); @@ -517,7 +445,9 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) iters = 1; } - if (statement->last_query) { /* Don't execute REFCURSORS or Implicit Result Set handles */ + if (statement->last_query) { + /* if we execute refcursors we don't have a query and + we don't want to execute!!! */ if (statement->binds) { int result = 0; @@ -528,7 +458,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) } /* execute statement */ - PHP_OCI_CALL_RETURN(OCISTMTEXECUTE, statement->errcode, OCIStmtExecute, (statement->connection->svc, statement->stmt, statement->err, iters, 0, NULL, NULL, mode)); + PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtExecute, (statement->connection->svc, statement->stmt, statement->err, iters, 0, NULL, NULL, mode)); if (statement->errcode != OCI_SUCCESS) { statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); @@ -541,18 +471,10 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) } if (mode & OCI_COMMIT_ON_SUCCESS) { - /* No need to rollback on disconnect */ - statement->connection->rb_on_disconnect = 0; - } else if (statement->stmttype != OCI_STMT_SELECT) { - /* Assume some uncommitted DML occurred */ - statement->connection->rb_on_disconnect = 1; + statement->connection->needs_commit = 0; + } else { + statement->connection->needs_commit = 1; } - /* else for SELECT with OCI_NO_AUTO_COMMIT, leave - * "rb_on_disconnect" at its previous value. SELECT can't - * initiate uncommitted DML. (An AUTONOMOUS_TRANSACTION in - * invoked PL/SQL must explicitly rollback/commit else the - * SELECT fails). - */ } if (statement->stmttype == OCI_STMT_SELECT && statement->executed == 0) { @@ -565,7 +487,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) counter = 1; /* get number of columns */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_ATTR_PARAM_COUNT, statement->err)); + PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_ATTR_PARAM_COUNT, statement->err)); if (statement->errcode != OCI_SUCCESS) { statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); @@ -585,7 +507,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) } /* get column */ - PHP_OCI_CALL_RETURN(OCIPARAMGET, statement->errcode, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)¶m, counter)); + PHP_OCI_CALL_RETURN(statement->errcode, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)¶m, counter)); if (statement->errcode != OCI_SUCCESS) { statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); @@ -594,40 +516,40 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) } /* get column datatype */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_type, (ub4 *)0, OCI_ATTR_DATA_TYPE, statement->err)); + PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_type, (ub4 *)0, OCI_ATTR_DATA_TYPE, statement->err)); if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); + PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get character set form */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_form, (ub4 *)0, OCI_ATTR_CHARSET_FORM, statement->err)); + PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_form, (ub4 *)0, OCI_ATTR_CHARSET_FORM, statement->err)); if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); + PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get character set id */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err)); + PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err)); if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); + PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get size of the column */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err)); + PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err)); if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); + PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; @@ -637,39 +559,39 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) outcol->retlen = outcol->data_size; /* get scale of the column */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err)); + PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err)); if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); + PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get precision of the column */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err)); + PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err)); if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); + PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get name of the column */ - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err)); + PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err)); if (statement->errcode != OCI_SUCCESS) { - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); + PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } - PHP_OCI_CALL(OCIDESCRIPTORFREE, OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); + PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); outcol->name = estrndup((char*) colname, outcol->name_len); - /* find a user-set define */ + /* find a user-setted define */ if (statement->defines) { if (zend_hash_find(statement->defines,outcol->name,outcol->name_len,(void **) &outcol->define) == SUCCESS) { if (outcol->define->type) { @@ -757,7 +679,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) } if (dynamic == OCI_DYNAMIC_FETCH) { - PHP_OCI_CALL_RETURN(OCIDEFINEBYPOS, statement->errcode, + PHP_OCI_CALL_RETURN(statement->errcode, OCIDefineByPos, ( statement->stmt, /* IN/OUT handle to the requested SQL query */ @@ -775,7 +697,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) ); } else { - PHP_OCI_CALL_RETURN(OCIDEFINEBYPOS, statement->errcode, + PHP_OCI_CALL_RETURN(statement->errcode, OCIDefineByPos, ( statement->stmt, /* IN/OUT handle to the requested SQL query */ @@ -807,7 +729,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) case SQLT_BLOB: case SQLT_CLOB: case SQLT_BFILE: - PHP_OCI_CALL_RETURN(OCIDEFINEDYNAMIC, statement->errcode, + PHP_OCI_CALL_RETURN(statement->errcode, OCIDefineDynamic, ( outcol->oci_define, @@ -830,9 +752,10 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) Cancel statement */ int php_oci_statement_cancel(php_oci_statement *statement TSRMLS_DC) { + return php_oci_statement_fetch(statement, 0 TSRMLS_CC); -} -/* }}} */ + +} /* }}} */ /* {{{ php_oci_statement_free() Destroy statement handle and free associated resources */ @@ -840,16 +763,16 @@ void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC) { if (statement->stmt) { if (statement->last_query_len) { /* FIXME: magical */ - PHP_OCI_CALL(OCISTMTRELEASE, OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT)); - } else if (statement->impres_flag != PHP_OCI_IMPRES_IS_CHILD) { /* Oracle doc says don't free Implicit Result Set handles */ - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT)); + PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT)); + } else { + PHP_OCI_CALL(OCIHandleFree, (statement->stmt, OCI_HTYPE_STMT)); } - statement->stmt = NULL; + statement->stmt = 0; } if (statement->err) { - PHP_OCI_CALL(OCIHANDLEFREE, OCIHandleFree, (statement->err, OCI_HTYPE_ERROR)); - statement->err = NULL; + PHP_OCI_CALL(OCIHandleFree, (statement->err, OCI_HTYPE_ERROR)); + statement->err = 0; } if (statement->last_query) { @@ -875,12 +798,11 @@ void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC) zend_list_delete(statement->parent_stmtid); } - zend_list_delete(statement->connection->id); + zend_list_delete(statement->connection->rsrc_id); efree(statement); OCI_G(num_statements)--; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_bind_pre_exec() Helper function */ @@ -1009,7 +931,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) memset((void*)buff,0,sizeof(buff)); if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { - PHP_OCI_CALL_RETURN(OCIDATETOTEXT, connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff)); + PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff)); zval_dtor(*entry); if (connection->errcode != OCI_SUCCESS) { @@ -1021,7 +943,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) } zend_hash_move_forward(hash); } else { - PHP_OCI_CALL_RETURN(OCIDATETOTEXT, connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff)); + PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff)); if (connection->errcode != OCI_SUCCESS) { connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); @@ -1060,7 +982,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) /* {{{ php_oci_bind_by_name() Bind zval to the given placeholder */ -int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long maxlength, ub2 type TSRMLS_DC) +int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, long maxlength, ub2 type TSRMLS_DC) { php_oci_collection *bind_collection = NULL; php_oci_descriptor *bind_descriptor = NULL; @@ -1195,7 +1117,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, bindp->type = type; zval_add_ref(&var); - PHP_OCI_CALL_RETURN(OCIBINDBYNAME, statement->errcode, + PHP_OCI_CALL_RETURN(statement->errcode, OCIBindByName, ( statement->stmt, /* statement handle */ @@ -1222,7 +1144,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, } if (mode == OCI_DATA_AT_EXEC) { - PHP_OCI_CALL_RETURN(OCIBINDDYNAMIC, statement->errcode, OCIBindDynamic, + PHP_OCI_CALL_RETURN(statement->errcode, OCIBindDynamic, ( bindp->bind, statement->err, @@ -1242,7 +1164,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, if (type == SQLT_NTY) { /* Bind object */ - PHP_OCI_CALL_RETURN(OCIBINDOBJECT, statement->errcode, OCIBindObject, + PHP_OCI_CALL_RETURN(statement->errcode, OCIBindObject, ( bindp->bind, statement->err, @@ -1262,8 +1184,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, } return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_bind_in_callback() Callback used when binding LOBs and VARCHARs */ @@ -1314,8 +1235,7 @@ sb4 php_oci_bind_in_callback( *piecep = OCI_ONE_PIECE; /* pass all data in one go */ return OCI_CONTINUE; -} -/* }}} */ +}/* }}} */ /* {{{ php_oci_bind_out_callback() Callback used when binding LOBs and VARCHARs */ @@ -1438,8 +1358,7 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME zval_dtor(&tmp); } return column; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_statement_get_type() Return type of the statement */ @@ -1449,7 +1368,7 @@ int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC *type = 0; - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err)); + PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err)); if (statement->errcode != OCI_SUCCESS) { statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); @@ -1460,8 +1379,7 @@ int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC *type = statement_type; return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_statement_get_numrows() Get the number of rows fetched to the clientside (NOT the number of rows in the result set) */ @@ -1471,7 +1389,7 @@ int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSR *numrows = 0; - PHP_OCI_CALL_RETURN(OCIATTRGET, statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, OCI_ATTR_ROW_COUNT, statement->err)); + PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, OCI_ATTR_ROW_COUNT, statement->err)); if (statement->errcode != OCI_SUCCESS) { statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); @@ -1482,12 +1400,11 @@ int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSR *numrows = statement_numrows; return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_bind_array_by_name() Bind arrays to PL/SQL types */ -int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long max_table_length, long maxlength, long type TSRMLS_DC) +int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, long max_table_length, long maxlength, long type TSRMLS_DC) { php_oci_bind *bind, *bindp; @@ -1553,7 +1470,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam zval_add_ref(&var); - PHP_OCI_CALL_RETURN(OCIBINDBYNAME, statement->errcode, + PHP_OCI_CALL_RETURN(statement->errcode, OCIBindByName, ( statement->stmt, @@ -1582,12 +1499,11 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam } efree(bind); return 0; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_bind_array_helper_string() Bind arrays to PL/SQL types */ -php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, long maxlength TSRMLS_DC) +php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length, long maxlength TSRMLS_DC) { php_oci_bind *bind; ub4 i; @@ -1652,12 +1568,11 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, zend_hash_internal_pointer_reset(hash); return bind; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_bind_array_helper_number() Bind arrays to PL/SQL types */ -php_oci_bind *php_oci_bind_array_helper_number(zval *var, long max_table_length TSRMLS_DC) +php_oci_bind *php_oci_bind_array_helper_number(zval* var, long max_table_length TSRMLS_DC) { php_oci_bind *bind; ub4 i; @@ -1691,12 +1606,11 @@ php_oci_bind *php_oci_bind_array_helper_number(zval *var, long max_table_length zend_hash_internal_pointer_reset(hash); return bind; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_bind_array_helper_double() Bind arrays to PL/SQL types */ -php_oci_bind *php_oci_bind_array_helper_double(zval *var, long max_table_length TSRMLS_DC) +php_oci_bind *php_oci_bind_array_helper_double(zval* var, long max_table_length TSRMLS_DC) { php_oci_bind *bind; ub4 i; @@ -1730,12 +1644,11 @@ php_oci_bind *php_oci_bind_array_helper_double(zval *var, long max_table_length zend_hash_internal_pointer_reset(hash); return bind; -} -/* }}} */ +} /* }}} */ /* {{{ php_oci_bind_array_helper_date() Bind arrays to PL/SQL types */ -php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, php_oci_connection *connection TSRMLS_DC) +php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, php_oci_connection *connection TSRMLS_DC) { php_oci_bind *bind; ub4 i; @@ -1762,7 +1675,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, p if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { convert_to_string_ex(entry); - PHP_OCI_CALL_RETURN(OCIDATEFROMTEXT, connection->errcode, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date)); if (connection->errcode != OCI_SUCCESS) { /* failed to convert string to date */ @@ -1777,7 +1690,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, p ((OCIDate *)bind->array.elements)[i] = oci_date; zend_hash_move_forward(hash); } else { - PHP_OCI_CALL_RETURN(OCIDATEFROMTEXT, connection->errcode, OCIDateFromText, (connection->err, (CONST text *)"01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)"01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0, NULL, 0, &oci_date)); if (connection->errcode != OCI_SUCCESS) { /* failed to convert string to date */ @@ -1795,8 +1708,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, p zend_hash_internal_pointer_reset(hash); return bind; -} -/* }}} */ +} /* }}} */ #endif /* HAVE_OCI8 */ diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml index 4dc78d4983774..c51d216f325ae 100644 --- a/ext/oci8/package.xml +++ b/ext/oci8/package.xml @@ -6,14 +6,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> oci8 pecl.php.net Extension for Oracle Database - - - This extension allows you to access Oracle Database. OCI8 2.0 can - be built with PHP 4.3.9 onwards. OCI8 can be linked with Oracle - Database 9.2, 10, 11, or 12.1 client libraries. Oracle's standard - cross-version connectivity applies. For example PHP linked with - Oracle Database 11.2 client libraries can connect to Oracle - Database 9.2 onwards. + This extension allows you to access Oracle databases. It can be built with PHP 4.3.9 to 5.x. It can be linked with Oracle 9.2, 10.2, 11.1, or 11.2 client libraries. Christopher Jones @@ -25,7 +18,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> Antony Dovgal tony2001 tony2001@php.net - no + yes Wez Furlong @@ -40,22 +33,21 @@ http://pear.php.net/dtd/package-2.0.xsd"> no - 2013-07-24 + 2012-10-21 - - 2.0.1 - 2.0.1 - - - devel - devel - - PHP - - Fixed --enable-maintainer-zts mode - Allow Implicit Result Set statement resources to inherit the parent's current prefetch count - + + 1.4.9 + 1.4.9 + + + stable + stable + + PHP + + Re-fixed bug #60901 (Improve "tail" syntax for AIX installation) + @@ -102,7 +94,6 @@ http://pear.php.net/dtd/package-2.0.xsd"> - @@ -296,38 +287,6 @@ http://pear.php.net/dtd/package-2.0.xsd"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -376,7 +335,6 @@ http://pear.php.net/dtd/package-2.0.xsd"> - @@ -425,14 +383,13 @@ http://pear.php.net/dtd/package-2.0.xsd"> - + - @@ -440,7 +397,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> 4.3.9 - 6.0.0 + 5.4.99 1.4.0b1 @@ -453,114 +410,6 @@ http://pear.php.net/dtd/package-2.0.xsd"> - - - - 2.0.0 - 2.0.0 - - - devel - devel - - PHP - - - NEW FUNCTIONALITY: - - - Added Implicit Result Set support for Oracle Database 12c. - Streaming of all IRS's returned from a PL/SQL block is available - via oci_fetch_array, oci_fetch_assoc, oci_fetch_object and - oci_fetch_row (but not oci_fetch or oci_fetch_all). - Alternatively individual IRS statement resources can be obtained - with the new function 'oci_get_implicit_resultset' and passed to - any oci_fetch_* function. - - - Added DTrace probes enabled with PHP's generic --enable-dtrace - - - IMPROVED FUNCTIONALITY: - - - Using 'oci_execute($s, OCI_NO_AUTO_COMMIT)' for a SELECT no - longer unnecessarily initiates an internal ROLLBACK during - connection close. This can improve overall scalability by - reducing "round trips" between PHP and the database. - - - CHANGED FUNCTIONALITY: - - - PHPINFO() CHANGES: - - - The oci8.event and oci8.connection_class values are now shown - only when the Oracle client libraries support the respective - functionality. - - - Connection statistics are now in a separate phpinfo() table. - - - Temporary LOB and Collection support status lines in - phpinfo() were removed. These features have always been - enabled since 2007. - - - OCI_INTERNAL_DEBUG() CHANGES: - - - The oci_internal_debug() function is now a no-op. Use PHP's - --enable-dtrace functionality with DTrace or SystemTap instead. - - - INTERNAL CHANGES: - - - Fixed a potential NULL pointer dereference flagged by Parfait - static code analysis. - - - Extended testing of existing OCI8 functionality. - - - Improved test output portability when using the PHP development - web server to run tests. - - - Removed no-longer necessary Unicode patterns from tests - (vestiges of PHP's previous PHP 6 project) - - - Improved build portability by removing compilation type cast - warnings with some compilers. - - - Fixed compilation warnings when building with Oracle 9.2 - client libraries. - - - Updated code to use internal macro PHP_OCI_REGISTER_RESOURCE. - - - Regularized code prototypes and fixed some in-line documentation - prototypes. - - - Fixed code folding. - - - - - - 1.4.10 - 1.4.10 - - - stable - stable - - PHP - - Bump PECL package info version check to allow PECL installs with PHP 5.5+ - - - - - - 1.4.9 - 1.4.9 - - - stable - stable - - PHP - - Re-fixed bug #60901 (Improve "tail" syntax for AIX installation) - - - 1.4.8 @@ -593,7 +442,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> Fixed OCI8 part of bug #55748 (CVE-2011-4153: multiple NULL pointer dereferences with zend_strndup) Fixed OCI8 part of bug #55301 (multiple null pointer dereferences with calloc) Increased maximum Oracle error message buffer length for new Oracle 11.2.0.3 size - Improve internal initialization failure error messages + Improve internal initalization failure error messages @@ -608,7 +457,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> PHP - Added oci_client_version() returning the run time Oracle client library version + Added oci_client_version() returning the runtime Oracle client library version Made OCI8 extension buildable with PHP 5.4-development code @@ -982,7 +831,7 @@ Fixed bug #36820 (Privileged connection with an Oracle password file fails) 2006-03-16 PHP Changed OCI8 code to use OCIServerVersion() instead of OCIPing(), which may crash Oracle server of version < 10.2 -Fixed bug #36235 (ocicolumnname returns false before a successful fetch) +Fixed bug #36235 (ocicolumnname returns false before a successfull fetch) Fixed bug #36096 (oci_result() returns garbage after oci_fetch() failed) Fixed bug #36055 (possible OCI8 crash in multithreaded environment) Fixed bug #36010 (Segfault when re-creating and re-executing statements with bound parameters) diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h index f10f01db52d42..6632bc88ffc3b 100644 --- a/ext/oci8/php_oci8.h +++ b/ext/oci8/php_oci8.h @@ -46,7 +46,7 @@ */ #undef PHP_OCI8_VERSION #endif -#define PHP_OCI8_VERSION "2.0.1-dev" +#define PHP_OCI8_VERSION "1.4.9" extern zend_module_entry oci8_module_entry; #define phpext_oci8_ptr &oci8_module_entry diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h index d1aa1ae70c6eb..155e57d2cd1a0 100644 --- a/ext/oci8/php_oci8_int.h +++ b/ext/oci8/php_oci8_int.h @@ -31,7 +31,7 @@ # ifndef PHP_OCI8_INT_H # define PHP_OCI8_INT_H -/* {{{ misc defines */ +/* misc defines {{{ */ # if (defined(__osf__) && defined(__alpha)) # ifndef A_OSF # define A_OSF @@ -44,10 +44,6 @@ # endif # endif /* osf alpha */ -#ifdef HAVE_DTRACE -#include "oci8_dtrace_gen.h" -#endif - #if defined(min) #undef min #endif @@ -70,7 +66,7 @@ extern int le_session; extern zend_class_entry *oci_lob_class_entry_ptr; extern zend_class_entry *oci_coll_class_entry_ptr; -/* {{{ constants */ +/* constants {{{ */ #define PHP_OCI_SEEK_SET 0 #define PHP_OCI_SEEK_CUR 1 #define PHP_OCI_SEEK_END 2 @@ -105,11 +101,6 @@ extern zend_class_entry *oci_coll_class_entry_ptr; #error Invalid value for PHP_OCI_CRED_EXT #endif -#define PHP_OCI_IMPRES_UNKNOWN 0 -#define PHP_OCI_IMPRES_NO_CHILDREN 1 -#define PHP_OCI_IMPRES_HAS_CHILDREN 2 -#define PHP_OCI_IMPRES_IS_CHILD 3 - /* * Name passed to Oracle for tracing. Note some DB views only show * the first nine characters of the driver name. @@ -118,21 +109,16 @@ extern zend_class_entry *oci_coll_class_entry_ptr; /* }}} */ -/* {{{ php_oci_spool */ -typedef struct { - int id; /* resource id */ - OCIEnv *env; /* env of this session pool */ +typedef struct { /* php_oci_spool {{{ */ + OCIEnv *env; /*env of this session pool */ OCIError *err; /* pool's error handle */ OCISPool *poolh; /* pool handle */ void *poolname; /* session pool name */ unsigned int poolname_len; /* length of session pool name */ char *spool_hash_key; /* Hash key for session pool in plist */ -} php_oci_spool; -/* }}} */ +} php_oci_spool; /* }}} */ -/* {{{ php_oci_connection */ -typedef struct { - int id; /* resource ID */ +typedef struct { /* php_oci_connection {{{ */ OCIEnv *env; /* private env handle */ ub2 charset; /* charset ID */ OCIServer *server; /* private server handle */ @@ -149,18 +135,17 @@ typedef struct { unsigned is_attached:1; /* hels to determine if we should detach from the server when closing/freeing the connection */ unsigned is_persistent:1; /* self-descriptive */ unsigned used_this_request:1; /* helps to determine if we should reset connection's next ping time and check its timeout */ - unsigned rb_on_disconnect:1; /* helps to determine if we should rollback this connection on close/shutdown */ + unsigned needs_commit:1; /* helps to determine if we should rollback this connection on close/shutdown */ unsigned passwd_changed:1; /* helps determine if a persistent connection hash should be invalidated after a password change */ unsigned is_stub:1; /* flag to keep track whether the connection structure has a real OCI connection associated */ unsigned using_spool:1; /* Is this connection from session pool? */ + int rsrc_id; /* resource ID */ time_t idle_expiry; /* time when the connection will be considered as expired */ time_t *next_pingp; /* (pointer to) time of the next ping */ char *hash_key; /* hashed details of the connection */ -} php_oci_connection; -/* }}} */ +} php_oci_connection; /* }}} */ -/* {{{ php_oci_descriptor */ -typedef struct { +typedef struct { /* php_oci_descriptor {{{ */ int id; ulong index; /* descriptors hash table index */ php_oci_connection *connection; /* parent connection handle */ @@ -173,19 +158,15 @@ typedef struct { ub1 charset_form; /* charset form, required for NCLOBs */ ub2 charset_id; /* charset ID */ unsigned is_open:1; /* helps to determine if lob is open or not */ -} php_oci_descriptor; -/* }}} */ +} php_oci_descriptor; /* }}} */ -/* {{{ php_oci_lob_ctx */ -typedef struct { +typedef struct { /* php_oci_lob_ctx {{{ */ char **lob_data; /* address of pointer to LOB data */ ub4 *lob_len; /* address of LOB length variable (bytes) */ ub4 alloc_len; -} php_oci_lob_ctx; -/* }}} */ +} php_oci_lob_ctx; /* }}} */ -/* {{{ php_oci_collection */ -typedef struct { +typedef struct { /* php_oci_collection {{{ */ int id; php_oci_connection *connection; /* parent connection handle */ OCIType *tdo; /* collection's type handle */ @@ -194,30 +175,23 @@ typedef struct { OCIType *element_type; /* element's type handle */ OCITypeCode element_typecode; /* element's typecode handle */ OCIColl *collection; /* collection handle */ -} php_oci_collection; -/* }}} */ +} php_oci_collection; /* }}} */ -/* {{{ php_oci_define */ -typedef struct { +typedef struct { /* php_oci_define {{{ */ zval *zval; /* zval used in define */ text *name; /* placeholder's name */ ub4 name_len; /* placeholder's name length */ ub4 type; /* define type */ -} php_oci_define; -/* }}} */ +} php_oci_define; /* }}} */ -/* {{{ php_oci_statement */ -typedef struct { +typedef struct { /* php_oci_statement {{{ */ int id; int parent_stmtid; /* parent statement id */ - struct php_oci_statement *impres_child_stmt;/* child of current Implicit Result Set statement handle */ - ub4 impres_count; /* count of remaining Implicit Result children on parent statement handle */ php_oci_connection *connection; /* parent connection handle */ sword errcode; /* last errcode*/ OCIError *err; /* private error handle */ OCIStmt *stmt; /* statement handle */ - char *last_query; /* last query issued. also used to determine if this is a statement or a refcursor recieved from Oracle */ - char impres_flag; /* PHP_OCI_IMPRES_*_ */ + char *last_query; /* last query issued. also used to determine if this is a statement or a refcursor received from Oracle */ long last_query_len; /* last query length */ HashTable *columns; /* hash containing all the result columns */ HashTable *binds; /* binds hash */ @@ -227,12 +201,9 @@ typedef struct { unsigned has_data:1; /* statement has more data flag */ unsigned has_descr:1; /* statement has at least one descriptor or cursor column */ ub2 stmttype; /* statement type */ - ub4 prefetch_count; /* current prefetch count */ -} php_oci_statement; -/* }}} */ +} php_oci_statement; /* }}} */ -/* {{{ php_oci_bind */ -typedef struct { +typedef struct { /* php_oci_bind {{{ */ OCIBind *bind; /* bind handle */ zval *zval; /* value */ dvoid *descriptor; /* used for binding of LOBS etc */ @@ -251,11 +222,9 @@ typedef struct { sb2 indicator; /* -1 means NULL */ ub2 retcode; ub4 dummy_len; /* a dummy var to store alenpp value in bind OUT callback */ -} php_oci_bind; -/* }}} */ +} php_oci_bind; /* }}} */ -/* {{{ php_oci_out_column */ -typedef struct { +typedef struct { /* php_oci_out_column {{{ */ php_oci_statement *statement; /* statement handle. used when fetching REFCURSORS */ php_oci_statement *nested_statement; /* statement handle. used when fetching REFCURSORS */ OCIDefine *oci_define; /* define handle */ @@ -280,54 +249,29 @@ typedef struct { sb2 precision; /* column precision */ ub1 charset_form; /* charset form, required for NCLOBs */ ub2 charset_id; /* charset ID */ -} php_oci_out_column; -/* }}} */ +} php_oci_out_column; /* }}} */ /* {{{ macros */ -#ifdef HAVE_DTRACE -#define PHP_OCI_CALL(func_uc, func, params) \ - do { \ - if (DTRACE_OCI8_ ## func_uc ## _START_ENABLED()) { \ - DTRACE_OCI8_ ## func_uc ## _START(); \ - } \ - OCI_G(in_call) = 1; \ - func params; \ - OCI_G(in_call) = 0; \ - if (DTRACE_OCI8_ ## func_uc ## _DONE_ENABLED()) { \ - DTRACE_OCI8_ ## func_uc ## _DONE(); \ - } \ - } while (0) -#else /* HAVE_DTRACE */ -#define PHP_OCI_CALL(func_uc, func, params) \ - do { \ - OCI_G(in_call) = 1; \ - func params; \ - OCI_G(in_call) = 0; \ - } while (0) -#endif /* HAVE_DTRACE */ - -#ifdef HAVE_DTRACE -#define PHP_OCI_CALL_RETURN(func_uc, __retval, func, params) \ - do { \ - if (DTRACE_OCI8_ ## func_uc ## _START_ENABLED()) { \ - DTRACE_OCI8_ ## func_uc ## _START(); \ - } \ - OCI_G(in_call) = 1; \ - __retval = func params; \ - OCI_G(in_call) = 0; \ - if (DTRACE_OCI8_ ## func_uc ## _DONE_ENABLED()) { \ - DTRACE_OCI8_ ## func_uc ## _DONE(); \ - } \ +#define PHP_OCI_CALL(func, params) \ + do { \ + if (OCI_G(debug_mode)) { \ + php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \ + } \ + OCI_G(in_call) = 1; \ + func params; \ + OCI_G(in_call) = 0; \ } while (0) -#else /* HAVE_DTRACE */ -#define PHP_OCI_CALL_RETURN(func_uc, __retval, func, params) \ - do { \ - OCI_G(in_call) = 1; \ - __retval = func params; \ - OCI_G(in_call) = 0; \ + +#define PHP_OCI_CALL_RETURN(__retval, func, params) \ + do { \ + if (OCI_G(debug_mode)) { \ + php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \ + } \ + OCI_G(in_call) = 1; \ + __retval = func params; \ + OCI_G(in_call) = 0; \ } while (0) -#endif /* HAVE_DTRACE */ /* Check for errors that indicate the connection to the DB is no * longer valid. If it isn't, then the PHP connection is marked to be @@ -370,7 +314,7 @@ typedef struct { default: \ { \ ub4 serverStatus = OCI_SERVER_NORMAL; \ - PHP_OCI_CALL(OCIATTRGET, OCIAttrGet, ((dvoid *)(connection)->server, OCI_HTYPE_SERVER, (dvoid *)&serverStatus, \ + PHP_OCI_CALL(OCIAttrGet, ((dvoid *)(connection)->server, OCI_HTYPE_SERVER, (dvoid *)&serverStatus, \ (ub4 *)0, OCI_ATTR_SERVER_STATUS, (connection)->err)); \ if (serverStatus != OCI_SERVER_NORMAL) { \ (connection)->is_open = 0; \ @@ -421,106 +365,112 @@ typedef struct { /* PROTOS */ -/* {{{ main prototypes */ +/* main prototypes {{{ */ + +void php_oci_column_hash_dtor (void *data); +void php_oci_define_hash_dtor (void *data); +void php_oci_bind_hash_dtor (void *data); +void php_oci_descriptor_flush_hash_dtor (void *data); -void php_oci_column_hash_dtor(void *data); -void php_oci_define_hash_dtor(void *data); -void php_oci_bind_hash_dtor(void *data); -void php_oci_descriptor_flush_hash_dtor(void *data); void php_oci_connection_descriptors_free(php_oci_connection *connection TSRMLS_DC); -sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC); -sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC); -int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, ub2 *error_offset TSRMLS_DC); -void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclusive); + +sb4 php_oci_error (OCIError *, sword TSRMLS_DC); +sb4 php_oci_fetch_errmsg(OCIError *, text ** TSRMLS_DC); +int php_oci_fetch_sqltext_offset(php_oci_statement *, text **, ub2 * TSRMLS_DC); + +void php_oci_do_connect (INTERNAL_FUNCTION_PARAMETERS, int , int); php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, long session_mode, int persistent, int exclusive TSRMLS_DC); -int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC); -int php_oci_connection_commit(php_oci_connection *connection TSRMLS_DC); + +int php_oci_connection_rollback(php_oci_connection * TSRMLS_DC); +int php_oci_connection_commit(php_oci_connection * TSRMLS_DC); int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC); -int php_oci_password_change(php_oci_connection *connection, char *user, int user_len, char *pass_old, int pass_old_len, char *pass_new, int pass_new_len TSRMLS_DC); -void php_oci_client_get_version(char **version TSRMLS_DC); -int php_oci_server_get_version(php_oci_connection *connection, char **version TSRMLS_DC); -void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_args); -int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSRMLS_DC); + +int php_oci_password_change(php_oci_connection *, char *, int, char *, int, char *, int TSRMLS_DC); +void php_oci_client_get_version(char ** TSRMLS_DC); +int php_oci_server_get_version(php_oci_connection *, char ** TSRMLS_DC); + +void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int, int); +int php_oci_column_to_zval(php_oci_out_column *, zval *, int TSRMLS_DC); /* }}} */ -/* {{{ lob related prototypes */ - -php_oci_descriptor *php_oci_lob_create(php_oci_connection *connection, long type TSRMLS_DC); -int php_oci_lob_get_length(php_oci_descriptor *descriptor, ub4 *length TSRMLS_DC); -int php_oci_lob_read(php_oci_descriptor *descriptor, long read_length, long inital_offset, char **data, ub4 *data_len TSRMLS_DC); -int php_oci_lob_write(php_oci_descriptor *descriptor, ub4 offset, char *data, int data_len, ub4 *bytes_written TSRMLS_DC); -int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC); -int php_oci_lob_set_buffering(php_oci_descriptor *descriptor, int on_off TSRMLS_DC); -int php_oci_lob_get_buffering(php_oci_descriptor *descriptor); -int php_oci_lob_copy(php_oci_descriptor *descriptor, php_oci_descriptor *descriptor_from, long length TSRMLS_DC); -int php_oci_lob_close(php_oci_descriptor *descriptor TSRMLS_DC); -int php_oci_temp_lob_close(php_oci_descriptor *descriptor TSRMLS_DC); -int php_oci_lob_write_tmp(php_oci_descriptor *descriptor, long type, char *data, int data_len TSRMLS_DC); -void php_oci_lob_free(php_oci_descriptor *descriptor TSRMLS_DC); -int php_oci_lob_import(php_oci_descriptor *descriptor, char *filename TSRMLS_DC); -int php_oci_lob_append(php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from TSRMLS_DC); -int php_oci_lob_truncate(php_oci_descriptor *descriptor, long new_lob_length TSRMLS_DC); -int php_oci_lob_erase(php_oci_descriptor *descriptor, long offset, ub4 length, ub4 *bytes_erased TSRMLS_DC); -int php_oci_lob_is_equal(php_oci_descriptor *descriptor_first, php_oci_descriptor *descriptor_second, boolean *result TSRMLS_DC); +/* lob related prototypes {{{ */ + +php_oci_descriptor * php_oci_lob_create (php_oci_connection *, long TSRMLS_DC); +int php_oci_lob_get_length (php_oci_descriptor *, ub4 * TSRMLS_DC); +int php_oci_lob_read (php_oci_descriptor *, long, long, char **, ub4 * TSRMLS_DC); +int php_oci_lob_write (php_oci_descriptor *, ub4, char *, int, ub4 * TSRMLS_DC); +int php_oci_lob_flush (php_oci_descriptor *, long TSRMLS_DC); +int php_oci_lob_set_buffering (php_oci_descriptor *, int TSRMLS_DC); +int php_oci_lob_get_buffering (php_oci_descriptor *); +int php_oci_lob_copy (php_oci_descriptor *, php_oci_descriptor *, long TSRMLS_DC); +int php_oci_lob_close (php_oci_descriptor * TSRMLS_DC); +int php_oci_temp_lob_close (php_oci_descriptor * TSRMLS_DC); +int php_oci_lob_write_tmp (php_oci_descriptor *, long, char *, int TSRMLS_DC); +void php_oci_lob_free(php_oci_descriptor * TSRMLS_DC); +int php_oci_lob_import(php_oci_descriptor *descriptor, char * TSRMLS_DC); +int php_oci_lob_append (php_oci_descriptor *, php_oci_descriptor * TSRMLS_DC); +int php_oci_lob_truncate (php_oci_descriptor *, long TSRMLS_DC); +int php_oci_lob_erase (php_oci_descriptor *, long, ub4, ub4 * TSRMLS_DC); +int php_oci_lob_is_equal (php_oci_descriptor *, php_oci_descriptor *, boolean * TSRMLS_DC); #if defined(HAVE_OCI_LOB_READ2) -sb4 php_oci_lob_callback(dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp); +sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp); #else -sb4 php_oci_lob_callback(dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece); +sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece); #endif /* }}} */ -/* {{{ collection related prototypes */ - -php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC); -int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC); -int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC); -int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRMLS_DC); -int php_oci_collection_append(php_oci_collection *collection, char *element, int element_len TSRMLS_DC); -int php_oci_collection_element_get(php_oci_collection *collection, long index, zval **result_element TSRMLS_DC); -int php_oci_collection_element_set(php_oci_collection *collection, long index, char *value, int value_len TSRMLS_DC); -int php_oci_collection_element_set_null(php_oci_collection *collection, long index TSRMLS_DC); -int php_oci_collection_element_set_date(php_oci_collection *collection, long index, char *date, int date_len TSRMLS_DC); -int php_oci_collection_element_set_number(php_oci_collection *collection, long index, char *number, int number_len TSRMLS_DC); -int php_oci_collection_element_set_string(php_oci_collection *collection, long index, char *element, int element_len TSRMLS_DC); -int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_collection *collection_from TSRMLS_DC); -void php_oci_collection_close(php_oci_collection *collection TSRMLS_DC); -int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC); -int php_oci_collection_append_date(php_oci_collection *collection, char *date, int date_len TSRMLS_DC); -int php_oci_collection_append_number(php_oci_collection *collection, char *number, int number_len TSRMLS_DC); -int php_oci_collection_append_string(php_oci_collection *collection, char *element, int element_len TSRMLS_DC); +/* collection related prototypes {{{ */ + +php_oci_collection * php_oci_collection_create(php_oci_connection *, char *, int, char *, int TSRMLS_DC); +int php_oci_collection_size(php_oci_collection *, sb4 * TSRMLS_DC); +int php_oci_collection_max(php_oci_collection *, long * TSRMLS_DC); +int php_oci_collection_trim(php_oci_collection *, long TSRMLS_DC); +int php_oci_collection_append(php_oci_collection *, char *, int TSRMLS_DC); +int php_oci_collection_element_get(php_oci_collection *, long, zval** TSRMLS_DC); +int php_oci_collection_element_set(php_oci_collection *, long, char *, int TSRMLS_DC); +int php_oci_collection_element_set_null(php_oci_collection *, long TSRMLS_DC); +int php_oci_collection_element_set_date(php_oci_collection *, long, char *, int TSRMLS_DC); +int php_oci_collection_element_set_number(php_oci_collection *, long, char *, int TSRMLS_DC); +int php_oci_collection_element_set_string(php_oci_collection *, long, char *, int TSRMLS_DC); +int php_oci_collection_assign(php_oci_collection *, php_oci_collection * TSRMLS_DC); +void php_oci_collection_close(php_oci_collection * TSRMLS_DC); +int php_oci_collection_append_null(php_oci_collection * TSRMLS_DC); +int php_oci_collection_append_date(php_oci_collection *, char *, int TSRMLS_DC); +int php_oci_collection_append_number(php_oci_collection *, char *, int TSRMLS_DC); +int php_oci_collection_append_string(php_oci_collection *, char *, int TSRMLS_DC); /* }}} */ -/* {{{ statement related prototypes */ +/* statement related prototypes {{{ */ -php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, int query_len TSRMLS_DC); -php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement TSRMLS_DC); -int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 prefetch TSRMLS_DC); -int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC); -php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, long column_index, char *column_name, int column_name_len TSRMLS_DC); -int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC); -int php_oci_statement_cancel(php_oci_statement *statement TSRMLS_DC); -void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC); +php_oci_statement * php_oci_statement_create (php_oci_connection *, char *, int TSRMLS_DC); +int php_oci_statement_set_prefetch (php_oci_statement *, long TSRMLS_DC); +int php_oci_statement_fetch (php_oci_statement *, ub4 TSRMLS_DC); +php_oci_out_column * php_oci_statement_get_column (php_oci_statement *, long, char *, int TSRMLS_DC); +int php_oci_statement_execute (php_oci_statement *, ub4 TSRMLS_DC); +int php_oci_statement_cancel (php_oci_statement * TSRMLS_DC); +void php_oci_statement_free (php_oci_statement * TSRMLS_DC); int php_oci_bind_pre_exec(void *data, void *result TSRMLS_DC); int php_oci_bind_post_exec(void *data TSRMLS_DC); -int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long maxlength, ub2 type TSRMLS_DC); -sb4 php_oci_bind_in_callback(dvoid *ictxp, OCIBind *bindp, ub4 iter, ub4 index, dvoid **bufpp, ub4 *alenp, ub1 *piecep, dvoid **indpp); -sb4 php_oci_bind_out_callback(dvoid *octxp, OCIBind *bindp, ub4 iter, ub4 index, dvoid **bufpp, ub4 **alenpp, ub1 *piecep, dvoid **indpp, ub2 **rcodepp); +int php_oci_bind_by_name(php_oci_statement *, char *, int, zval*, long, ub2 TSRMLS_DC); +sb4 php_oci_bind_in_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 *, ub1 *, dvoid **); +sb4 php_oci_bind_out_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **); php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data); int php_oci_cleanup_pre_fetch(void *data TSRMLS_DC); -int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC); -int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSRMLS_DC); -int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long max_table_length, long maxlength, long type TSRMLS_DC); -php_oci_bind *php_oci_bind_array_helper_number(zval *var, long max_table_length TSRMLS_DC); -php_oci_bind *php_oci_bind_array_helper_double(zval *var, long max_table_length TSRMLS_DC); -php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, long maxlength TSRMLS_DC); -php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, php_oci_connection *connection TSRMLS_DC); + +int php_oci_statement_get_type(php_oci_statement *, ub2 * TSRMLS_DC); +int php_oci_statement_get_numrows(php_oci_statement *, ub4 * TSRMLS_DC); +int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval* var, long max_table_length, long maxlength, long type TSRMLS_DC); +php_oci_bind *php_oci_bind_array_helper_number(zval* var, long max_table_length TSRMLS_DC); +php_oci_bind *php_oci_bind_array_helper_double(zval* var, long max_table_length TSRMLS_DC); +php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length, long maxlength TSRMLS_DC); +php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, php_oci_connection *connection TSRMLS_DC); /* }}} */ -ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ Module globals */ +ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ */ sword errcode; /* global last error code (used when connect fails, for example) */ OCIError *err; /* global error handle */ diff --git a/ext/oci8/tests/bind_char_1.phpt b/ext/oci8/tests/bind_char_1.phpt index d68991a7f2baf..91fa4b75b76b2 100644 --- a/ext/oci8/tests/bind_char_1.phpt +++ b/ext/oci8/tests/bind_char_1.phpt @@ -5,15 +5,12 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] >= 2) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) - ))) { - die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); +if (preg_match('/Release 10\.2\./', oci_server_version($c), $matches) !== 1) { + if (preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 2) { + die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); + } } -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 11) { +if (preg_match('/^11\./', oci_client_version()) != 1) { die("skip test expected to work only with Oracle 11g or greater version of client"); } ?> diff --git a/ext/oci8/tests/bind_char_1_11gR1.phpt b/ext/oci8/tests/bind_char_1_11gR1.phpt index 2a7c713aa7f15..a7feff9f6a879 100644 --- a/ext/oci8/tests/bind_char_1_11gR1.phpt +++ b/ext/oci8/tests/bind_char_1_11gR1.phpt @@ -5,12 +5,10 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 11 && $matches[2] == 1) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) - ))) { - die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); +if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) { + if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { + die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); + } } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_2.phpt b/ext/oci8/tests/bind_char_2.phpt index 3695c85854904..43661a065da49 100644 --- a/ext/oci8/tests/bind_char_2.phpt +++ b/ext/oci8/tests/bind_char_2.phpt @@ -5,15 +5,12 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR and dates if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] >= 2) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) - ))) { - die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); +if (preg_match('/Release 10\.2\./', oci_server_version($c), $matches) !== 1) { + if (preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 2) { + die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); + } } -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 11) { +if (preg_match('/^11\./', oci_client_version()) != 1) { die("skip test expected to work only with Oracle 11g or greater version of client"); } ?> diff --git a/ext/oci8/tests/bind_char_2_11gR1.phpt b/ext/oci8/tests/bind_char_2_11gR1.phpt index b9afd6940bcca..edb2a12ff0a29 100644 --- a/ext/oci8/tests/bind_char_2_11gR1.phpt +++ b/ext/oci8/tests/bind_char_2_11gR1.phpt @@ -5,12 +5,10 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR and dates if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 11 && $matches[2] == 1) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) - ))) { - die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); +if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) { + if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { + die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); + } } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_3.phpt b/ext/oci8/tests/bind_char_3.phpt index 009e60a542b6a..25115836dfcb7 100644 --- a/ext/oci8/tests/bind_char_3.phpt +++ b/ext/oci8/tests/bind_char_3.phpt @@ -5,15 +5,12 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] >= 2) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) - ))) { - die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); +if (preg_match('/Release 10\.2\./', oci_server_version($c), $matches) !== 1) { + if (preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 2) { + die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); + } } -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 11) { +if (preg_match('/^11\./', oci_client_version()) != 1) { die("skip test expected to work only with Oracle 11g or greater version of client"); } ?> diff --git a/ext/oci8/tests/bind_char_3_11gR1.phpt b/ext/oci8/tests/bind_char_3_11gR1.phpt index a894de00c075f..fea77754d1760 100644 --- a/ext/oci8/tests/bind_char_3_11gR1.phpt +++ b/ext/oci8/tests/bind_char_3_11gR1.phpt @@ -5,12 +5,10 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 11 && $matches[2] == 1) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) - ))) { - die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); +if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) { + if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { + die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); + } } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_4.phpt b/ext/oci8/tests/bind_char_4.phpt index 0ac60e503de87..36765f8137443 100644 --- a/ext/oci8/tests/bind_char_4.phpt +++ b/ext/oci8/tests/bind_char_4.phpt @@ -5,15 +5,12 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] >= 2) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) - ))) { - die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); +if (preg_match('/Release 10\.2\./', oci_server_version($c), $matches) !== 1) { + if (preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 2) { + die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); + } } -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 11) { +if (preg_match('/^11\./', oci_client_version()) != 1) { die("skip test expected to work only with Oracle 11g or greater version of client"); } ?> diff --git a/ext/oci8/tests/bind_char_4_11gR1.phpt b/ext/oci8/tests/bind_char_4_11gR1.phpt index d5ce116afb65a..2bc2f1424634d 100644 --- a/ext/oci8/tests/bind_char_4_11gR1.phpt +++ b/ext/oci8/tests/bind_char_4_11gR1.phpt @@ -5,12 +5,10 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 11 && $matches[2] == 1) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) - ))) { - die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); +if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) { + if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { + die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); + } } ?> --ENV-- diff --git a/ext/oci8/tests/bind_unsupported_2.phpt b/ext/oci8/tests/bind_unsupported_2.phpt index a2bf9de5a6b60..d3e5375df6c4a 100644 --- a/ext/oci8/tests/bind_unsupported_2.phpt +++ b/ext/oci8/tests/bind_unsupported_2.phpt @@ -3,8 +3,7 @@ Bind with various unsupported 10g+ bind types --SKIPIF-- diff --git a/ext/oci8/tests/bug27303_1.phpt b/ext/oci8/tests/bug27303_1.phpt index 0ef47f13ddeef..40ab4ebed2472 100644 --- a/ext/oci8/tests/bug27303_1.phpt +++ b/ext/oci8/tests/bug27303_1.phpt @@ -5,15 +5,12 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters) if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] >= 2) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) - ))) { - die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); +if (preg_match('/Release 10\.2\.0\.2/', oci_server_version($c), $matches) !== 1 && + preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 1) { + die("skip expected output only valid when using Oracle 10.2.0.2 or 11.2.0.2 databases"); + // Other point releases may also work } -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 11) { +if (preg_match('/^11\./', oci_client_version()) != 1) { die("skip test expected to work only with Oracle 11g or greater version of client"); } ?> diff --git a/ext/oci8/tests/bug27303_1_11gR1.phpt b/ext/oci8/tests/bug27303_1_11gR1.phpt index 7b4c158561959..6de9b99378553 100644 --- a/ext/oci8/tests/bug27303_1_11gR1.phpt +++ b/ext/oci8/tests/bug27303_1_11gR1.phpt @@ -5,13 +5,12 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters) if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) || - ($matches[1] == 11 && $matches[2] == 1 && $matches[3] == 0 && $matches[4] == 6) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) - ))) { - die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); +if (preg_match('/Release 10\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { + if (preg_match('/Release 11\.1\.0\.6/', oci_server_version($c), $matches) !== 1) { + if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { + die("skip expected output only valid when using specific Oracle database versions"); + } + } } ?> --FILE-- diff --git a/ext/oci8/tests/bug27303_2.phpt b/ext/oci8/tests/bug27303_2.phpt index 72d4e5a7ddbcf..1fb2b31682719 100644 --- a/ext/oci8/tests/bug27303_2.phpt +++ b/ext/oci8/tests/bug27303_2.phpt @@ -5,15 +5,12 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters) if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) - ))) { - die("skip expected output only valid when using Oracle 10.2.0.2 or 11.2.0.2 databases"); +if (preg_match('/Release 10\.2\.0\.2/', oci_server_version($c), $matches) !== 1 && + preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 1) { + die("skip expected output only valid when using Oracle 10.2.0.2 or 11.2.0.2 databases"); + // Other point releases may also work } -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 11) { +if (preg_match('/^11\./', oci_client_version()) != 1) { die("skip test expected to work only with Oracle 11g or greater version of client"); } ?> diff --git a/ext/oci8/tests/bug27303_2_11gR1.phpt b/ext/oci8/tests/bug27303_2_11gR1.phpt index 27d8a585bd452..1e3e3105ad665 100644 --- a/ext/oci8/tests/bug27303_2_11gR1.phpt +++ b/ext/oci8/tests/bug27303_2_11gR1.phpt @@ -5,13 +5,12 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters) if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) || - ($matches[1] == 11 && $matches[2] == 1 && $matches[3] == 0 && $matches[4] == 6) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) - ))) { - die("skip expected output only valid when using specific Oracle database versions"); +if (preg_match('/Release 10\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { + if (preg_match('/Release 11\.1\.0\.6/', oci_server_version($c), $matches) !== 1) { + if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { + die("skip expected output only valid when using specific Oracle database versions"); + } + } } ?> --FILE-- diff --git a/ext/oci8/tests/bug27303_4.phpt b/ext/oci8/tests/bug27303_4.phpt index a24ae705aba57..3137db8659191 100644 --- a/ext/oci8/tests/bug27303_4.phpt +++ b/ext/oci8/tests/bug27303_4.phpt @@ -5,16 +5,12 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters) if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 2) - ))) { - die("skip expected output only valid when using Oracle 10.2.0.2 or 11.2.0.2 databases"); - // Other point releases may also work +if (preg_match('/Release 10\.2\.0\.2/', oci_server_version($c), $matches) !== 1 && + preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 1) { + die("skip expected output only valid when using Oracle 10.2.0.2 or 11.2.0.2 databases"); + // Other point releases may also work } -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 11) { +if (preg_match('/^11\./', oci_client_version()) != 1) { die("skip test expected to work only with Oracle 11g or greater version of client"); } ?> diff --git a/ext/oci8/tests/bug27303_4_11gR1.phpt b/ext/oci8/tests/bug27303_4_11gR1.phpt index 01db1dc5a0bef..f9bc2da8a25ad 100644 --- a/ext/oci8/tests/bug27303_4_11gR1.phpt +++ b/ext/oci8/tests/bug27303_4_11gR1.phpt @@ -5,13 +5,12 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters) if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && - (($matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) || - ($matches[1] == 11 && $matches[2] == 1 && $matches[3] == 0 && $matches[4] == 6) || - ($matches[1] == 11 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] == 3) - ))) { - die("skip expected output only valid when using specific Oracle database versions"); +if (preg_match('/Release 10\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { + if (preg_match('/Release 11\.1\.0\.6/', oci_server_version($c), $matches) !== 1) { + if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { + die("skip expected output only valid when using specific Oracle database versions"); + } + } } ?> --FILE-- diff --git a/ext/oci8/tests/bug36403.phpt b/ext/oci8/tests/bug36403.phpt index 4ac32c4b069a5..53dae694ec8bf 100644 --- a/ext/oci8/tests/bug36403.phpt +++ b/ext/oci8/tests/bug36403.phpt @@ -3,9 +3,8 @@ Bug #36403 (oci_execute no longer supports OCI_DESCRIBE_ONLY) --SKIPIF-- --FILE-- diff --git a/ext/oci8/tests/bug43492_2.phpt b/ext/oci8/tests/bug43492_2.phpt index d735f64299476..61511cf6d2f45 100644 --- a/ext/oci8/tests/bug43492_2.phpt +++ b/ext/oci8/tests/bug43492_2.phpt @@ -8,7 +8,7 @@ require(dirname(__FILE__).'/skipif.inc'); --FILE-- true, 'timesten' => false); // test runs on these DBs require(dirname(__FILE__).'/skipif.inc'); if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 10) { - die("skip test expected to work only with Oracle 10g or greater version of client"); +if (preg_match('/^1[01]\./', oci_client_version()) != 1) { + die("skip expected output only valid with Oracle 10g or greater version of client"); } ?> --FILE-- diff --git a/ext/oci8/tests/bug47281.phpt b/ext/oci8/tests/bug47281.phpt index 0098ec5ebb772..d0e00235374c9 100644 --- a/ext/oci8/tests/bug47281.phpt +++ b/ext/oci8/tests/bug47281.phpt @@ -6,12 +6,11 @@ $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on t require(dirname(__FILE__).'/skipif.inc'); // error3.phpt obsoletes this test for newer Oracle client versions // Assume runtime client version is >= compile time client version -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!isset($matches[0]) || - ($matches[0] > 11 || ($matches[0] == 11 && $matches[1] > 2) || ($matches[0] == 11 && $matches[1] == 2 && $matches[3] >= 3) - )) { +$cv = explode('.', oci_client_version()); +if ($cv[0] > 11 || ($cv[0] == 11 && $cv[1] > 2) || ($cv[0] == 11 && $cv[1] == 2 && $cv[3] >= 3)) { die("skip test works only with Oracle 11.2.0.2 or earlier Oracle client libraries"); } + ?> --ENV-- NLS_LANG=.AL32UTF8 diff --git a/ext/oci8/tests/commit_001.phpt b/ext/oci8/tests/commit_001.phpt index ef4018118e31a..806fb193a0e7c 100644 --- a/ext/oci8/tests/commit_001.phpt +++ b/ext/oci8/tests/commit_001.phpt @@ -81,48 +81,48 @@ echo "Done\n"; bool(true) int(0) array(5) { - ["ID"]=> + [%u|b%"ID"]=> array(0) { } - ["VALUE"]=> + [%u|b%"VALUE"]=> array(0) { } - ["BLOB"]=> + [%u|b%"BLOB"]=> array(0) { } - ["CLOB"]=> + [%u|b%"CLOB"]=> array(0) { } - ["STRING"]=> + [%u|b%"STRING"]=> array(0) { } } bool(true) int(4) array(5) { - ["ID"]=> + [%u|b%"ID"]=> array(4) { [0]=> - string(1) "1" + %string|unicode%(1) "1" [1]=> - string(1) "1" + %string|unicode%(1) "1" [2]=> - string(1) "1" + %string|unicode%(1) "1" [3]=> - string(1) "1" + %string|unicode%(1) "1" } - ["VALUE"]=> + [%u|b%"VALUE"]=> array(4) { [0]=> - string(1) "1" + %string|unicode%(1) "1" [1]=> - string(1) "1" + %string|unicode%(1) "1" [2]=> - string(1) "1" + %string|unicode%(1) "1" [3]=> - string(1) "1" + %string|unicode%(1) "1" } - ["BLOB"]=> + [%u|b%"BLOB"]=> array(4) { [0]=> NULL @@ -133,7 +133,7 @@ array(5) { [3]=> NULL } - ["CLOB"]=> + [%u|b%"CLOB"]=> array(4) { [0]=> NULL @@ -144,7 +144,7 @@ array(5) { [3]=> NULL } - ["STRING"]=> + [%u|b%"STRING"]=> array(4) { [0]=> NULL diff --git a/ext/oci8/tests/conn_attr.inc b/ext/oci8/tests/conn_attr.inc index 2edc1c95528db..220e6882106b6 100644 --- a/ext/oci8/tests/conn_attr.inc +++ b/ext/oci8/tests/conn_attr.inc @@ -2,28 +2,30 @@ require(dirname(__FILE__)."/connect.inc"); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if ((isset($matches[1]) && $matches[1] >= 11)) { +$sv = oci_server_version($c); +$sv = preg_match('/Release (11\.2|12)\./', $sv, $matches); +if ($sv == 1) { // Server is Oracle 11.2+ $stmtarray = array( - "drop user $testuser cascade", - "create user $testuser identified by $testpassword", // $testuser should be set by the file that includes conn_attr.inc - "grant connect,resource,dba to $testuser", - "alter user $testuser enable editions", - "drop edition myedition1 cascade", - "drop edition myedition cascade", - "grant create any edition to $testuser", + "drop user testuser cascade", + "create user testuser identified by testuser", + "grant connect,resource,dba to testuser", + "alter user testuser enable editions", + "drop edition myedition1", + "drop edition myedition", + "grant create any edition to testuser", "create edition myedition", "create edition myedition1 as child of myedition", - "grant use on edition myedition to $testuser", - "grant use on edition myedition1 to $testuser", + "grant use on edition myedition to testuser", + "grant use on edition myedition1 to testuser", ); -} else { +} +else { // Server is Pre 11.2 $stmtarray = array( - "drop user $testuser cascade", - "create user $testuser identified by $testpassword", - "grant connect,resource,dba to $testuser", + "drop user testuser cascade", + "create user testuser identified by testuser", + "grant connect,resource,dba to testuser", ); } @@ -66,8 +68,8 @@ function get_attr($conn,$attr) function get_conn($conn_type) { - $user = $GLOBALS['testuser']; - $password = $GLOBALS['testpassword']; + $user = 'testuser'; + $password = 'testuser'; $dbase = $GLOBALS['dbase']; switch($conn_type) { case 1: @@ -137,9 +139,9 @@ function get_sys_attr($conn,$attr) function clean_up($c) { $stmtarray = array( - "drop edition myedition1 cascade", - "drop edition myedition cascade", - "drop user " . $GLOBALS['testuser'] . " cascade", + "drop user testuser cascade", + "drop edition myedition1", + "drop edition myedition", ); foreach ($stmtarray as $stmt) { diff --git a/ext/oci8/tests/conn_attr_1.phpt b/ext/oci8/tests/conn_attr_1.phpt index 631bc19c1d416..ad508a2ed2a4f 100644 --- a/ext/oci8/tests/conn_attr_1.phpt +++ b/ext/oci8/tests/conn_attr_1.phpt @@ -9,21 +9,15 @@ if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user"); if ($test_drcp) die("skip output might vary with DRCP"); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 10)) { +if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) { die("skip expected output only valid when using Oracle 10g or greater database server"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 10) { +} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) { die("skip test expected to work only with Oracle 10g or greater version of client"); } + ?> --FILE-- = 10)) { +if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) { die("skip expected output only valid when using Oracle 10g or greater database server"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 10) { +} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) { die("skip test expected to work only with Oracle 10g or greater version of client"); } + ?> --INI-- oci8.privileged_connect = On --FILE-- = 10)) { +if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) { die("skip expected output only valid when using Oracle 10g or greater database server"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 10) { +} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) { die("skip test expected to work only with Oracle 10g or greater version of client"); } ?> --FILE-- = 2) || - ($matches[1] >= 12) - ))) { - // Bug fixed in 11.2 prevents client_info being reset +if (preg_match('/Release (11\.2|12)\./', oci_server_version($c), $matches) !== 1) { + // Bug fixed in 11.2 prevents client_info being rest die("skip expected output only valid when using Oracle 11gR2 or greater database server"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 10) { +} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) { die("skip test expected to work only with Oracle 10g or greater version of client"); } ?> --FILE-- = 10)) { +if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) { die("skip expected output only valid when using Oracle 10g or greater database server"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (isset($matches[0]) && $matches[0] < 10) { +} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) { die("skip test expected to work only with Oracle 10g or greater version of client"); } ?> --FILE-- (10\.2)/', $phpinfo); +if ($iv != 1) { die ("skip tests a feature that works only with Oracle 10gR2"); } ?> diff --git a/ext/oci8/tests/connect_without_oracle_home_11.phpt b/ext/oci8/tests/connect_without_oracle_home_11.phpt index 40dc5a98fc7e3..1620803dbb738 100644 --- a/ext/oci8/tests/connect_without_oracle_home_11.phpt +++ b/ext/oci8/tests/connect_without_oracle_home_11.phpt @@ -10,11 +10,7 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo); if ($ov != 1) { die ("skip Test only valid when OCI8 is built with an ORACLE_HOME"); } -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && - (($matches[0] == 11 && $matches[1] >= 2) || - ($matches[0] >= 12) - ))) { +if (preg_match('/^11\.2|12\./', oci_client_version()) != 1) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } ?> diff --git a/ext/oci8/tests/connect_without_oracle_home_old_11.phpt b/ext/oci8/tests/connect_without_oracle_home_old_11.phpt index e04016f41a766..c7cfecf396119 100644 --- a/ext/oci8/tests/connect_without_oracle_home_old_11.phpt +++ b/ext/oci8/tests/connect_without_oracle_home_old_11.phpt @@ -10,11 +10,7 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo); if ($ov !== 1) { die ("skip Test only valid when OCI8 is built with an ORACLE_HOME"); } -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && - (($matches[0] == 11 && $matches[1] >= 2) || - ($matches[0] >= 12) - ))) { +if (preg_match('/^11\.2|12\./', oci_client_version()) != 1) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } ?> diff --git a/ext/oci8/tests/cursors_old.phpt b/ext/oci8/tests/cursors_old.phpt index aa25937570e59..d60e2ff1ea430 100644 --- a/ext/oci8/tests/cursors_old.phpt +++ b/ext/oci8/tests/cursors_old.phpt @@ -52,19 +52,19 @@ echo "Done\n"; ?> --EXPECTF-- array(2) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" + [%u|b%"ID"]=> + %unicode|string%(1) "1" + [%u|b%"VALUE"]=> + %unicode|string%(1) "1" } bool(true) Warning: ocifetchinto():%sORA-01002: %s in %scursors_old.php on line %d array(2) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" + [%u|b%"ID"]=> + %unicode|string%(1) "1" + [%u|b%"VALUE"]=> + %unicode|string%(1) "1" } bool(true) Done diff --git a/ext/oci8/tests/debug.phpt b/ext/oci8/tests/debug.phpt index 66ab0f0d005f0..fe96e6e87ec44 100644 --- a/ext/oci8/tests/debug.phpt +++ b/ext/oci8/tests/debug.phpt @@ -16,9 +16,10 @@ else { oci_connect($user, $password); } +echo "Done\n"; + oci_internal_debug(false); ?> -===DONE=== ---EXPECT-- -===DONE=== +--EXPECTREGEX-- +^OCI8 DEBUG: .*Done$ diff --git a/ext/oci8/tests/define.phpt b/ext/oci8/tests/define.phpt index b78f698e7c38e..c6ce7bd9b3048 100644 --- a/ext/oci8/tests/define.phpt +++ b/ext/oci8/tests/define.phpt @@ -44,5 +44,5 @@ echo "Done\n"; ?> --EXPECTF-- -string(%d) "some" +%unicode|string%(%d) "some" Done diff --git a/ext/oci8/tests/define1.phpt b/ext/oci8/tests/define1.phpt index be16271d5bb16..6e4b74e3bacb5 100644 --- a/ext/oci8/tests/define1.phpt +++ b/ext/oci8/tests/define1.phpt @@ -55,5 +55,5 @@ bool(false) Warning: oci_define_by_name() expects at least 3 parameters, 2 given in %s on line %d NULL -string(4) "some" +%unicode|string%(4) "some" Done diff --git a/ext/oci8/tests/define4.phpt b/ext/oci8/tests/define4.phpt index 3114a73937696..266fd7edd70fe 100644 --- a/ext/oci8/tests/define4.phpt +++ b/ext/oci8/tests/define4.phpt @@ -58,15 +58,15 @@ echo "Done\n"; Test 1 bool(true) Test 2 -string(4) "1234" -string(4) "some" -string(4) "some" -string(4) "some" -string(4) "1234" -string(4) "some" +%unicode|string%(4) "1234" +%unicode|string%(4) "some" +%unicode|string%(4) "some" +%unicode|string%(4) "some" +%unicode|string%(4) "1234" +%unicode|string%(4) "some" Test 3 bool(true) -string(4) "some" +%unicode|string%(4) "some" Warning: oci_result(): %d is not a valid oci8 statement resource in %s on line %d bool(false) diff --git a/ext/oci8/tests/define5.phpt b/ext/oci8/tests/define5.phpt index 978d66b260745..68fa01d09aa87 100644 --- a/ext/oci8/tests/define5.phpt +++ b/ext/oci8/tests/define5.phpt @@ -61,12 +61,12 @@ echo "Done\n"; Test 1 - must do define before execute bool(true) NULL -string(4) "some" +%unicode|string%(4) "some" Test 2 - normal define order bool(true) -string(4) "some" +%unicode|string%(4) "some" Test 3 - no new define done -string(4) "some" -string(5) "thing" +%unicode|string%(4) "some" +%unicode|string%(5) "thing" Done diff --git a/ext/oci8/tests/define_old.phpt b/ext/oci8/tests/define_old.phpt index cc07e2ea94fb8..f65e6b80809b4 100644 --- a/ext/oci8/tests/define_old.phpt +++ b/ext/oci8/tests/define_old.phpt @@ -44,5 +44,5 @@ echo "Done\n"; ?> --EXPECTF-- -string(4) "some" +%unicode|string%(4) "some" Done diff --git a/ext/oci8/tests/details.inc b/ext/oci8/tests/details.inc index e54ea84abdb47..9a86c46868478 100644 --- a/ext/oci8/tests/details.inc +++ b/ext/oci8/tests/details.inc @@ -52,7 +52,7 @@ if (!function_exists('oci8_test_sql_execute')) { $s = oci_parse($c, $stmt); if (!$s) { $m = oci_error($c); - echo "oci8_test_sql_execute() error:". PHP_EOL . $stmt . PHP_EOL . $m['message'] . PHP_EOL; + echo $stmt . PHP_EOL . $m['message'] . PHP_EOL; } else { $r = @oci_execute($s); @@ -66,7 +66,7 @@ if (!function_exists('oci8_test_sql_execute')) { , 4080 // trigger does not exist , 38802 // edition does not exist ))) { - echo "oci8_test_sql_execute() error:". PHP_EOL . $stmt . PHP_EOL . $m['message'] . PHP_EOL; + echo $stmt . PHP_EOL . $m['message'] . PHP_EOL; } } } diff --git a/ext/oci8/tests/edition_1.phpt b/ext/oci8/tests/edition_1.phpt index d8ca53cddf061..b9c8fd817ef87 100644 --- a/ext/oci8/tests/edition_1.phpt +++ b/ext/oci8/tests/edition_1.phpt @@ -24,9 +24,6 @@ if (preg_match('/Release (1[1]\.2|12)\./', oci_server_version($c), $matches) !== * already */ -$testuser = 'testuser_attr_1'; // Used in conn_attr.inc -$testpassword = 'testuser'; - require(dirname(__FILE__)."/conn_attr.inc"); function select_fn($conn) { @@ -42,7 +39,7 @@ function select_fn($conn) { select from both the editions and verify the contents. */ set_edit_attr('MYEDITION'); -$conn = oci_connect($testuser,$testpassword,$dbase); +$conn = oci_connect('testuser','testuser',$dbase); if ($conn === false) { $m = oci_error(); die("Error:" . $m['message']); @@ -64,7 +61,7 @@ select_fn($conn); // Create a different version of view_ed in MYEDITION1. set_edit_attr('MYEDITION1'); -$conn2 = oci_new_connect($testuser,$testpassword,$dbase); +$conn2 = oci_new_connect('testuser','testuser',$dbase); $stmt = "create or replace editioning view view_ed as select name,age,job,salary from edit_tab"; $s = oci_parse($conn2, $stmt); oci_execute($s); @@ -90,58 +87,58 @@ The value of edition has been successfully set The value of current EDITION is MYEDITION array(3) { [0]=> - string(%d) "mike" + %unicode|string%(%d) "mike" [1]=> - string(%d) "30" + %unicode|string%(%d) "30" [2]=> - string(%d) "Senior engineer" + %unicode|string%(%d) "Senior engineer" } array(3) { [0]=> - string(%d) "juan" + %unicode|string%(%d) "juan" [1]=> - string(%d) "25" + %unicode|string%(%d) "25" [2]=> - string(%d) "engineer" + %unicode|string%(%d) "engineer" } The value of edition has been successfully set The value of current EDITION is MYEDITION1 array(4) { [0]=> - string(%d) "mike" + %unicode|string%(%d) "mike" [1]=> - string(%d) "30" + %unicode|string%(%d) "30" [2]=> - string(%d) "Senior engineer" + %unicode|string%(%d) "Senior engineer" [3]=> - string(%d) "200" + %unicode|string%(%d) "200" } array(4) { [0]=> - string(%d) "juan" + %unicode|string%(%d) "juan" [1]=> - string(%d) "25" + %unicode|string%(%d) "25" [2]=> - string(%d) "engineer" + %unicode|string%(%d) "engineer" [3]=> - string(%d) "100" + %unicode|string%(%d) "100" } version of view_ed in MYEDITION The value of current EDITION is MYEDITION array(3) { [0]=> - string(%d) "mike" + %unicode|string%(%d) "mike" [1]=> - string(%d) "30" + %unicode|string%(%d) "30" [2]=> - string(%d) "Senior engineer" + %unicode|string%(%d) "Senior engineer" } array(3) { [0]=> - string(%d) "juan" + %unicode|string%(%d) "juan" [1]=> - string(%d) "25" + %unicode|string%(%d) "25" [2]=> - string(%d) "engineer" + %unicode|string%(%d) "engineer" } Done diff --git a/ext/oci8/tests/edition_2.phpt b/ext/oci8/tests/edition_2.phpt index 0ffb62dc32633..030e6a673c859 100644 --- a/ext/oci8/tests/edition_2.phpt +++ b/ext/oci8/tests/edition_2.phpt @@ -24,11 +24,11 @@ if (preg_match('/Release (1[1]\.2|12)\./', oci_server_version($c), $matches) !== * already */ -$testuser = 'testuser_ed_2'; // Used in conn_attr.inc -$testpassword = 'testuser'; - require(dirname(__FILE__)."/conn_attr.inc"); +$user = 'testuser'; +$password = 'testuser'; + echo"**Test 1.1 - Default value for the attribute **************\n"; get_edit_attr($c); @@ -50,7 +50,7 @@ get_edit_attr($conn3); oci_close($conn1); // With a oci_pconnect with a different charset. -$pc1 = oci_pconnect($testuser,$testpassword,$dbase,"utf8"); +$pc1 = oci_pconnect($user,$password,$dbase,"utf8"); get_edit_attr($pc1); oci_close($pc1); @@ -145,7 +145,7 @@ function set_scope() { } function get_scope() { - $sc1 = oci_connect($GLOBALS['testuser'],$GLOBALS['testpassword'],$GLOBALS['dbase']); + $sc1 = oci_connect($GLOBALS['user'],$GLOBALS['password'],$GLOBALS['dbase']); if ($sc1 === false) { $m = oci_error(); die("Error:" . $m['message']); diff --git a/ext/oci8/tests/extauth_01.phpt b/ext/oci8/tests/extauth_01.phpt index 1194ae180dd20..37f8f3834d803 100644 --- a/ext/oci8/tests/extauth_01.phpt +++ b/ext/oci8/tests/extauth_01.phpt @@ -143,56 +143,56 @@ Test 7 Warning: oci_connect(): ORA-12154: %s in %s on line %d array(4) { - ["code"]=> + [%u|b%"code"]=> int(12154) - ["message"]=> - string(%d) "ORA-12154: %s" - ["offset"]=> + [%u|b%"message"]=> + %unicode|string%(%d) "ORA-12154: %s" + [%u|b%"offset"]=> int(0) - ["sqltext"]=> - string(0) "" + [%u|b%"sqltext"]=> + %unicode|string%(0) "" } bool(false) Test 8 Warning: oci_connect(): ORA-12154: %s in %s on line %d array(4) { - ["code"]=> + [%u|b%"code"]=> int(12154) - ["message"]=> - string(%d) "ORA-12154: %s" - ["offset"]=> + [%u|b%"message"]=> + %unicode|string%(%d) "ORA-12154: %s" + [%u|b%"offset"]=> int(0) - ["sqltext"]=> - string(0) "" + [%u|b%"sqltext"]=> + %unicode|string%(0) "" } bool(false) Test 9 Warning: oci_connect(): ORA-%d: TNS:%s in %s on line %d array(4) { - ["code"]=> + [%u|b%"code"]=> int(%d) - ["message"]=> - string(%d) "ORA-%d: %s" - ["offset"]=> + [%u|b%"message"]=> + %unicode|string%(%d) "ORA-%d: %s" + [%u|b%"offset"]=> int(0) - ["sqltext"]=> - string(0) "" + [%u|b%"sqltext"]=> + %unicode|string%(0) "" } bool(false) Test 10 Warning: oci_connect(): ORA-%d: TNS:%s in %s on line %d array(4) { - ["code"]=> + [%u|b%"code"]=> int(%d) - ["message"]=> - string(%d) "ORA-%d: %s" - ["offset"]=> + [%u|b%"message"]=> + %unicode|string%(%d) "ORA-%d: %s" + [%u|b%"offset"]=> int(0) - ["sqltext"]=> - string(0) "" + [%u|b%"sqltext"]=> + %unicode|string%(0) "" } bool(false) ===DONE=== diff --git a/ext/oci8/tests/extauth_02.phpt b/ext/oci8/tests/extauth_02.phpt index 0a3227019ce41..f3b517f730af4 100644 --- a/ext/oci8/tests/extauth_02.phpt +++ b/ext/oci8/tests/extauth_02.phpt @@ -142,56 +142,56 @@ Test 7 Warning: oci_new_connect(): ORA-12154: %s in %s on line %d array(4) { - ["code"]=> + [%u|b%"code"]=> int(12154) - ["message"]=> - string(%d) "ORA-12154: %s" - ["offset"]=> + [%u|b%"message"]=> + %unicode|string%(%d) "ORA-12154: %s" + [%u|b%"offset"]=> int(0) - ["sqltext"]=> - string(0) "" + [%u|b%"sqltext"]=> + %unicode|string%(0) "" } bool(false) Test 8 Warning: oci_new_connect(): ORA-12154: %s in %s on line %d array(4) { - ["code"]=> + [%u|b%"code"]=> int(12154) - ["message"]=> - string(%d) "ORA-12154: %s" - ["offset"]=> + [%u|b%"message"]=> + %unicode|string%(%d) "ORA-12154: %s" + [%u|b%"offset"]=> int(0) - ["sqltext"]=> - string(0) "" + [%u|b%"sqltext"]=> + %unicode|string%(0) "" } bool(false) Test 9 Warning: oci_new_connect(): ORA-%d: TNS:%s %s on line %d array(4) { - ["code"]=> + [%u|b%"code"]=> int(%d) - ["message"]=> - string(%d) "ORA-%d: %s" - ["offset"]=> + [%u|b%"message"]=> + %unicode|string%(%d) "ORA-%d: %s" + [%u|b%"offset"]=> int(0) - ["sqltext"]=> - string(0) "" + [%u|b%"sqltext"]=> + %unicode|string%(0) "" } bool(false) Test 10 Warning: oci_new_connect(): ORA-%d: TNS:%s %s on line %d array(4) { - ["code"]=> + [%u|b%"code"]=> int(%d) - ["message"]=> - string(%d) "ORA-%d: %s" - ["offset"]=> + [%u|b%"message"]=> + %unicode|string%(%d) "ORA-%d: %s" + [%u|b%"offset"]=> int(0) - ["sqltext"]=> - string(0) "" + [%u|b%"sqltext"]=> + %unicode|string%(0) "" } bool(false) ===DONE=== diff --git a/ext/oci8/tests/extauth_03.phpt b/ext/oci8/tests/extauth_03.phpt index d7884ce6b48f6..e6685eb1769ba 100644 --- a/ext/oci8/tests/extauth_03.phpt +++ b/ext/oci8/tests/extauth_03.phpt @@ -142,56 +142,56 @@ Test 7 Warning: oci_pconnect(): ORA-12154: %s in %s on line %d array(4) { - ["code"]=> + [%u|b%"code"]=> int(12154) - ["message"]=> - string(%d) "ORA-12154: %s" - ["offset"]=> + [%u|b%"message"]=> + %unicode|string%(%d) "ORA-12154: %s" + [%u|b%"offset"]=> int(0) - ["sqltext"]=> - string(0) "" + [%u|b%"sqltext"]=> + %unicode|string%(0) "" } bool(false) Test 8 Warning: oci_pconnect(): ORA-12154: %s in %s on line %d array(4) { - ["code"]=> + [%u|b%"code"]=> int(12154) - ["message"]=> - string(%d) "ORA-12154: %s" - ["offset"]=> + [%u|b%"message"]=> + %unicode|string%(%d) "ORA-12154: %s" + [%u|b%"offset"]=> int(0) - ["sqltext"]=> - string(0) "" + [%u|b%"sqltext"]=> + %unicode|string%(0) "" } bool(false) Test 9 Warning: oci_pconnect(): ORA-%d: TNS:%s in %s on line %d array(4) { - ["code"]=> + [%u|b%"code"]=> int(%d) - ["message"]=> - string(%d) "ORA-%d: %s" - ["offset"]=> + [%u|b%"message"]=> + %unicode|string%(%d) "ORA-%d: %s" + [%u|b%"offset"]=> int(0) - ["sqltext"]=> - string(0) "" + [%u|b%"sqltext"]=> + %unicode|string%(0) "" } bool(false) Test 10 Warning: oci_pconnect(): ORA-%d: TNS:%s in %s on line %d array(4) { - ["code"]=> + [%u|b%"code"]=> int(%d) - ["message"]=> - string(%d) "ORA-%d: %s" - ["offset"]=> + [%u|b%"message"]=> + %unicode|string%(%d) "ORA-%d: %s" + [%u|b%"offset"]=> int(0) - ["sqltext"]=> - string(0) "" + [%u|b%"sqltext"]=> + %unicode|string%(0) "" } bool(false) ===DONE=== diff --git a/ext/oci8/tests/fetch.phpt b/ext/oci8/tests/fetch.phpt index b968ae4bf6ea1..e48aeefd87b61 100644 --- a/ext/oci8/tests/fetch.phpt +++ b/ext/oci8/tests/fetch.phpt @@ -47,10 +47,10 @@ oci8_test_sql_execute($c, $stmtarray); echo "Done\n"; ?> --EXPECTF-- -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" +%unicode|string%(1) "1" +%unicode|string%(1) "1" +%unicode|string%(1) "1" +%unicode|string%(1) "1" +%unicode|string%(1) "1" +%unicode|string%(1) "1" Done diff --git a/ext/oci8/tests/fetch_all.phpt b/ext/oci8/tests/fetch_all.phpt index b8155b170b0aa..4fc41daad482f 100644 --- a/ext/oci8/tests/fetch_all.phpt +++ b/ext/oci8/tests/fetch_all.phpt @@ -51,44 +51,44 @@ echo "Done\n"; --EXPECTF-- int(3) array(2) { - ["ID"]=> + [%u|b%"ID"]=> array(3) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "1" + %unicode|string%(1) "1" [2]=> - string(1) "1" + %unicode|string%(1) "1" } - ["VALUE"]=> + [%u|b%"VALUE"]=> array(3) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "1" + %unicode|string%(1) "1" [2]=> - string(1) "1" + %unicode|string%(1) "1" } } int(3) array(2) { - ["ID"]=> + [%u|b%"ID"]=> array(3) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "1" + %unicode|string%(1) "1" [2]=> - string(1) "1" + %unicode|string%(1) "1" } - ["VALUE"]=> + [%u|b%"VALUE"]=> array(3) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "1" + %unicode|string%(1) "1" [2]=> - string(1) "1" + %unicode|string%(1) "1" } } Done diff --git a/ext/oci8/tests/fetch_all1.phpt b/ext/oci8/tests/fetch_all1.phpt index b8155b170b0aa..4fc41daad482f 100644 --- a/ext/oci8/tests/fetch_all1.phpt +++ b/ext/oci8/tests/fetch_all1.phpt @@ -51,44 +51,44 @@ echo "Done\n"; --EXPECTF-- int(3) array(2) { - ["ID"]=> + [%u|b%"ID"]=> array(3) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "1" + %unicode|string%(1) "1" [2]=> - string(1) "1" + %unicode|string%(1) "1" } - ["VALUE"]=> + [%u|b%"VALUE"]=> array(3) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "1" + %unicode|string%(1) "1" [2]=> - string(1) "1" + %unicode|string%(1) "1" } } int(3) array(2) { - ["ID"]=> + [%u|b%"ID"]=> array(3) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "1" + %unicode|string%(1) "1" [2]=> - string(1) "1" + %unicode|string%(1) "1" } - ["VALUE"]=> + [%u|b%"VALUE"]=> array(3) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "1" + %unicode|string%(1) "1" [2]=> - string(1) "1" + %unicode|string%(1) "1" } } Done diff --git a/ext/oci8/tests/fetch_all3.phpt b/ext/oci8/tests/fetch_all3.phpt index 4c0be1cc079b1..1748ea5658eb3 100644 --- a/ext/oci8/tests/fetch_all3.phpt +++ b/ext/oci8/tests/fetch_all3.phpt @@ -129,105 +129,105 @@ echo "Done\n"; None int(4) array(2) { - ["ID"]=> + [%u|b%"ID"]=> array(4) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "2" + %unicode|string%(1) "2" [2]=> - string(1) "3" + %unicode|string%(1) "3" [3]=> - string(1) "4" + %unicode|string%(1) "4" } - ["VALUE"]=> + [%u|b%"VALUE"]=> array(4) { [0]=> - string(2) "-1" + %unicode|string%(2) "-1" [1]=> - string(2) "-2" + %unicode|string%(2) "-2" [2]=> - string(2) "-3" + %unicode|string%(2) "-3" [3]=> - string(2) "-4" + %unicode|string%(2) "-4" } } OCI_ASSOC int(4) array(2) { - ["ID"]=> + [%u|b%"ID"]=> array(4) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "2" + %unicode|string%(1) "2" [2]=> - string(1) "3" + %unicode|string%(1) "3" [3]=> - string(1) "4" + %unicode|string%(1) "4" } - ["VALUE"]=> + [%u|b%"VALUE"]=> array(4) { [0]=> - string(2) "-1" + %unicode|string%(2) "-1" [1]=> - string(2) "-2" + %unicode|string%(2) "-2" [2]=> - string(2) "-3" + %unicode|string%(2) "-3" [3]=> - string(2) "-4" + %unicode|string%(2) "-4" } } OCI_FETCHSTATEMENT_BY_COLUMN int(4) array(2) { - ["ID"]=> + [%u|b%"ID"]=> array(4) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "2" + %unicode|string%(1) "2" [2]=> - string(1) "3" + %unicode|string%(1) "3" [3]=> - string(1) "4" + %unicode|string%(1) "4" } - ["VALUE"]=> + [%u|b%"VALUE"]=> array(4) { [0]=> - string(2) "-1" + %unicode|string%(2) "-1" [1]=> - string(2) "-2" + %unicode|string%(2) "-2" [2]=> - string(2) "-3" + %unicode|string%(2) "-3" [3]=> - string(2) "-4" + %unicode|string%(2) "-4" } } OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC int(4) array(2) { - ["ID"]=> + [%u|b%"ID"]=> array(4) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "2" + %unicode|string%(1) "2" [2]=> - string(1) "3" + %unicode|string%(1) "3" [3]=> - string(1) "4" + %unicode|string%(1) "4" } - ["VALUE"]=> + [%u|b%"VALUE"]=> array(4) { [0]=> - string(2) "-1" + %unicode|string%(2) "-1" [1]=> - string(2) "-2" + %unicode|string%(2) "-2" [2]=> - string(2) "-3" + %unicode|string%(2) "-3" [3]=> - string(2) "-4" + %unicode|string%(2) "-4" } } OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM @@ -236,24 +236,24 @@ array(2) { [0]=> array(4) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "2" + %unicode|string%(1) "2" [2]=> - string(1) "3" + %unicode|string%(1) "3" [3]=> - string(1) "4" + %unicode|string%(1) "4" } [1]=> array(4) { [0]=> - string(2) "-1" + %unicode|string%(2) "-1" [1]=> - string(2) "-2" + %unicode|string%(2) "-2" [2]=> - string(2) "-3" + %unicode|string%(2) "-3" [3]=> - string(2) "-4" + %unicode|string%(2) "-4" } } OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC @@ -262,24 +262,24 @@ array(2) { [0]=> array(4) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "2" + %unicode|string%(1) "2" [2]=> - string(1) "3" + %unicode|string%(1) "3" [3]=> - string(1) "4" + %unicode|string%(1) "4" } [1]=> array(4) { [0]=> - string(2) "-1" + %unicode|string%(2) "-1" [1]=> - string(2) "-2" + %unicode|string%(2) "-2" [2]=> - string(2) "-3" + %unicode|string%(2) "-3" [3]=> - string(2) "-4" + %unicode|string%(2) "-4" } } OCI_FETCHSTATEMENT_BY_ROW @@ -287,31 +287,31 @@ int(4) array(4) { [0]=> array(2) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(2) "-1" + [%u|b%"ID"]=> + %unicode|string%(1) "1" + [%u|b%"VALUE"]=> + %unicode|string%(2) "-1" } [1]=> array(2) { - ["ID"]=> - string(1) "2" - ["VALUE"]=> - string(2) "-2" + [%u|b%"ID"]=> + %unicode|string%(1) "2" + [%u|b%"VALUE"]=> + %unicode|string%(2) "-2" } [2]=> array(2) { - ["ID"]=> - string(1) "3" - ["VALUE"]=> - string(2) "-3" + [%u|b%"ID"]=> + %unicode|string%(1) "3" + [%u|b%"VALUE"]=> + %unicode|string%(2) "-3" } [3]=> array(2) { - ["ID"]=> - string(1) "4" - ["VALUE"]=> - string(2) "-4" + [%u|b%"ID"]=> + %unicode|string%(1) "4" + [%u|b%"VALUE"]=> + %unicode|string%(2) "-4" } } OCI_FETCHSTATEMENT_BY_ROW|OCI_ASSOC @@ -319,31 +319,31 @@ int(4) array(4) { [0]=> array(2) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(2) "-1" + [%u|b%"ID"]=> + %unicode|string%(1) "1" + [%u|b%"VALUE"]=> + %unicode|string%(2) "-1" } [1]=> array(2) { - ["ID"]=> - string(1) "2" - ["VALUE"]=> - string(2) "-2" + [%u|b%"ID"]=> + %unicode|string%(1) "2" + [%u|b%"VALUE"]=> + %unicode|string%(2) "-2" } [2]=> array(2) { - ["ID"]=> - string(1) "3" - ["VALUE"]=> - string(2) "-3" + [%u|b%"ID"]=> + %unicode|string%(1) "3" + [%u|b%"VALUE"]=> + %unicode|string%(2) "-3" } [3]=> array(2) { - ["ID"]=> - string(1) "4" - ["VALUE"]=> - string(2) "-4" + [%u|b%"ID"]=> + %unicode|string%(1) "4" + [%u|b%"VALUE"]=> + %unicode|string%(2) "-4" } } OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN @@ -351,31 +351,31 @@ int(4) array(4) { [0]=> array(2) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(2) "-1" + [%u|b%"ID"]=> + %unicode|string%(1) "1" + [%u|b%"VALUE"]=> + %unicode|string%(2) "-1" } [1]=> array(2) { - ["ID"]=> - string(1) "2" - ["VALUE"]=> - string(2) "-2" + [%u|b%"ID"]=> + %unicode|string%(1) "2" + [%u|b%"VALUE"]=> + %unicode|string%(2) "-2" } [2]=> array(2) { - ["ID"]=> - string(1) "3" - ["VALUE"]=> - string(2) "-3" + [%u|b%"ID"]=> + %unicode|string%(1) "3" + [%u|b%"VALUE"]=> + %unicode|string%(2) "-3" } [3]=> array(2) { - ["ID"]=> - string(1) "4" - ["VALUE"]=> - string(2) "-4" + [%u|b%"ID"]=> + %unicode|string%(1) "4" + [%u|b%"VALUE"]=> + %unicode|string%(2) "-4" } } OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC @@ -383,31 +383,31 @@ int(4) array(4) { [0]=> array(2) { - ["ID"]=> - string(1) "1" - ["VALUE"]=> - string(2) "-1" + [%u|b%"ID"]=> + %unicode|string%(1) "1" + [%u|b%"VALUE"]=> + %unicode|string%(2) "-1" } [1]=> array(2) { - ["ID"]=> - string(1) "2" - ["VALUE"]=> - string(2) "-2" + [%u|b%"ID"]=> + %unicode|string%(1) "2" + [%u|b%"VALUE"]=> + %unicode|string%(2) "-2" } [2]=> array(2) { - ["ID"]=> - string(1) "3" - ["VALUE"]=> - string(2) "-3" + [%u|b%"ID"]=> + %unicode|string%(1) "3" + [%u|b%"VALUE"]=> + %unicode|string%(2) "-3" } [3]=> array(2) { - ["ID"]=> - string(1) "4" - ["VALUE"]=> - string(2) "-4" + [%u|b%"ID"]=> + %unicode|string%(1) "4" + [%u|b%"VALUE"]=> + %unicode|string%(2) "-4" } } OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM @@ -416,30 +416,30 @@ array(4) { [0]=> array(2) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(2) "-1" + %unicode|string%(2) "-1" } [1]=> array(2) { [0]=> - string(1) "2" + %unicode|string%(1) "2" [1]=> - string(2) "-2" + %unicode|string%(2) "-2" } [2]=> array(2) { [0]=> - string(1) "3" + %unicode|string%(1) "3" [1]=> - string(2) "-3" + %unicode|string%(2) "-3" } [3]=> array(2) { [0]=> - string(1) "4" + %unicode|string%(1) "4" [1]=> - string(2) "-4" + %unicode|string%(2) "-4" } } OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC @@ -448,30 +448,30 @@ array(4) { [0]=> array(2) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(2) "-1" + %unicode|string%(2) "-1" } [1]=> array(2) { [0]=> - string(1) "2" + %unicode|string%(1) "2" [1]=> - string(2) "-2" + %unicode|string%(2) "-2" } [2]=> array(2) { [0]=> - string(1) "3" + %unicode|string%(1) "3" [1]=> - string(2) "-3" + %unicode|string%(2) "-3" } [3]=> array(2) { [0]=> - string(1) "4" + %unicode|string%(1) "4" [1]=> - string(2) "-4" + %unicode|string%(2) "-4" } } OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM @@ -480,30 +480,30 @@ array(4) { [0]=> array(2) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(2) "-1" + %unicode|string%(2) "-1" } [1]=> array(2) { [0]=> - string(1) "2" + %unicode|string%(1) "2" [1]=> - string(2) "-2" + %unicode|string%(2) "-2" } [2]=> array(2) { [0]=> - string(1) "3" + %unicode|string%(1) "3" [1]=> - string(2) "-3" + %unicode|string%(2) "-3" } [3]=> array(2) { [0]=> - string(1) "4" + %unicode|string%(1) "4" [1]=> - string(2) "-4" + %unicode|string%(2) "-4" } } OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM|OCI_ASSOC @@ -512,30 +512,30 @@ array(4) { [0]=> array(2) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(2) "-1" + %unicode|string%(2) "-1" } [1]=> array(2) { [0]=> - string(1) "2" + %unicode|string%(1) "2" [1]=> - string(2) "-2" + %unicode|string%(2) "-2" } [2]=> array(2) { [0]=> - string(1) "3" + %unicode|string%(1) "3" [1]=> - string(2) "-3" + %unicode|string%(2) "-3" } [3]=> array(2) { [0]=> - string(1) "4" + %unicode|string%(1) "4" [1]=> - string(2) "-4" + %unicode|string%(2) "-4" } } OCI_NUM @@ -544,24 +544,24 @@ array(2) { [0]=> array(4) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "2" + %unicode|string%(1) "2" [2]=> - string(1) "3" + %unicode|string%(1) "3" [3]=> - string(1) "4" + %unicode|string%(1) "4" } [1]=> array(4) { [0]=> - string(2) "-1" + %unicode|string%(2) "-1" [1]=> - string(2) "-2" + %unicode|string%(2) "-2" [2]=> - string(2) "-3" + %unicode|string%(2) "-3" [3]=> - string(2) "-4" + %unicode|string%(2) "-4" } } OCI_NUM|OCI_ASSOC @@ -570,24 +570,24 @@ array(2) { [0]=> array(4) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "2" + %unicode|string%(1) "2" [2]=> - string(1) "3" + %unicode|string%(1) "3" [3]=> - string(1) "4" + %unicode|string%(1) "4" } [1]=> array(4) { [0]=> - string(2) "-1" + %unicode|string%(2) "-1" [1]=> - string(2) "-2" + %unicode|string%(2) "-2" [2]=> - string(2) "-3" + %unicode|string%(2) "-3" [3]=> - string(2) "-4" + %unicode|string%(2) "-4" } } Done diff --git a/ext/oci8/tests/fetch_all4.phpt b/ext/oci8/tests/fetch_all4.phpt index 1d4a8df7b7c11..1d3c9677ee9c6 100644 --- a/ext/oci8/tests/fetch_all4.phpt +++ b/ext/oci8/tests/fetch_all4.phpt @@ -51,10 +51,10 @@ oci8_test_sql_execute($c, $stmtarray); Test 1 int(0) array(2) { - ["MYCOL1"]=> + [%u|b%"MYCOL1"]=> array(0) { } - ["MYCOL2"]=> + [%u|b%"MYCOL2"]=> array(0) { } } diff --git a/ext/oci8/tests/fetch_all5.phpt b/ext/oci8/tests/fetch_all5.phpt index d82fd30e41cdd..a6bb3c3f18a0d 100644 --- a/ext/oci8/tests/fetch_all5.phpt +++ b/ext/oci8/tests/fetch_all5.phpt @@ -62,45 +62,45 @@ oci_close($c); Test 1 int(3) array(2) { - ["MYCOL1"]=> + [%u|b%"MYCOL1"]=> array(3) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "2" + %unicode|string%(1) "2" [2]=> - string(1) "3" + %unicode|string%(1) "3" } - ["MYCOL2"]=> + [%u|b%"MYCOL2"]=> array(3) { [0]=> - string(3) "abc" + %unicode|string%(3) "abc" [1]=> - string(3) "def" + %unicode|string%(3) "def" [2]=> - string(3) "ghi" + %unicode|string%(3) "ghi" } } Test 1 int(3) array(2) { - ["MYCOL1"]=> + [%u|b%"MYCOL1"]=> array(3) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "2" + %unicode|string%(1) "2" [2]=> - string(1) "3" + %unicode|string%(1) "3" } - ["MYCOL2"]=> + [%u|b%"MYCOL2"]=> array(3) { [0]=> - string(3) "abc" + %unicode|string%(3) "abc" [1]=> - string(3) "def" + %unicode|string%(3) "def" [2]=> - string(3) "ghi" + %unicode|string%(3) "ghi" } } Test 3 diff --git a/ext/oci8/tests/fetch_into.phpt b/ext/oci8/tests/fetch_into.phpt index d90c4d95dcb26..45a6a8132ed12 100644 --- a/ext/oci8/tests/fetch_into.phpt +++ b/ext/oci8/tests/fetch_into.phpt @@ -53,19 +53,19 @@ echo "Done\n"; int(2) array(2) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "1" + %unicode|string%(1) "1" } int(2) array(4) { [0]=> - string(1) "1" - ["ID"]=> - string(1) "1" + %unicode|string%(1) "1" + [%u|b%"ID"]=> + %unicode|string%(1) "1" [1]=> - string(1) "1" - ["VALUE"]=> - string(1) "1" + %unicode|string%(1) "1" + [%u|b%"VALUE"]=> + %unicode|string%(1) "1" } Done diff --git a/ext/oci8/tests/fetch_object.phpt b/ext/oci8/tests/fetch_object.phpt index 73711baa1884e..1c290d5e953dd 100644 --- a/ext/oci8/tests/fetch_object.phpt +++ b/ext/oci8/tests/fetch_object.phpt @@ -82,28 +82,28 @@ oci8_test_sql_execute($c, $stmtarray); --EXPECTF-- Test 1 object(stdClass)#1 (3) { - ["caseSensitive"]=> - string(3) "123" - ["SECONDCOL"]=> - string(19) "1st row col2 string" - ["ANOTHERCOL"]=> - string(15) "1 more text " + [%u|b%"caseSensitive"]=> + %unicode|string%(3) "123" + [%u|b%"SECONDCOL"]=> + %unicode|string%(19) "1st row col2 string" + [%u|b%"ANOTHERCOL"]=> + %unicode|string%(15) "1 more text " } object(stdClass)#2 (3) { - ["caseSensitive"]=> - string(3) "456" - ["SECONDCOL"]=> - string(19) "2nd row col2 string" - ["ANOTHERCOL"]=> - string(15) "2 more text " + [%u|b%"caseSensitive"]=> + %unicode|string%(3) "456" + [%u|b%"SECONDCOL"]=> + %unicode|string%(19) "2nd row col2 string" + [%u|b%"ANOTHERCOL"]=> + %unicode|string%(15) "2 more text " } object(stdClass)#1 (3) { - ["caseSensitive"]=> - string(3) "789" - ["SECONDCOL"]=> - string(19) "3rd row col2 string" - ["ANOTHERCOL"]=> - string(15) "3 more text " + [%u|b%"caseSensitive"]=> + %unicode|string%(3) "789" + [%u|b%"SECONDCOL"]=> + %unicode|string%(19) "3rd row col2 string" + [%u|b%"ANOTHERCOL"]=> + %unicode|string%(15) "3 more text " } Test 2 123 diff --git a/ext/oci8/tests/fetch_row.phpt b/ext/oci8/tests/fetch_row.phpt index 40bc4f893cad5..2b28634ab3f01 100644 --- a/ext/oci8/tests/fetch_row.phpt +++ b/ext/oci8/tests/fetch_row.phpt @@ -46,20 +46,20 @@ echo "Done\n"; --EXPECTF-- array(2) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "1" + %unicode|string%(1) "1" } array(2) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "1" + %unicode|string%(1) "1" } array(2) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "1" + %unicode|string%(1) "1" } Done diff --git a/ext/oci8/tests/field_funcs1.phpt b/ext/oci8/tests/field_funcs1.phpt index 41d8627ce46cb..c14ee8957e709 100644 --- a/ext/oci8/tests/field_funcs1.phpt +++ b/ext/oci8/tests/field_funcs1.phpt @@ -85,9 +85,9 @@ echo "Done\n"; --EXPECTF-- array(2) { [0]=> - string(1) "1" + %unicode|string%(1) "1" [1]=> - string(1) "1" + %unicode|string%(1) "1" } Test 1 diff --git a/ext/oci8/tests/imp_res_1.phpt b/ext/oci8/tests/imp_res_1.phpt deleted file mode 100644 index a36f89f4da002..0000000000000 --- a/ext/oci8/tests/imp_res_1.phpt +++ /dev/null @@ -1,630 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: basic test ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - oci_fetch_assoc -array(2) { - ["C1"]=> - string(1) "1" - ["C2"]=> - string(5) "abcde" -} -array(2) { - ["C1"]=> - string(1) "2" - ["C2"]=> - string(5) "fghij" -} -array(2) { - ["C1"]=> - string(1) "3" - ["C2"]=> - string(5) "klmno" -} -array(1) { - ["C3"]=> - string(1) "t" -} -array(1) { - ["C3"]=> - string(1) "u" -} -array(1) { - [99]=> - string(2) "99" -} -array(2) { - ["NULL"]=> - NULL - ["'Z'"]=> - string(1) "Z" -} -array(2) { - ["C1"]=> - string(1) "1" - ["C2"]=> - string(5) "abcde" -} -array(2) { - ["C1"]=> - string(1) "2" - ["C2"]=> - string(5) "fghij" -} -array(2) { - ["C1"]=> - string(1) "3" - ["C2"]=> - string(5) "klmno" -} - -Test 2 - oci_fetch_object -object(stdClass)#%d (2) { - ["C1"]=> - string(1) "1" - ["C2"]=> - string(5) "abcde" -} -object(stdClass)#%d (2) { - ["C1"]=> - string(1) "2" - ["C2"]=> - string(5) "fghij" -} -object(stdClass)#%d (2) { - ["C1"]=> - string(1) "3" - ["C2"]=> - string(5) "klmno" -} -object(stdClass)#%d (1) { - ["C3"]=> - string(1) "t" -} -object(stdClass)#%d (1) { - ["C3"]=> - string(1) "u" -} -object(stdClass)#%d (1) { - [99]=> - string(2) "99" -} -object(stdClass)#%d (2) { - ["NULL"]=> - NULL - ["'Z'"]=> - string(1) "Z" -} -object(stdClass)#%d (2) { - ["C1"]=> - string(1) "1" - ["C2"]=> - string(5) "abcde" -} -object(stdClass)#%d (2) { - ["C1"]=> - string(1) "2" - ["C2"]=> - string(5) "fghij" -} -object(stdClass)#%d (2) { - ["C1"]=> - string(1) "3" - ["C2"]=> - string(5) "klmno" -} - -Test 3 - oci_fetch_row -array(2) { - [0]=> - string(1) "1" - [1]=> - string(5) "abcde" -} -array(2) { - [0]=> - string(1) "2" - [1]=> - string(5) "fghij" -} -array(2) { - [0]=> - string(1) "3" - [1]=> - string(5) "klmno" -} -array(1) { - [0]=> - string(1) "t" -} -array(1) { - [0]=> - string(1) "u" -} -array(1) { - [0]=> - string(2) "99" -} -array(2) { - [0]=> - NULL - [1]=> - string(1) "Z" -} -array(2) { - [0]=> - string(1) "1" - [1]=> - string(5) "abcde" -} -array(2) { - [0]=> - string(1) "2" - [1]=> - string(5) "fghij" -} -array(2) { - [0]=> - string(1) "3" - [1]=> - string(5) "klmno" -} - -Test 4 - oci_fetch_array(OCI_ASSOC+OCI_RETURN_NULLS) -array(2) { - ["C1"]=> - string(1) "1" - ["C2"]=> - string(5) "abcde" -} -array(2) { - ["C1"]=> - string(1) "2" - ["C2"]=> - string(5) "fghij" -} -array(2) { - ["C1"]=> - string(1) "3" - ["C2"]=> - string(5) "klmno" -} -array(1) { - ["C3"]=> - string(1) "t" -} -array(1) { - ["C3"]=> - string(1) "u" -} -array(1) { - [99]=> - string(2) "99" -} -array(2) { - ["NULL"]=> - NULL - ["'Z'"]=> - string(1) "Z" -} -array(2) { - ["C1"]=> - string(1) "1" - ["C2"]=> - string(5) "abcde" -} -array(2) { - ["C1"]=> - string(1) "2" - ["C2"]=> - string(5) "fghij" -} -array(2) { - ["C1"]=> - string(1) "3" - ["C2"]=> - string(5) "klmno" -} - -Test 5 - oci_fetch_array(OCI_ASSOC) -array(2) { - ["C1"]=> - string(1) "1" - ["C2"]=> - string(5) "abcde" -} -array(2) { - ["C1"]=> - string(1) "2" - ["C2"]=> - string(5) "fghij" -} -array(2) { - ["C1"]=> - string(1) "3" - ["C2"]=> - string(5) "klmno" -} -array(1) { - ["C3"]=> - string(1) "t" -} -array(1) { - ["C3"]=> - string(1) "u" -} -array(1) { - [99]=> - string(2) "99" -} -array(1) { - ["'Z'"]=> - string(1) "Z" -} -array(2) { - ["C1"]=> - string(1) "1" - ["C2"]=> - string(5) "abcde" -} -array(2) { - ["C1"]=> - string(1) "2" - ["C2"]=> - string(5) "fghij" -} -array(2) { - ["C1"]=> - string(1) "3" - ["C2"]=> - string(5) "klmno" -} - -Test 6 - oci_fetch_array(OCI_NUM) -array(2) { - [0]=> - string(1) "1" - [1]=> - string(5) "abcde" -} -array(2) { - [0]=> - string(1) "2" - [1]=> - string(5) "fghij" -} -array(2) { - [0]=> - string(1) "3" - [1]=> - string(5) "klmno" -} -array(1) { - [0]=> - string(1) "t" -} -array(1) { - [0]=> - string(1) "u" -} -array(1) { - [0]=> - string(2) "99" -} -array(1) { - [1]=> - string(1) "Z" -} -array(2) { - [0]=> - string(1) "1" - [1]=> - string(5) "abcde" -} -array(2) { - [0]=> - string(1) "2" - [1]=> - string(5) "fghij" -} -array(2) { - [0]=> - string(1) "3" - [1]=> - string(5) "klmno" -} - -Test 7 - oci_fetch_array(OCI_BOTH) -array(4) { - [0]=> - string(1) "1" - ["C1"]=> - string(1) "1" - [1]=> - string(5) "abcde" - ["C2"]=> - string(5) "abcde" -} -array(4) { - [0]=> - string(1) "2" - ["C1"]=> - string(1) "2" - [1]=> - string(5) "fghij" - ["C2"]=> - string(5) "fghij" -} -array(4) { - [0]=> - string(1) "3" - ["C1"]=> - string(1) "3" - [1]=> - string(5) "klmno" - ["C2"]=> - string(5) "klmno" -} -array(2) { - [0]=> - string(1) "t" - ["C3"]=> - string(1) "t" -} -array(2) { - [0]=> - string(1) "u" - ["C3"]=> - string(1) "u" -} -array(2) { - [0]=> - string(2) "99" - [99]=> - string(2) "99" -} -array(2) { - [1]=> - string(1) "Z" - ["'Z'"]=> - string(1) "Z" -} -array(4) { - [0]=> - string(1) "1" - ["C1"]=> - string(1) "1" - [1]=> - string(5) "abcde" - ["C2"]=> - string(5) "abcde" -} -array(4) { - [0]=> - string(1) "2" - ["C1"]=> - string(1) "2" - [1]=> - string(5) "fghij" - ["C2"]=> - string(5) "fghij" -} -array(4) { - [0]=> - string(1) "3" - ["C1"]=> - string(1) "3" - [1]=> - string(5) "klmno" - ["C2"]=> - string(5) "klmno" -} - -Test 8 - oci_fetch_array(OCI_BOTH+OCI_RETURN_NULLS) -array(4) { - [0]=> - string(1) "1" - ["C1"]=> - string(1) "1" - [1]=> - string(5) "abcde" - ["C2"]=> - string(5) "abcde" -} -array(4) { - [0]=> - string(1) "2" - ["C1"]=> - string(1) "2" - [1]=> - string(5) "fghij" - ["C2"]=> - string(5) "fghij" -} -array(4) { - [0]=> - string(1) "3" - ["C1"]=> - string(1) "3" - [1]=> - string(5) "klmno" - ["C2"]=> - string(5) "klmno" -} -array(2) { - [0]=> - string(1) "t" - ["C3"]=> - string(1) "t" -} -array(2) { - [0]=> - string(1) "u" - ["C3"]=> - string(1) "u" -} -array(2) { - [0]=> - string(2) "99" - [99]=> - string(2) "99" -} -array(4) { - [0]=> - NULL - ["NULL"]=> - NULL - [1]=> - string(1) "Z" - ["'Z'"]=> - string(1) "Z" -} -array(4) { - [0]=> - string(1) "1" - ["C1"]=> - string(1) "1" - [1]=> - string(5) "abcde" - ["C2"]=> - string(5) "abcde" -} -array(4) { - [0]=> - string(1) "2" - ["C1"]=> - string(1) "2" - [1]=> - string(5) "fghij" - ["C2"]=> - string(5) "fghij" -} -array(4) { - [0]=> - string(1) "3" - ["C1"]=> - string(1) "3" - [1]=> - string(5) "klmno" - ["C2"]=> - string(5) "klmno" -} -===DONE=== diff --git a/ext/oci8/tests/imp_res_2.phpt b/ext/oci8/tests/imp_res_2.phpt deleted file mode 100644 index 860a5fbb34e07..0000000000000 --- a/ext/oci8/tests/imp_res_2.phpt +++ /dev/null @@ -1,99 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: Zero Rows ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 -Test 2 -array(1) { - [0]=> - string(1) "X" -} -Test 2 -array(1) { - [0]=> - string(1) "X" -} -===DONE=== diff --git a/ext/oci8/tests/imp_res_3.phpt b/ext/oci8/tests/imp_res_3.phpt deleted file mode 100644 index 0fc4815893d6d..0000000000000 --- a/ext/oci8/tests/imp_res_3.phpt +++ /dev/null @@ -1,1257 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: bigger data size ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X - 1 a 1 a 1 a 1 a 1 a - 1 a 1 a 1 a 1 a 2 f - 1 a 1 a 1 a 2 f 1 a - 1 a 1 a 1 a 2 f 2 f - 1 a 1 a 2 f 1 a 1 a - 1 a 1 a 2 f 1 a 2 f - 1 a 1 a 2 f 2 f 1 a - 1 a 1 a 2 f 2 f 2 f - 1 a 2 f 1 a 1 a 1 a - 1 a 2 f 1 a 1 a 2 f - 1 a 2 f 1 a 2 f 1 a - 1 a 2 f 1 a 2 f 2 f - 1 a 2 f 2 f 1 a 1 a - 1 a 2 f 2 f 1 a 2 f - 1 a 2 f 2 f 2 f 1 a - 1 a 2 f 2 f 2 f 2 f - 2 f 1 a 1 a 1 a 1 a - 2 f 1 a 1 a 1 a 2 f - 2 f 1 a 1 a 2 f 1 a - 2 f 1 a 1 a 2 f 2 f - 2 f 1 a 2 f 1 a 1 a - 2 f 1 a 2 f 1 a 2 f - 2 f 1 a 2 f 2 f 1 a - 2 f 1 a 2 f 2 f 2 f - 2 f 2 f 1 a 1 a 1 a - 2 f 2 f 1 a 1 a 2 f - 2 f 2 f 1 a 2 f 1 a - 2 f 2 f 1 a 2 f 2 f - 2 f 2 f 2 f 1 a 1 a - 2 f 2 f 2 f 1 a 2 f - 2 f 2 f 2 f 2 f 1 a - 2 f 2 f 2 f 2 f 2 f - a - f - t - u - v - w - X -===DONE=== diff --git a/ext/oci8/tests/imp_res_4.phpt b/ext/oci8/tests/imp_res_4.phpt deleted file mode 100644 index 762ae7722491d..0000000000000 --- a/ext/oci8/tests/imp_res_4.phpt +++ /dev/null @@ -1,82 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_fetch ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - -Warning: oci_fetch(): ORA-24374: %s in %simp_res_4.php on line %d -bool(false) - -Test 2 -array(1) { - [0]=> - string(1) "1" -} - -Warning: oci_fetch(): ORA-24374: %s in %simp_res_4.php on line %d -bool(false) -array(1) { - [0]=> - string(1) "2" -} -===DONE=== diff --git a/ext/oci8/tests/imp_res_5.phpt b/ext/oci8/tests/imp_res_5.phpt deleted file mode 100644 index 564a7a37404ef..0000000000000 --- a/ext/oci8/tests/imp_res_5.phpt +++ /dev/null @@ -1,84 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_fetch_all ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - -Warning: oci_fetch_all(): ORA-24374: %s in %simp_res_5.php on line %d -array(0) { -} - -Test 2 -array(1) { - [0]=> - string(1) "1" -} - -Warning: oci_fetch_all(): ORA-24374: %s in %simp_res_5.php on line %d -array(0) { -} -array(1) { - [0]=> - string(1) "2" -} -===DONE=== diff --git a/ext/oci8/tests/imp_res_6.phpt b/ext/oci8/tests/imp_res_6.phpt deleted file mode 100644 index f94efe70db921..0000000000000 --- a/ext/oci8/tests/imp_res_6.phpt +++ /dev/null @@ -1,118 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: alternating oci_fetch_* calls ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 -array(2) { - ["C1"]=> - string(1) "1" - ["C2"]=> - string(1) "a" -} -array(2) { - [0]=> - string(1) "2" - [1]=> - string(1) "b" -} -object(stdClass)#%d (2) { - ["C1"]=> - string(1) "3" - ["C2"]=> - string(1) "c" -} -array(4) { - [0]=> - string(1) "4" - ["C1"]=> - string(1) "4" - [1]=> - string(1) "d" - ["C2"]=> - string(1) "d" -} -array(2) { - [0]=> - string(1) "5" - [1]=> - string(1) "e" -} -array(2) { - ["C1"]=> - string(1) "6" - ["C2"]=> - string(1) "f" -} -===DONE=== diff --git a/ext/oci8/tests/imp_res_7.phpt b/ext/oci8/tests/imp_res_7.phpt deleted file mode 100644 index 05ae5e6857940..0000000000000 --- a/ext/oci8/tests/imp_res_7.phpt +++ /dev/null @@ -1,873 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: bigger data size ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 - 21 - 22 - 23 - 24 - 25 - 26 - 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 - 36 - 37 - 38 - 39 - 40 - 41 - 42 - 43 - 44 - 45 - 46 - 47 - 48 - 49 - 50 - 51 - 52 - 53 - 54 - 55 - 56 - 57 - 58 - 59 - 60 - 61 - 62 - 63 - 64 - 65 - 66 - 67 - 68 - 69 - 70 - 71 - 72 - 73 - 74 - 75 - 76 - 77 - 78 - 79 - 80 - 81 - 82 - 83 - 84 - 85 - 86 - 87 - 88 - 89 - 90 - 91 - 92 - 93 - 94 - 95 - 96 - 97 - 98 - 99 - 100 - 101 - 102 - 103 - 104 - 105 - 106 - 107 - 108 - 109 - 110 - 111 - 112 - 113 - 114 - 115 - 116 - 117 - 118 - 119 - 120 - 121 - 122 - 123 - 124 - 125 - 126 - 127 - 128 - 129 - 130 - 131 - 132 - 133 - 134 - 135 - 136 - 137 - 138 - 139 - 140 - 141 - 142 - 143 - 144 - 145 - 146 - 147 - 148 - 149 - 150 - 151 - 152 - 153 - 154 - 155 - 156 - 157 - 158 - 159 - 160 - 161 - 162 - 163 - 164 - 165 - 166 - 167 - 168 - 169 - 170 - 171 - 172 - 173 - 174 - 175 - 176 - 177 - 178 - 179 - 180 - 181 - 182 - 183 - 184 - 185 - 186 - 187 - 188 - 189 - 190 - 191 - 192 - 193 - 194 - 195 - 196 - 197 - 198 - 199 - 200 - 201 - 202 - 203 - 204 - 205 - 206 - 207 - 208 - 209 - 210 - 211 - 212 - 213 - 214 - 215 - 216 - 217 - 218 - 219 - 220 - 221 - 222 - 223 - 224 - 225 - 226 - 227 - 228 - 229 - 230 - 231 - 232 - 233 - 234 - 235 - 236 - 237 - 238 - 239 - 240 - 241 - 242 - 243 - 244 - 245 - 246 - 247 - 248 - 249 - 250 - 251 - 252 - 253 - 254 - 255 - 256 - 257 - 258 - 259 - 260 - 261 - 262 - 263 - 264 - 265 - 266 - 267 - 268 - 269 - 270 - 271 - 272 - 273 - 274 - 275 -===DONE=== diff --git a/ext/oci8/tests/imp_res_call_error.phpt b/ext/oci8/tests/imp_res_call_error.phpt deleted file mode 100644 index 8b0fa78db91a9..0000000000000 --- a/ext/oci8/tests/imp_res_call_error.phpt +++ /dev/null @@ -1,61 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: using SQL 'CALL' ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - -Warning: oci_execute(): ORA-29478: %s -ORA-06512: at "SYS.DBMS_SQL", line %d -ORA-06512: at "SYS.DBMS_SQL", line %d -ORA-06512: at "SYSTEM.IMP_RES_CALL_ERR_PROC", line %d in %simp_res_call_error.php on line %d -===DONE=== diff --git a/ext/oci8/tests/imp_res_cancel.phpt b/ext/oci8/tests/imp_res_cancel.phpt deleted file mode 100644 index 663d630dfbeb0..0000000000000 --- a/ext/oci8/tests/imp_res_cancel.phpt +++ /dev/null @@ -1,68 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_cancel ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - 1 -bool(true) - 2 -bool(true) - 3 -bool(true) -===DONE=== diff --git a/ext/oci8/tests/imp_res_close.phpt b/ext/oci8/tests/imp_res_close.phpt deleted file mode 100644 index 01ac2c75e0018..0000000000000 --- a/ext/oci8/tests/imp_res_close.phpt +++ /dev/null @@ -1,69 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_free_statement #1 ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - 1 - 2 - -Warning: oci_fetch_array(): %d is not a valid oci8 statement resource in %simp_res_close.php on line %d -===DONE=== diff --git a/ext/oci8/tests/imp_res_cursor.phpt b/ext/oci8/tests/imp_res_cursor.phpt deleted file mode 100644 index cac0a5d1c0b7d..0000000000000 --- a/ext/oci8/tests/imp_res_cursor.phpt +++ /dev/null @@ -1,99 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: nested cursor ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - X - 1 abcde - 2 fghij - 3 klmno - - t - u -===DONE=== diff --git a/ext/oci8/tests/imp_res_dbmsoutput.phpt b/ext/oci8/tests/imp_res_dbmsoutput.phpt deleted file mode 100644 index 8c9808d96c332..0000000000000 --- a/ext/oci8/tests/imp_res_dbmsoutput.phpt +++ /dev/null @@ -1,136 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: interleaved with DBMS_OUTPUT ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 -array(2) { - [0]=> - string(18) "dbms_output Line 1" - [1]=> - string(18) "dbms_output Line 2" -} - 1 abcde - 2 fghij - 3 klmno - t - u - v - -Test 2 - 1 abcde - 2 fghij - 3 klmno - t - u - v -array(2) { - [0]=> - string(18) "dbms_output Line 1" - [1]=> - string(18) "dbms_output Line 2" -} -===DONE=== diff --git a/ext/oci8/tests/imp_res_field.phpt b/ext/oci8/tests/imp_res_field.phpt deleted file mode 100644 index 54b8295cf9284..0000000000000 --- a/ext/oci8/tests/imp_res_field.phpt +++ /dev/null @@ -1,227 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: field tests ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - Result set ".++$i."\n"; - print_fields($s1); - while (($r = oci_fetch_row($s1)) !== false) { - var_dump($r); - } -} - -echo "\nTest 5 - get IRS fields when fetching rows\n"; -$s = oci_parse($c, "begin imp_res_field_proc(); end;"); -oci_execute($s); -$i = 0; -while (($s1 = oci_get_implicit_resultset($s))) { - echo "===> Result set ".++$i."\n"; - while (($r = oci_fetch_row($s1)) !== false) { - var_dump($r); - print_fields($s1); - } -} - -// Clean up - -$stmtarray = array( - "drop procedure imp_res_field_proc", - "drop table imp_res_field_tab_1", - "drop table imp_res_field_tab_2", - "drop table imp_res_field_tab_3" -); - -oci8_test_sql_execute($c, $stmtarray); - -?> -===DONE=== - ---EXPECTF-- -Test 1 - can't get IRS fields from parent -num fields : 0 - -Test 2 - can't get IRS fields from parent when fetching -array(2) { - [0]=> - string(4) "1111" - [1]=> - string(5) "abcde" -} -num fields : 0 -array(1) { - [0]=> - string(4) "tttt" -} -num fields : 0 -array(1) { - [0]=> - string(2) "33" -} -num fields : 0 -array(1) { - [0]=> - NULL -} -num fields : 0 - -Test 3 - get IRS fields -num fields : 2 -C1_NUMBER : is_null F, precision 0, scale -127, size 22, typeraw 2, type NUMBER -C2_VARCHAR210 : is_null F, precision 0, scale 0, size 10, typeraw 1, type VARCHAR2 -num fields : 1 -C3_VARCHAR21 : is_null F, precision 0, scale 0, size 4, typeraw 1, type VARCHAR2 -num fields : 1 -C4_NUMBER52 : is_null F, precision 5, scale 2, size 22, typeraw 2, type NUMBER - -Test 4 - get IRS fields before fetching rows -===> Result set 1 -num fields : 2 -C1_NUMBER : is_null F, precision 0, scale -127, size 22, typeraw 2, type NUMBER -C2_VARCHAR210 : is_null F, precision 0, scale 0, size 10, typeraw 1, type VARCHAR2 -array(2) { - [0]=> - string(4) "1111" - [1]=> - string(5) "abcde" -} -===> Result set 2 -num fields : 1 -C3_VARCHAR21 : is_null F, precision 0, scale 0, size 4, typeraw 1, type VARCHAR2 -array(1) { - [0]=> - string(4) "tttt" -} -===> Result set 3 -num fields : 1 -C4_NUMBER52 : is_null F, precision 5, scale 2, size 22, typeraw 2, type NUMBER -array(1) { - [0]=> - string(2) "33" -} -array(1) { - [0]=> - NULL -} - -Test 5 - get IRS fields when fetching rows -===> Result set 1 -array(2) { - [0]=> - string(4) "1111" - [1]=> - string(5) "abcde" -} -num fields : 2 -C1_NUMBER : is_null F, precision 0, scale -127, size 22, typeraw 2, type NUMBER -C2_VARCHAR210 : is_null F, precision 0, scale 0, size 10, typeraw 1, type VARCHAR2 -===> Result set 2 -array(1) { - [0]=> - string(4) "tttt" -} -num fields : 1 -C3_VARCHAR21 : is_null F, precision 0, scale 0, size 4, typeraw 1, type VARCHAR2 -===> Result set 3 -array(1) { - [0]=> - string(2) "33" -} -num fields : 1 -C4_NUMBER52 : is_null F, precision 5, scale 2, size 22, typeraw 2, type NUMBER -array(1) { - [0]=> - NULL -} -num fields : 1 -C4_NUMBER52 : is_null T, precision 5, scale 2, size 22, typeraw 2, type NUMBER -===DONE=== diff --git a/ext/oci8/tests/imp_res_func_error.phpt b/ext/oci8/tests/imp_res_func_error.phpt deleted file mode 100644 index 73c0557930cd8..0000000000000 --- a/ext/oci8/tests/imp_res_func_error.phpt +++ /dev/null @@ -1,67 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: test with a PL/SQL function ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - -Warning: oci_execute(): ORA-29478: %s -ORA-06512: %s -ORA-06512: %s -ORA-06512: %s -===DONE=== diff --git a/ext/oci8/tests/imp_res_get_1.phpt b/ext/oci8/tests/imp_res_get_1.phpt deleted file mode 100644 index 665f773b57341..0000000000000 --- a/ext/oci8/tests/imp_res_get_1.phpt +++ /dev/null @@ -1,109 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: basic test ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - 1 abcde - 2 fghij - 3 klmno - t - u - X - -Test 2 - with execute - 1 abcde - 2 fghij - 3 klmno - t - u - X -===DONE=== diff --git a/ext/oci8/tests/imp_res_get_2.phpt b/ext/oci8/tests/imp_res_get_2.phpt deleted file mode 100644 index b20b8dd3970e8..0000000000000 --- a/ext/oci8/tests/imp_res_get_2.phpt +++ /dev/null @@ -1,107 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: similar to imp_res_get_1 but with unrolled loop ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - 1 abcde - 2 fghij - 3 klmno - t - u - X -===DONE=== diff --git a/ext/oci8/tests/imp_res_get_3.phpt b/ext/oci8/tests/imp_res_get_3.phpt deleted file mode 100644 index 15b2efaef0d91..0000000000000 --- a/ext/oci8/tests/imp_res_get_3.phpt +++ /dev/null @@ -1,267 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: basic test 3 ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---INI-- -oci8.statement_cache_size = 0 ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X - 1 abcde - 2 fghij - 3 klmno - t - u - X -===DONE=== diff --git a/ext/oci8/tests/imp_res_get_4.phpt b/ext/oci8/tests/imp_res_get_4.phpt deleted file mode 100644 index ea7fb8775a725..0000000000000 --- a/ext/oci8/tests/imp_res_get_4.phpt +++ /dev/null @@ -1,146 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: interleaved fetches ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - 1 abcde - t - 2 fghij - u - 3 klmno - v -Test 2 - too many fetches - 1 abcde - t - 2 fghij - u - 3 klmno - v -Return is false -Return is false - -Warning: oci_fetch_array(): ORA-01002: %s in %simp_res_get_4.php on line %d -Return is false - -Warning: oci_fetch_array(): ORA-01002: %s in %simp_res_get_4.php on line %d -Return is false -===DONE=== diff --git a/ext/oci8/tests/imp_res_get_5.phpt b/ext/oci8/tests/imp_res_get_5.phpt deleted file mode 100644 index 3cfa0967a211a..0000000000000 --- a/ext/oci8/tests/imp_res_get_5.phpt +++ /dev/null @@ -1,124 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: get from wrong statement ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - 3 - 4 - 5 - 6 - -Test 2 - fetch first IRS explicitly - 1 - 2 - 3 - 4 - 5 - 6 - -Test 3 - fetch part of IRS explicitly - 1 - 2 - 3 - 5 - 6 - 4 - -Test 4 - skip IRSs - 5 - 6 -===DONE=== diff --git a/ext/oci8/tests/imp_res_get_all.phpt b/ext/oci8/tests/imp_res_get_all.phpt deleted file mode 100644 index d2dcbea6c782f..0000000000000 --- a/ext/oci8/tests/imp_res_get_all.phpt +++ /dev/null @@ -1,120 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_fetch_all ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 -array(1) { - [1]=> - array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "2" - } -} -array(1) { - [3]=> - array(2) { - [0]=> - string(1) "3" - [1]=> - string(1) "4" - } -} -array(1) { - [5]=> - array(2) { - [0]=> - string(1) "5" - [1]=> - string(1) "6" - } -} - -Test 2 -array(1) { - [1]=> - array(2) { - [0]=> - string(1) "1" - [1]=> - string(1) "2" - } -} -array(1) { - [3]=> - array(2) { - [0]=> - string(1) "3" - [1]=> - string(1) "4" - } -} -array(1) { - [5]=> - array(2) { - [0]=> - string(1) "5" - [1]=> - string(1) "6" - } -} -===DONE=== diff --git a/ext/oci8/tests/imp_res_get_cancel.phpt b/ext/oci8/tests/imp_res_get_cancel.phpt deleted file mode 100644 index 7dbcecbfe9db7..0000000000000 --- a/ext/oci8/tests/imp_res_get_cancel.phpt +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_cancel ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - 1 - 3 -===DONE=== - diff --git a/ext/oci8/tests/imp_res_get_close_1.phpt b/ext/oci8/tests/imp_res_get_close_1.phpt deleted file mode 100644 index 2edc8bf604b8f..0000000000000 --- a/ext/oci8/tests/imp_res_get_close_1.phpt +++ /dev/null @@ -1,68 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_free_statement #1 ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - 1 - -Warning: oci_fetch_array(): %d is not a valid oci8 statement resource in %s on line %d - 3 - -Warning: oci_fetch_array(): %d is not a valid oci8 statement resource in %s on line %d - 5 - -Warning: oci_fetch_array(): %d is not a valid oci8 statement resource in %s on line %d -===DONE=== diff --git a/ext/oci8/tests/imp_res_get_close_2.phpt b/ext/oci8/tests/imp_res_get_close_2.phpt deleted file mode 100644 index b3153834babf3..0000000000000 --- a/ext/oci8/tests/imp_res_get_close_2.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_free_statement #2 ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - 1 - 2 - -Warning: oci_fetch_array(): OCI_INVALID_HANDLE in %s on line %d - -Warning: oci_get_implicit_resultset(): %d is not a valid oci8 statement resource in %s on line %d -===DONE=== diff --git a/ext/oci8/tests/imp_res_get_close_3.phpt b/ext/oci8/tests/imp_res_get_close_3.phpt deleted file mode 100644 index 4793a6c88207c..0000000000000 --- a/ext/oci8/tests/imp_res_get_close_3.phpt +++ /dev/null @@ -1,65 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_free_statement #3 ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - 1 - 2 - 3 - 4 - 5 - 6 -===DONE=== diff --git a/ext/oci8/tests/imp_res_get_cursor.phpt b/ext/oci8/tests/imp_res_get_cursor.phpt deleted file mode 100644 index ccdb6f549030d..0000000000000 --- a/ext/oci8/tests/imp_res_get_cursor.phpt +++ /dev/null @@ -1,101 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: nested cursor ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - 1 abcde - 2 fghij - 3 klmno - - t - u - X -===DONE=== diff --git a/ext/oci8/tests/imp_res_get_dbmsoutput.phpt b/ext/oci8/tests/imp_res_get_dbmsoutput.phpt deleted file mode 100644 index cbc2389e46885..0000000000000 --- a/ext/oci8/tests/imp_res_get_dbmsoutput.phpt +++ /dev/null @@ -1,156 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: interleaved with DBMS_OUTPUT ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 -array(3) { - [0]=> - string(6) "Line 1" - [1]=> - string(6) "Line 2" - [2]=> - string(6) "Line 3" -} - 1 abcde - 2 fghij - 3 klmno - t - u - v - X -Test 2 - 1 abcde - 2 fghij - 3 klmno - t - u - v - X -array(3) { - [0]=> - string(6) "Line 1" - [1]=> - string(6) "Line 2" - [2]=> - string(6) "Line 3" -} -===DONE=== - diff --git a/ext/oci8/tests/imp_res_get_exec.phpt b/ext/oci8/tests/imp_res_get_exec.phpt deleted file mode 100644 index dbd8f3ef3a20a..0000000000000 --- a/ext/oci8/tests/imp_res_get_exec.phpt +++ /dev/null @@ -1,55 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: Execute twice ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - 1 - 2 -===DONE=== diff --git a/ext/oci8/tests/imp_res_get_none.phpt b/ext/oci8/tests/imp_res_get_none.phpt deleted file mode 100644 index 981f4945e245a..0000000000000 --- a/ext/oci8/tests/imp_res_get_none.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: no implicit results ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 -bool(false) -===DONE=== diff --git a/ext/oci8/tests/imp_res_insert.phpt b/ext/oci8/tests/imp_res_insert.phpt deleted file mode 100644 index d9c0705b55419..0000000000000 --- a/ext/oci8/tests/imp_res_insert.phpt +++ /dev/null @@ -1,152 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: Commit modes ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - No commit in procedure, OCI_COMMIT_ON_SUCCESS mode -111 -array(1) { - [0]=> - string(3) "111" -} - -Test 2 - No commit in procedure, OCI_NO_AUTO_COMMIT mode -111 -222 -array(1) { - [0]=> - string(3) "111" -} - -Test 3 - Commit in procedure, OCI_COMMIT_ON_SUCCESS mode -111 -222 -333 -array(3) { - [0]=> - string(3) "111" - [1]=> - string(3) "222" - [2]=> - string(3) "333" -} - -Test 4 - Commit in procedure, OCI_NO_AUTO_COMMIT mode -111 -222 -333 -444 -array(4) { - [0]=> - string(3) "111" - [1]=> - string(3) "222" - [2]=> - string(3) "333" - [3]=> - string(3) "444" -} -===DONE=== diff --git a/ext/oci8/tests/imp_res_lob.phpt b/ext/oci8/tests/imp_res_lob.phpt deleted file mode 100644 index 247803581d215..0000000000000 --- a/ext/oci8/tests/imp_res_lob.phpt +++ /dev/null @@ -1,101 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: LOBs ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- -load(); - } else { - echo " " . $item; - } - } - echo "\n"; -} - -echo "\nTest 2 - don't fetch all rows\n"; -$s = oci_parse($c, "begin imp_res_lob_proc(); end;"); -oci_execute($s); -$row = oci_fetch_row($s); -foreach ($row as $item) { - if (is_object($item)) { - echo " " . $item->load(); - } else { - echo " " . $item; - } -} -echo "\n"; - -// Clean up - -$stmtarray = array( - "drop procedure imp_res_lob_proc", - "drop table imp_res_lob_tab", -); - -oci8_test_sql_execute($c, $stmtarray); - -?> -===DONE=== - ---EXPECTF-- -Test 1 - 1 aaaaa a - 2 bbbbb b - 3 ccccc c - 4 ddddd d - X - aaaaa - bbbbb - ccccc - ddddd - -Test 2 - don't fetch all rows - 1 aaaaa a -===DONE=== diff --git a/ext/oci8/tests/imp_res_prefetch.phpt b/ext/oci8/tests/imp_res_prefetch.phpt deleted file mode 100644 index 5acdd518e5843..0000000000000 --- a/ext/oci8/tests/imp_res_prefetch.phpt +++ /dev/null @@ -1,185 +0,0 @@ ---TEST-- -Oracle Database 12c Implicit Result Sets: basic test ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); -if (!(isset($matches[0]) && $matches[1] >= 12)) { - die("skip expected output only valid when using Oracle Database 12c or greater"); -} -preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); -if (!(isset($matches[0]) && $matches[0] >= 12)) { - die("skip works only with Oracle 12c or greater version of Oracle client libraries"); -} -?> ---FILE-- - -===DONE=== - ---EXPECTF-- -Test 1 - prefetch 0 -bool(true) -array(2) { - [0]=> - string(1) "1" - [1]=> - string(5) "abcde" -} -array(2) { - [0]=> - string(1) "2" - [1]=> - string(5) "fghij" -} -array(2) { - [0]=> - string(1) "3" - [1]=> - string(5) "klmno" -} -array(1) { - [0]=> - string(1) "t" -} -array(1) { - [0]=> - string(1) "u" -} -array(1) { - [0]=> - string(1) "v" -} - -Test 1 - prefetch 1 -bool(true) -array(2) { - [0]=> - string(1) "1" - [1]=> - string(5) "abcde" -} -array(2) { - [0]=> - string(1) "2" - [1]=> - string(5) "fghij" -} -array(2) { - [0]=> - string(1) "3" - [1]=> - string(5) "klmno" -} -array(1) { - [0]=> - string(1) "t" -} -array(1) { - [0]=> - string(1) "u" -} -array(1) { - [0]=> - string(1) "v" -} - -Test 1 - prefetch 2 -bool(true) -array(2) { - [0]=> - string(1) "1" - [1]=> - string(5) "abcde" -} -array(2) { - [0]=> - string(1) "2" - [1]=> - string(5) "fghij" -} -array(2) { - [0]=> - string(1) "3" - [1]=> - string(5) "klmno" -} -array(1) { - [0]=> - string(1) "t" -} -array(1) { - [0]=> - string(1) "u" -} -array(1) { - [0]=> - string(1) "v" -} -===DONE=== diff --git a/ext/oci8/tests/lob_015.phpt b/ext/oci8/tests/lob_015.phpt index 59e8fec42ae38..b4a19684a3950 100644 --- a/ext/oci8/tests/lob_015.phpt +++ b/ext/oci8/tests/lob_015.phpt @@ -48,7 +48,7 @@ Warning: oci_bind_by_name() expects at least 3 parameters, 2 given in %s on line Warning: oci_bind_by_name() expects at least 3 parameters, 1 given in %s on line %d -Warning: oci_execute(): ORA-00932: %s on line %d +Warning: oci_execute(): ORA-00932: %s NUMBER %s BLOB in %s on line %d object(OCI-Lob)#%d (1) { ["descriptor"]=> resource(%d) of type (oci8 descriptor) diff --git a/ext/oci8/tests/lob_temp2.phpt b/ext/oci8/tests/lob_temp2.phpt deleted file mode 100644 index d774b4d7249e3..0000000000000 --- a/ext/oci8/tests/lob_temp2.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Writing temporary lob before binding ---SKIPIF-- - true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -?> ---FILE-- -writeTemporary("test")); - -$statement = oci_parse($c, $ora_sql); -oci_bind_by_name($statement, ":v_clob", $clob, -1, OCI_B_CLOB); -oci_execute($statement, OCI_DEFAULT); - -$s = oci_parse($c, "select clob from ". $schema.$table_name); -oci_execute($s); -oci_fetch_all($s, $res); -var_dump($res); - -?> -===DONE=== ---EXPECTF-- -bool(true) -array(1) { - ["CLOB"]=> - array(1) { - [0]=> - string(4) "test" - } -} -===DONE=== diff --git a/ext/oci8/tests/minfo.phpt b/ext/oci8/tests/minfo.phpt index 34a19ca693ea5..f6b95ff296168 100644 --- a/ext/oci8/tests/minfo.phpt +++ b/ext/oci8/tests/minfo.phpt @@ -8,12 +8,12 @@ Code coverage for PHP_MINFO_FUNCTION(oci) ob_start(); phpinfo(INFO_MODULES); $v = ob_get_clean(); -$r = preg_match('/OCI8 Support .* enabled/', $v); -if ($r !== 1) - var_dump($r); +$r = strpos($v, 'OCI8 Support => enabled'); +var_dump($r); echo "Done\n"; ?> --EXPECTF-- +int(%d) Done diff --git a/ext/oci8/tests/password.phpt b/ext/oci8/tests/password.phpt index 8ea81d3fc0e0f..1738702cb6624 100644 --- a/ext/oci8/tests/password.phpt +++ b/ext/oci8/tests/password.phpt @@ -14,28 +14,28 @@ if ($test_drcp) die("skip password change not supported in DRCP Mode"); require(dirname(__FILE__)."/connect.inc"); $stmtarray = array( - "drop user testuser_pw cascade", - "create user testuser_pw identified by testuserpwd", - "grant connect, create session to testuser_pw" + "drop user testuser cascade", + "create user testuser identified by testuserpwd", + "grant connect, create session to testuser" ); oci8_test_sql_execute($c, $stmtarray); // Connect and change the password -$c1 = oci_connect("testuser_pw", "testuserpwd", $dbase); +$c1 = oci_connect("testuser", "testuserpwd", $dbase); var_dump($c1); $rn1 = (int)$c1; -oci_password_change($c1, "testuser_pw", "testuserpwd", "testuserpwd2"); +oci_password_change($c1, "testuser", "testuserpwd", "testuserpwd2"); // Second connect should return a new resource because the hash string will be different from $c1 -$c2 = oci_connect("testuser_pw", "testuserpwd2", $dbase); +$c2 = oci_connect("testuser", "testuserpwd2", $dbase); var_dump($c2); $rn2 = (int)$c2; // Despite using the old password this connect should succeed and return the original resource -$c3 = oci_connect("testuser_pw", "testuserpwd", $dbase); +$c3 = oci_connect("testuser", "testuserpwd", $dbase); var_dump($c3); $rn3 = (int)$c3; @@ -67,7 +67,7 @@ echo "Done\n"; require(dirname(__FILE__)."/connect.inc"); $stmtarray = array( - "drop user testuser_pw cascade" + "drop user testuser cascade" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/password_2.phpt b/ext/oci8/tests/password_2.phpt index 13da9ff7b269f..ceba0bba80d9c 100644 --- a/ext/oci8/tests/password_2.phpt +++ b/ext/oci8/tests/password_2.phpt @@ -14,27 +14,27 @@ if ($test_drcp) die("skip password change not supported in DRCP Mode"); require(dirname(__FILE__)."/connect.inc"); $stmtarray = array( - "drop user testuser_pw2 cascade", - "create user testuser_pw2 identified by testuserpwd", - "grant connect, create session to testuser_pw2" + "drop user testuser cascade", + "create user testuser identified by testuserpwd", + "grant connect, create session to testuser" ); oci8_test_sql_execute($c, $stmtarray); // Connect (persistent) and change the password -$c1 = oci_pconnect("testuser_pw2", "testuserpwd", $dbase); +$c1 = oci_pconnect("testuser", "testuserpwd", $dbase); var_dump($c1); $rn1 = (int)$c1; -oci_password_change($c1, "testuser_pw2", "testuserpwd", "testuserpwd2"); +oci_password_change($c1, "testuser", "testuserpwd", "testuserpwd2"); // Second connect should return a new resource because the hash string will be different from $c1 -$c2 = oci_pconnect("testuser_pw2", "testuserpwd2", $dbase); +$c2 = oci_pconnect("testuser", "testuserpwd2", $dbase); var_dump($c2); $rn2 = (int)$c2; // Despite using the old password this connect should succeed and return the original resource -$c3 = oci_pconnect("testuser_pw2", "testuserpwd", $dbase); +$c3 = oci_pconnect("testuser", "testuserpwd", $dbase); var_dump($c3); $rn3 = (int)$c3; @@ -66,7 +66,7 @@ echo "Done\n"; require(dirname(__FILE__)."/connect.inc"); $stmtarray = array( - "drop user testuser_pw2 cascade" + "drop user testuser cascade" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/password_new.phpt b/ext/oci8/tests/password_new.phpt index 2c66dd94ab7dc..c218d904fa2da 100644 --- a/ext/oci8/tests/password_new.phpt +++ b/ext/oci8/tests/password_new.phpt @@ -3,27 +3,15 @@ oci_password_change() --SKIPIF-- true, 'timesten' => false); // test runs on thes -require(dirname(__FILE__).'/connect.inc'); +require(dirname(__FILE__).'/skipif.inc'); if (empty($dbase)) die ("skip requires database connection string be set"); if ($test_drcp) die("skip password change not supported in DRCP Mode"); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv); -if (isset($matches_sv[1]) && $matches_sv[1] >= 11) { - preg_match('/([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); - if (isset($matches[0]) && $matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] < 5) { - die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)"); - } -} - -// This test in Oracle 12c needs a non-CDB or the root container -if (isset($matches_sv[1]) && $matches_sv[1] >= 12) { - $s = oci_parse($c, "select nvl(sys_context('userenv', 'con_name'), 'notacdb') as dbtype from dual"); - $r = @oci_execute($s); - if (!$r) - die('skip could not identify container type'); - $r = oci_fetch_array($s); - if ($r['DBTYPE'] !== 'CDB$ROOT') - die('skip cannot run test using a PDB'); +// This test is known to fail with Oracle 10.2.0.4 client libraries +// connecting to Oracle Database 11 (Oracle bug 6277160, fixed 10.2.0.5) +if (preg_match('/Release (11|12)\./', oci_server_version($c), $matches) === 1 && + preg_match('/^10\.2\.0\.[1234]/', oci_client_version()) === 1) { + die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)"); } ?> --FILE-- diff --git a/ext/oci8/tests/password_old.phpt b/ext/oci8/tests/password_old.phpt index 2e186528e3d9a..fdbb1f9e89232 100644 --- a/ext/oci8/tests/password_old.phpt +++ b/ext/oci8/tests/password_old.phpt @@ -3,28 +3,18 @@ ocipasswordchange() --SKIPIF-- true, 'timesten' => false); // test runs on thes -require(dirname(__FILE__).'/connect.inc'); +require(dirname(__FILE__).'/skipif.inc'); if (empty($dbase)) die ("skip requires database connection string be set"); if ($test_drcp) die("skip password change not supported in DRCP Mode"); -preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv); -if (isset($matches_sv[1]) && $matches_sv[1] >= 11) { - preg_match('/([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); - if (isset($matches[0]) && $matches[1] == 10 && $matches[2] == 2 && $matches[3] == 0 && $matches[4] < 5) { - die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)"); - } +// This test is known to fail with Oracle 10.2.0.4 client libraries +// connecting to Oracle Database 11 (Oracle bug 6277160, fixed 10.2.0.5) +if (preg_match('/Release (11|12)\./', oci_server_version($c), $matches) === 1 && + preg_match('/^10\.2\.0\.[1234]/', oci_client_version()) === 1) { + die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)"); } -// This test in Oracle 12c needs a non-CDB or the root container -if (isset($matches_sv[1]) && $matches_sv[1] >= 12) { - $s = oci_parse($c, "select nvl(sys_context('userenv', 'con_name'), 'notacdb') as dbtype from dual"); - $r = @oci_execute($s); - if (!$r) - die('skip could not identify container type'); - $r = oci_fetch_array($s); - if ($r['DBTYPE'] !== 'CDB$ROOT') - die('skip cannot run test using a PDB'); -} + ?> --FILE-- - string(%d) "test0" + %unicode|string%(%d) "test0" } Fetch Row using Nested cursor Query array(1) { [0]=> - string(%d) "test1" + %unicode|string%(%d) "test1" } Fetch Row using Nested cursor Query array(1) { [0]=> - string(%d) "test2" + %unicode|string%(%d) "test2" } Fetch Row using Nested cursor Query array(1) { [0]=> - string(%d) "test3" + %unicode|string%(%d) "test3" } Fetch Row using Nested cursor Query array(1) { [0]=> - string(%d) "test4" + %unicode|string%(%d) "test4" } Fetch Row using Nested cursor Query array(1) { [0]=> - string(%d) "test5" + %unicode|string%(%d) "test5" } Fetch Row using Nested cursor Query array(1) { [0]=> - string(%d) "test6" + %unicode|string%(%d) "test6" } Fetch Row using Nested cursor Query array(1) { [0]=> - string(%d) "test7" + %unicode|string%(%d) "test7" } Fetch Row using Nested cursor Query array(1) { [0]=> - string(%d) "test8" + %unicode|string%(%d) "test8" } Fetch Row using Nested cursor Query array(1) { [0]=> - string(%d) "test9" + %unicode|string%(%d) "test9" } Number of roundtrips made with prefetch count 5 for 10 rows is 3 Done diff --git a/ext/oci8/tests/reflection1.phpt b/ext/oci8/tests/reflection1.phpt index f76d7261aa78e..5f2e73d80bde4 100644 --- a/ext/oci8/tests/reflection1.phpt +++ b/ext/oci8/tests/reflection1.phpt @@ -126,7 +126,6 @@ reflection::export(new reflectionfunction('oci_set_module_name')); reflection::export(new reflectionfunction('oci_set_action')); reflection::export(new reflectionfunction('oci_set_client_info')); reflection::export(new reflectionfunction('oci_set_client_identifier')); -reflection::export(new reflectionfunction('oci_get_implicit_resultset')); ?> ===DONE=== @@ -1094,11 +1093,4 @@ Function [ function oci_set_client_identifier ] { } } -Function [ function oci_get_implicit_resultset ] { - - - Parameters [1] { - Parameter #0 [ $statement_resource ] - } -} - ===DONE=== diff --git a/ext/odbc/config.m4 b/ext/odbc/config.m4 index 14ec97bf364b9..5be3288f306b5 100644 --- a/ext/odbc/config.m4 +++ b/ext/odbc/config.m4 @@ -101,7 +101,7 @@ dnl configure options dnl if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(adabas,, -[ --with-adabas[=DIR] Include Adabas D support [/usr/local]]) +[ --with-adabas[=DIR] Include Adabas D support [/usr/local]]) if test "$PHP_ADABAS" != "no"; then AC_MSG_CHECKING([for Adabas support]) @@ -128,7 +128,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(sapdb,, -[ --with-sapdb[=DIR] Include SAP DB support [/usr/local]]) +[ --with-sapdb[=DIR] Include SAP DB support [/usr/local]]) if test "$PHP_SAPDB" != "no"; then AC_MSG_CHECKING([for SAP DB support]) @@ -146,7 +146,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(solid,, -[ --with-solid[=DIR] Include Solid support [/usr/local/solid]]) +[ --with-solid[=DIR] Include Solid support [/usr/local/solid]]) if test "$PHP_SOLID" != "no"; then AC_MSG_CHECKING(for Solid support) @@ -171,7 +171,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(ibm-db2,, -[ --with-ibm-db2[=DIR] Include IBM DB2 support [/home/db2inst1/sqllib]]) +[ --with-ibm-db2[=DIR] Include IBM DB2 support [/home/db2inst1/sqllib]]) if test "$PHP_IBM_DB2" != "no"; then AC_MSG_CHECKING(for IBM DB2 support) @@ -208,7 +208,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(ODBCRouter,, -[ --with-ODBCRouter[=DIR] Include ODBCRouter.com support [/usr]]) +[ --with-ODBCRouter[=DIR] Include ODBCRouter.com support [/usr]]) if test "$PHP_ODBCROUTER" != "no"; then AC_MSG_CHECKING(for ODBCRouter.com support) @@ -228,7 +228,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(empress,, -[ --with-empress[=DIR] Include Empress support [\$EMPRESSPATH] +[ --with-empress[=DIR] Include Empress support [\$EMPRESSPATH] (Empress Version >= 8.60 required)]) if test "$PHP_EMPRESS" != "no"; then @@ -291,7 +291,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(birdstep,, -[ --with-birdstep[=DIR] Include Birdstep support [/usr/local/birdstep]]) +[ --with-birdstep[=DIR] Include Birdstep support [/usr/local/birdstep]]) if test "$PHP_BIRDSTEP" != "no"; then AC_MSG_CHECKING(for Birdstep support) @@ -338,14 +338,15 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(custom-odbc,, -[ --with-custom-odbc[=DIR] Include user defined ODBC support. DIR is ODBC install base +[ --with-custom-odbc[=DIR] + Include user defined ODBC support. DIR is ODBC install base directory [/usr/local]. Make sure to define CUSTOM_ODBC_LIBS and have some odbc.h in your include dirs. f.e. you should define following for Sybase SQL Anywhere 5.5.00 on QNX, prior to running this configure script: - CPPFLAGS=\"-DODBC_QNX -DSQLANY_BUG\" - LDFLAGS=-lunix - CUSTOM_ODBC_LIBS=\"-ldblib -lodbc\"]) + CPPFLAGS=\"-DODBC_QNX -DSQLANY_BUG\" + LDFLAGS=-lunix + CUSTOM_ODBC_LIBS=\"-ldblib -lodbc\"]) if test "$PHP_CUSTOM_ODBC" != "no"; then AC_MSG_CHECKING(for a custom ODBC support) @@ -365,7 +366,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(iodbc,, -[ --with-iodbc[=DIR] Include iODBC support [/usr/local]]) +[ --with-iodbc[=DIR] Include iODBC support [/usr/local]]) if test "$PHP_IODBC" != "no"; then AC_MSG_CHECKING(for iODBC support) @@ -386,7 +387,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(esoob,, -[ --with-esoob[=DIR] Include Easysoft OOB support [/usr/local/easysoft/oob/client]]) +[ --with-esoob[=DIR] Include Easysoft OOB support [/usr/local/easysoft/oob/client]]) if test "$PHP_ESOOB" != "no"; then AC_MSG_CHECKING(for Easysoft ODBC-ODBC Bridge support) @@ -406,7 +407,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(unixODBC,, -[ --with-unixODBC[=DIR] Include unixODBC support [/usr/local]]) +[ --with-unixODBC[=DIR] Include unixODBC support [/usr/local]]) if test "$PHP_UNIXODBC" != "no"; then AC_MSG_CHECKING(for unixODBC support) @@ -427,7 +428,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(dbmaker,, -[ --with-dbmaker[=DIR] Include DBMaker support]) +[ --with-dbmaker[=DIR] Include DBMaker support]) if test "$PHP_DBMAKER" != "no"; then AC_MSG_CHECKING(for DBMaker support) diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index c84a4ecc60913..1e7166a5ec527 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -2704,7 +2704,7 @@ PHP_FUNCTION(odbc_num_rows) #if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) /* {{{ proto bool odbc_next_result(resource result_id) - Checks if multiple results are available */ + Checks if multiple results are avaiable */ PHP_FUNCTION(odbc_next_result) { odbc_result *result; diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index 7f874e7a4b89f..b8c381406b38d 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -558,52 +558,6 @@ static void zend_rebuild_access_path(zend_cfg *cfg, zend_op_array *op_array, int convert_to_string((v)); \ } -static void strip_nop(zend_code_block *block) -{ - zend_op *opline = block->start_opline; - zend_op *end, *new_end; - int new_len = 0; - - /* remove leading NOPs */ - while (block->len > 0 && block->start_opline->opcode == ZEND_NOP) { - if (block->len == 1) { - /* this block is all NOPs, join with following block */ - if (block->follow_to) { - delete_code_block(block); - } - return; - } - block->start_opline++; - block->start_opline_no++; - block->len--; - } - - /* strip the inside NOPs */ - opline = new_end = block->start_opline; - end = opline + block->len; - - while (opline < end) { - zend_op *src; - int len = 0; - - while (opline < end && opline->opcode == ZEND_NOP) { - opline++; - } - src = opline; - - while (opline < end && opline->opcode != ZEND_NOP) { - opline++; - } - len = opline - src; - - /* move up non-NOP opcodes */ - memmove(new_end, src, len*sizeof(zend_op)); - - new_end += len; - } - block->len = new_end - block->start_opline; -} - static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, char *used_ext TSRMLS_DC) { zend_op *opline = block->start_opline; @@ -1214,7 +1168,45 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, opline++; } - strip_nop(block); + /* remove leading NOPs */ + while (block->len > 0 && block->start_opline->opcode == ZEND_NOP) { + if (block->len == 1) { + /* this block is all NOPs, join with following block */ + if (block->follow_to) { + delete_code_block(block); + } + if (op_array->T) { + efree(Tsource); + } + return; + } + block->start_opline++; + block->start_opline_no++; + block->len--; + } + + /* strip the inside NOPs */ + opline = block->start_opline; + end = opline + block->len; + while (opline < end) { + if (opline->opcode == ZEND_NOP) { + zend_op *nop = opline + 1; + int noplen; + while (nop < end && nop->opcode == ZEND_NOP) { + nop++; + } + noplen = nop-opline; + if (nop < end) { + /* move up non-NOP opcodes */ + memmove(opline, nop, (end-nop)*sizeof(zend_op)); + } else { + /* all NOPs up to the end, do nothing */ + } + block->len -= noplen; + end = block->start_opline + block->len; + } + opline++; + } if (op_array->T) { efree(Tsource); diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index 8c8253757e06b..ec5a786577371 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -438,58 +438,6 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { #endif collect_constants = 0; break; - -#if ZEND_EXTENSION_API_NO >= PHP_5_5_X_API_NO - case ZEND_FETCH_R: - case ZEND_FETCH_W: - case ZEND_FETCH_RW: - case ZEND_FETCH_FUNC_ARG: - case ZEND_FETCH_IS: - case ZEND_FETCH_UNSET: - if (opline != op_array->opcodes && - (opline-1)->opcode == ZEND_BEGIN_SILENCE && - (opline->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_LOCAL && - opline->op1_type == IS_CONST && - opline->op2_type == IS_UNUSED && - Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING && - (Z_STRLEN(ZEND_OP1_LITERAL(opline)) != sizeof("this")-1 || - memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), "this", sizeof("this")) != 0)) { - - int var = opline->result.var; - int level = 0; - zend_op *op = opline + 1; - - while (op < end) { - if (op->opcode == ZEND_BEGIN_SILENCE) { - level++; - } else if (op->opcode == ZEND_END_SILENCE) { - if (level == 0) { - break; - } else { - level--; - } - } - if (op->op1_type == IS_VAR && op->op1.var == var) { - op->op1_type = IS_CV; - op->op1.var = zend_optimizer_lookup_cv(op_array, - Z_STRVAL(ZEND_OP1_LITERAL(opline)), - Z_STRLEN(ZEND_OP1_LITERAL(opline))); - MAKE_NOP(opline); - break; - } else if (op->op2_type == IS_VAR && op->op2.var == var) { - op->op2_type = IS_CV; - op->op2.var = zend_optimizer_lookup_cv(op_array, - Z_STRVAL(ZEND_OP1_LITERAL(opline)), - Z_STRLEN(ZEND_OP1_LITERAL(opline))); - MAKE_NOP(opline); - break; - } - op++; - } - } - break; -#endif - } opline++; i++; diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c index a058bd73cbb14..f3fbabcf81afa 100644 --- a/ext/opcache/Optimizer/zend_optimizer.c +++ b/ext/opcache/Optimizer/zend_optimizer.c @@ -59,35 +59,6 @@ static int zend_optimizer_get_collected_constant(HashTable *constants, zval *nam return 0; } -#if ZEND_EXTENSION_API_NO >= PHP_5_5_X_API_NO -static int zend_optimizer_lookup_cv(zend_op_array *op_array, char* name, int name_len) -{ - int i = 0; - ulong hash_value = zend_inline_hash_func(name, name_len+1); - - while (i < op_array->last_var) { - if (op_array->vars[i].name == name || - (op_array->vars[i].hash_value == hash_value && - op_array->vars[i].name_len == name_len && - memcmp(op_array->vars[i].name, name, name_len) == 0)) { - return i; - } - i++; - } - i = op_array->last_var; - op_array->last_var++; - op_array->vars = erealloc(op_array->vars, op_array->last_var * sizeof(zend_compiled_variable)); - if (IS_INTERNED(name)) { - op_array->vars[i].name = name; - } else { - op_array->vars[i].name = estrndup(name, name_len); - } - op_array->vars[i].name_len = name_len; - op_array->vars[i].hash_value = hash_value; - return i; -} -#endif - #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO int zend_optimizer_add_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC) { diff --git a/ext/opcache/README b/ext/opcache/README index 6c3cc746e77c0..311001224adae 100644 --- a/ext/opcache/README +++ b/ext/opcache/README @@ -199,10 +199,6 @@ opcache.protect_memory (default "0") Protect the shared memory from unexpected writing during script execution. Useful for internal debugging only. -opcache.restrict_api (default "") - Allows calling OPcache API functions only from PHP scripts which path is - started from specified string. The default "" means no restriction. - opcache.mmap_base Mapping base of shared memory segments (for Windows only). All the PHP processes have to map shared memory into the same address space. This diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 2c765f1be7267..38b2028cfa2c3 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -138,7 +138,7 @@ static inline int is_stream_path(const char *filename) return ((*p == ':') && (p - filename > 1) && (p[1] == '/') && (p[2] == '/')); } -static inline int is_cacheable_stream_path(const char *filename) +static inline int is_cachable_stream_path(const char *filename) { return memcmp(filename, "file://", sizeof("file://") - 1) == 0 || memcmp(filename, "phar://", sizeof("phar://") - 1) == 0; @@ -1459,7 +1459,7 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int CG(interactive) || (ZCSG(restart_in_progress) && accel_restart_is_active(TSRMLS_C)) || (is_stream_path(file_handle->filename) && - !is_cacheable_stream_path(file_handle->filename))) { + !is_cachable_stream_path(file_handle->filename))) { /* The Accelerator is disabled, act as if without the Accelerator */ return accelerator_orig_compile_file(file_handle, type TSRMLS_CC); } @@ -2167,9 +2167,7 @@ static void accel_fast_zval_ptr_dtor(zval **zval_ptr) case IS_CONSTANT_ARRAY: { TSRMLS_FETCH(); -#if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO GC_REMOVE_ZVAL_FROM_BUFFER(zvalue); -#endif if (zvalue->value.ht && (zvalue->value.ht != &EG(symbol_table))) { /* break possible cycles */ Z_TYPE_P(zvalue) = IS_NULL; @@ -2182,9 +2180,7 @@ static void accel_fast_zval_ptr_dtor(zval **zval_ptr) { TSRMLS_FETCH(); -#if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO GC_REMOVE_ZVAL_FROM_BUFFER(zvalue); -#endif Z_OBJ_HT_P(zvalue)->del_ref(zvalue TSRMLS_CC); } break; @@ -2660,9 +2656,12 @@ static void accel_free_ts_resources() #endif } -void accel_shutdown(TSRMLS_D) +static void accel_shutdown(zend_extension *extension) { zend_ini_entry *ini_entry; + TSRMLS_FETCH(); + + (void)extension; /* keep the compiler happy */ zend_accel_blacklist_shutdown(&accel_blacklist); @@ -2680,11 +2679,6 @@ void accel_shutdown(TSRMLS_D) } #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO -# ifndef ZTS - zend_hash_clean(CG(function_table)); - zend_hash_clean(CG(class_table)); - zend_hash_clean(EG(zend_constants)); -# endif CG(interned_strings_start) = orig_interned_strings_start; CG(interned_strings_end) = orig_interned_strings_end; zend_new_interned_string = orig_new_interned_string; @@ -2761,7 +2755,7 @@ ZEND_EXT_API zend_extension zend_extension_entry = { "http://www.zend.com/", /* URL */ "Copyright (c) 1999-2013", /* copyright */ accel_startup, /* startup */ - NULL, /* shutdown */ + accel_shutdown, /* shutdown */ accel_activate, /* per-script activation */ accel_deactivate, /* per-script deactivation */ NULL, /* message handler */ diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 38f2e060f6e2e..06a2cf7f4acac 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -27,7 +27,7 @@ #endif #define ACCELERATOR_PRODUCT_NAME "Zend OPcache" -#define ACCELERATOR_VERSION "7.0.3-dev" +#define ACCELERATOR_VERSION "7.0.2-dev" /* 2 - added Profiler support, on 20010712 */ /* 3 - added support for Optimizer's encoded-only-files mode */ /* 4 - works with the new Optimizer, that supports the file format with licenses */ @@ -232,7 +232,6 @@ typedef struct _zend_accel_directives { #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO long interned_strings_buffer; #endif - char *restrict_api; } zend_accel_directives; typedef struct _zend_accel_globals { @@ -317,7 +316,6 @@ extern zend_accel_globals accel_globals; extern char *zps_api_failure_reason; -void accel_shutdown(TSRMLS_D); void zend_accel_schedule_restart(zend_accel_restart_reason reason TSRMLS_DC); void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason TSRMLS_DC); int zend_accel_invalidate(const char *filename, int filename_len, zend_bool force TSRMLS_DC); diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4 index 1798fe13fa80d..f9c38b1f795e7 100644 --- a/ext/opcache/config.m4 +++ b/ext/opcache/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_ENABLE(opcache, whether to enable Zend OPcache support, -[ --enable-opcache Enable Zend OPcache support], yes) +[ --enable-opcache Enable Zend OPcache support], yes) if test "$PHP_OPCACHE" != "no"; then @@ -357,9 +357,7 @@ extern int lock_file; # endif #endif int main() { return 0; } -], -[AC_MSG_RESULT([done])], -[AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no])], []) +], [], [AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no])], []) PHP_NEW_EXTENSION(opcache, ZendAccelerator.c \ diff --git a/ext/opcache/tests/blacklist.inc b/ext/opcache/tests/blacklist.inc deleted file mode 100644 index a9db751419416..0000000000000 --- a/ext/opcache/tests/blacklist.inc +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/ext/opcache/tests/blacklist.phpt b/ext/opcache/tests/blacklist.phpt index 57e4c306dd7f7..f4a34723ada89 100644 --- a/ext/opcache/tests/blacklist.phpt +++ b/ext/opcache/tests/blacklist.phpt @@ -9,13 +9,7 @@ opcache.blacklist_filename={PWD}/opcache-*.blacklist --FILE-- --EXPECT-- Array @@ -23,10 +17,4 @@ Array [0] => /path/to/foo [1] => /path/to/foo2 [2] => /path/to/bar - [3] => __DIR__/blacklist.inc - [4] => __DIR__/current.php - [5] => /tmp/path/?nocache.inc - [6] => /tmp/path/*/somedir -) -ok -1 +) \ No newline at end of file diff --git a/ext/opcache/tests/compact_literals.phpt b/ext/opcache/tests/compact_literals.phpt index 367331f74255c..a691b912e37c8 100644 --- a/ext/opcache/tests/compact_literals.phpt +++ b/ext/opcache/tests/compact_literals.phpt @@ -22,7 +22,7 @@ unset($array["2"]); print_r($array); -echo "function define" . ":" . PHP_EOL; +echo "funcion define" . ":" . PHP_EOL; if (!function_exists("dummy")) { function dummy() { var_dump(__FUNCTION__); @@ -165,7 +165,7 @@ Array [1] => one [two] => 2 ) -function define: +funcion define: string(5) "dummy" string(11) "lambdadummy" string(1) "A" diff --git a/ext/opcache/tests/opcache-2.blacklist b/ext/opcache/tests/opcache-2.blacklist index 575d9fab304d9..4f6580a773b19 100644 --- a/ext/opcache/tests/opcache-2.blacklist +++ b/ext/opcache/tests/opcache-2.blacklist @@ -1,6 +1 @@ /path/to/bar -; wildcard and relative entires -blacklist.inc -./current.php -/tmp/path/?nocache.inc -/tmp/path/*/somedir diff --git a/ext/opcache/zend_accelerator_blacklist.c b/ext/opcache/zend_accelerator_blacklist.c index da83cfd3119e1..b09d0e54c3bf2 100644 --- a/ext/opcache/zend_accelerator_blacklist.c +++ b/ext/opcache/zend_accelerator_blacklist.c @@ -30,10 +30,6 @@ # include "main/php_regex.h" #endif -#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO -# include "ext/standard/php_string.h" -#endif - #ifdef ZEND_WIN32 # define REGEX_MODE (REG_EXTENDED|REG_NOSUB|REG_ICASE) #else @@ -90,9 +86,9 @@ static void blacklist_report_regexp_error(regex_t *comp_regex, int reg_err) static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist) { - int i, reg_err; + char *regexp; + int i, j, clen, reg_err, end = 0, rlen = 6; zend_regexp_list **regexp_list_it, *it; - char regexp[12*1024], *p, *end, *c, *backtrack = NULL; if (blacklist->pos == 0) { /* we have no blacklist to talk about */ @@ -100,91 +96,36 @@ static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist) } regexp_list_it = &(blacklist->regexp_list); + for (i = 0; i < blacklist->pos; i++) { + rlen += blacklist->entries[i].path_length * 2 + 2; - regexp[0] = '^'; - regexp[1] = '('; - p = regexp + 2; - end = regexp + sizeof(regexp) - sizeof("[^\\\\]*)\0"); - - for (i = 0; i < blacklist->pos; ) { - c = blacklist->entries[i].path; - if (p + blacklist->entries[i].path_length < end) { - while (*c && p < end) { - switch (*c) { - case '?': - c++; -#ifdef ZEND_WIN32 - p[0] = '['; /* * => [^\\] on Win32 */ - p[1] = '^'; - p[2] = '\\'; - p[3] = '\\'; - p[4] = ']'; - p += 5; -#else - p[0] = '['; /* * => [^/] on *nix */ - p[1] = '^'; - p[2] = '/'; - p[3] = ']'; - p += 4; -#endif - break; - case '*': - c++; - if (*c == '*') { - c++; - p[0] = '.'; /* ** => .* */ - p[1] = '*'; - p += 2; - } else { -#ifdef ZEND_WIN32 - p[0] = '['; /* * => [^\\]* on Win32 */ - p[1] = '^'; - p[2] = '\\'; - p[3] = '\\'; - p[4] = ']'; - p[5] = '*'; - p += 6; -#else - p[0] = '['; /* * => [^/]* on *nix */ - p[1] = '^'; - p[2] = '/'; - p[3] = ']'; - p[4] = '*'; - p += 5; -#endif - } - break; - case '^': - case '.': - case '[': - case ']': - case '$': - case '(': - case ')': - case '|': - case '+': - case '{': - case '}': - case '\\': - *p++ = '\\'; - /* break missing intentionally */ - default: - *p++ = *c++; - } + /* don't create a regexp buffer bigger than 12K)*/ + if ((i + 1 == blacklist->pos) || ((rlen + blacklist->entries[i + 1].path_length * 2 + 2) > (12 * 1024))) { + regexp = (char *)malloc(rlen); + if (!regexp) { + zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed\n"); + return; } - } + regexp[0] = '^'; + regexp[1] = '('; + + clen = 2; + for (j = end; j <= i; j++) { - if (*c || i == blacklist->pos - 1) { - if (*c) { - if (!backtrack) { - zend_accel_error(ACCEL_LOG_ERROR, "Too long blacklist entry\n"); + int c; + if (j != end) { + regexp[clen++] = '|'; + } + /* copy mangled filename */ + for (c = 0; c < blacklist->entries[j].path_length; c++) { + if (strchr("^.[]$()|*+?{}\\", blacklist->entries[j].path[c])) { + regexp[clen++] = '\\'; + } + regexp[clen++] = blacklist->entries[j].path[c]; } - p = backtrack; - } else { - i++; } - *p++ = ')'; - *p++ = '\0'; + regexp[clen++] = ')'; + regexp[clen] = '\0'; it = (zend_regexp_list*)malloc(sizeof(zend_regexp_list)); if (!it) { @@ -197,13 +138,11 @@ static void zend_accel_blacklist_update_regexp(zend_blacklist *blacklist) blacklist_report_regexp_error(&it->comp_regex, reg_err); } /* prepare for the next iteration */ - p = regexp + 2; + free(regexp); + end = i + 1; + rlen = 6; *regexp_list_it = it; regexp_list_it = &it->next; - } else { - backtrack = p; - *p++ = '|'; - i++; } } } @@ -243,9 +182,9 @@ static void zend_accel_blacklist_loadone(zend_blacklist *blacklist, char *filena void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename) #endif { - char buf[MAXPATHLEN + 1], real_path[MAXPATHLEN + 1], *blacklist_path = NULL; + char buf[MAXPATHLEN + 1], real_path[MAXPATHLEN + 1]; FILE *fp; - int path_length, blacklist_path_length; + int path_length; TSRMLS_FETCH(); if ((fp = fopen(filename, "r")) == NULL) { @@ -255,15 +194,6 @@ void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename) zend_accel_error(ACCEL_LOG_DEBUG,"Loading blacklist file: '%s'", filename); - if (VCWD_REALPATH(filename, buf)) { -#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO - blacklist_path_length = php_dirname(buf, strlen(buf)); -#else - blacklist_path_length = zend_dirname(buf, strlen(buf)); -#endif - blacklist_path = zend_strndup(buf, blacklist_path_length); - } - memset(buf, 0, sizeof(buf)); memset(real_path, 0, sizeof(real_path)); @@ -300,11 +230,7 @@ void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename) } path_dup = zend_strndup(pbuf, path_length); - if (blacklist_path) { - expand_filepath_ex(path_dup, real_path, blacklist_path, blacklist_path_length TSRMLS_CC); - } else { - expand_filepath(path_dup, real_path TSRMLS_CC); - } + expand_filepath(path_dup, real_path TSRMLS_CC); path_length = strlen(real_path); free(path_dup); @@ -321,9 +247,6 @@ void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename) blacklist->pos++; } fclose(fp); - if (blacklist_path) { - free(blacklist_path); - } zend_accel_blacklist_update_regexp(blacklist); } @@ -331,8 +254,7 @@ void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename) void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename) { glob_t globbuf; - int ret; - unsigned int i; + int ret, i; memset(&globbuf, 0, sizeof(glob_t)); diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index f9ddaa98b8ba0..fa4e3d85b78db 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -71,21 +71,6 @@ static zend_function_entry accel_functions[] = { { NULL, NULL, NULL, 0, 0 } }; -static int validate_api_restriction(TSRMLS_D) -{ - if (ZCG(accel_directives).restrict_api && *ZCG(accel_directives).restrict_api) { - int len = strlen(ZCG(accel_directives).restrict_api); - - if (!SG(request_info).path_translated || - strlen(SG(request_info).path_translated) < len || - memcmp(SG(request_info).path_translated, ZCG(accel_directives).restrict_api, len) != 0) { - zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " API is restricted by \"restrict_api\" configuration directive"); - return 0; - } - } - return 1; -} - static ZEND_INI_MH(OnUpdateMemoryConsumption) { long *p; @@ -266,7 +251,6 @@ ZEND_INI_BEGIN() STD_PHP_INI_BOOLEAN("opcache.enable_file_override" , "0" , PHP_INI_SYSTEM, OnUpdateBool, accel_directives.file_override_enabled, zend_accel_globals, accel_globals) STD_PHP_INI_BOOLEAN("opcache.enable_cli" , "0" , PHP_INI_SYSTEM, OnUpdateBool, accel_directives.enable_cli, zend_accel_globals, accel_globals) STD_PHP_INI_ENTRY("opcache.error_log" , "" , PHP_INI_SYSTEM, OnUpdateString, accel_directives.error_log, zend_accel_globals, accel_globals) - STD_PHP_INI_ENTRY("opcache.restrict_api" , "" , PHP_INI_SYSTEM, OnUpdateString, accel_directives.restrict_api, zend_accel_globals, accel_globals) #ifdef ZEND_WIN32 STD_PHP_INI_ENTRY("opcache.mmap_base", NULL, PHP_INI_SYSTEM, OnUpdateString, accel_directives.mmap_base, zend_accel_globals, accel_globals) @@ -394,7 +378,6 @@ static ZEND_MSHUTDOWN_FUNCTION(zend_accelerator) (void)type; /* keep the compiler happy */ UNREGISTER_INI_ENTRIES(); - accel_shutdown(TSRMLS_C); return SUCCESS; } @@ -533,10 +516,6 @@ static ZEND_FUNCTION(opcache_get_status) return; } - if (!validate_api_restriction(TSRMLS_C)) { - RETURN_FALSE; - } - if (!accel_startup_ok) { RETURN_FALSE; } @@ -607,10 +586,6 @@ static ZEND_FUNCTION(opcache_get_configuration) } #endif - if (!validate_api_restriction(TSRMLS_C)) { - RETURN_FALSE; - } - array_init(return_value); /* directives */ @@ -675,10 +650,6 @@ static ZEND_FUNCTION(opcache_reset) } #endif - if (!validate_api_restriction(TSRMLS_C)) { - RETURN_FALSE; - } - if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled)) { RETURN_FALSE; } @@ -699,10 +670,6 @@ static ZEND_FUNCTION(opcache_invalidate) return; } - if (!validate_api_restriction(TSRMLS_C)) { - RETURN_FALSE; - } - if (zend_accel_invalidate(script_name, script_name_len, force TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } else { diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index 39b4c1fc2558b..c24d9f1304517 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -936,7 +936,7 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, zend_hash_destroy(&ZCG(bind_hash)); } /* we must first to copy all classes and then prepare functions, since functions may try to bind - classes - which depend on pre-bind class entries existent in the class table */ + classes - which depend on pre-bind class entries existant in the class table */ if (zend_hash_num_elements(&persistent_script->function_table) > 0) { zend_accel_function_hash_copy(CG(function_table), &persistent_script->function_table, (unique_copy_ctor_func_t)zend_prepare_function_for_execution); } diff --git a/ext/openssl/config0.m4 b/ext/openssl/config0.m4 index a97114f8085f8..2c7f4fb691f44 100644 --- a/ext/openssl/config0.m4 +++ b/ext/openssl/config0.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(openssl, for OpenSSL support, -[ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.6)]) +[ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.6)]) PHP_ARG_WITH(kerberos, for Kerberos support, [ --with-kerberos[=DIR] OPENSSL: Include Kerberos support], no, no) diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 85731faa02beb..68f3aaf19bf42 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -35,9 +35,6 @@ #include "ext/standard/php_fopen_wrappers.h" #include "ext/standard/md5.h" #include "ext/standard/base64.h" -#ifdef PHP_WIN32 -# include "win32/winutil.h" -#endif /* OpenSSL includes */ #include @@ -1495,7 +1492,7 @@ PHP_FUNCTION(openssl_spki_verify) pkey = X509_PUBKEY_get(spki->spkac->pubkey); if (pkey == NULL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to acquire signed public key"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to aquire signed public key"); goto cleanup; } @@ -1552,7 +1549,7 @@ PHP_FUNCTION(openssl_spki_export) pkey = X509_PUBKEY_get(spki->spkac->pubkey); if (pkey == NULL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to acquire signed public key"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to aquire signed public key"); goto cleanup; } diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index 85d20fd297071..e9a72e3f3e421 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -309,7 +309,7 @@ static inline int php_openssl_setup_crypto(php_stream *stream, php_stream_xport_crypto_param *cparam TSRMLS_DC) { - const SSL_METHOD *method; + SSL_METHOD *method; long ssl_ctx_options = SSL_OP_ALL; if (sslsock->ssl_handle) { @@ -853,7 +853,7 @@ php_stream_ops php_openssl_socket_ops = { php_openssl_sockop_set_option, }; -static char * get_sni(php_stream_context *ctx, const char *resourcename, size_t resourcenamelen, int is_persistent TSRMLS_DC) { +static char * get_sni(php_stream_context *ctx, char *resourcename, long resourcenamelen, int is_persistent TSRMLS_DC) { php_url *url; @@ -900,8 +900,8 @@ static char * get_sni(php_stream_context *ctx, const char *resourcename, size_t return NULL; } -php_stream *php_openssl_ssl_socket_factory(const char *proto, size_t protolen, - const char *resourcename, size_t resourcenamelen, +php_stream *php_openssl_ssl_socket_factory(const char *proto, long protolen, + char *resourcename, long resourcenamelen, const char *persistent_id, int options, int flags, struct timeval *timeout, php_stream_context *context STREAMS_DC TSRMLS_DC) diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index b66f4722e8108..abe6b64aca528 100644 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -795,7 +795,7 @@ PHP_FUNCTION(pcntl_exec) snprintf(key, 100, "%ld", key_num); key_length = strlen(key); break; - case HASH_KEY_NON_EXISTENT: + case HASH_KEY_NON_EXISTANT: pair--; continue; } diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c index 574276b7ce2c2..abdee832235c9 100644 --- a/ext/pcntl/php_signal.c +++ b/ext/pcntl/php_signal.c @@ -23,7 +23,7 @@ #include "Zend/zend.h" #include "Zend/zend_signal.h" -/* php_signal using sigaction is derived from Advanced Programing +/* php_signal using sigaction is derrived from Advanced Programing * in the Unix Environment by W. Richard Stevens p 298. */ Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all) { diff --git a/ext/pcntl/tests/pcntl_exec.phpt b/ext/pcntl/tests/pcntl_exec.phpt index 9a2c96ea38a40..9d2ec1dcf5fad 100644 --- a/ext/pcntl/tests/pcntl_exec.phpt +++ b/ext/pcntl/tests/pcntl_exec.phpt @@ -8,7 +8,7 @@ if (!getenv("TEST_PHP_EXECUTABLE") || !is_executable(getenv("TEST_PHP_EXECUTABLE --FILE-- --EXPECT-- diff --git a/ext/pcntl/tests/pcntl_exec_2.phpt b/ext/pcntl/tests/pcntl_exec_2.phpt index e18527dba05cc..02b5e22aa4294 100644 --- a/ext/pcntl/tests/pcntl_exec_2.phpt +++ b/ext/pcntl/tests/pcntl_exec_2.phpt @@ -14,7 +14,7 @@ if (getenv("PCNTL_EXEC_TEST_IS_CHILD")) { exit; } echo "ok\n"; -pcntl_exec(getenv("TEST_PHP_EXECUTABLE"), array('-n', __FILE__), array( +pcntl_exec(getenv("TEST_PHP_EXECUTABLE"), array(__FILE__), array( b"PCNTL_EXEC_TEST_IS_CHILD" => b"1", b"FOO" => b"BAR", 1 => b"long") diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index cf296fc434c9f..7d34d9feb15a8 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -233,7 +233,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le int coptions = 0; int soptions = 0; const char *error; - int erroffset; + int erroffset; char delimiter; char start_delimiter; char end_delimiter; @@ -399,7 +399,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le re = pcre_compile(pattern, coptions, &error, - (int *) &erroffset, + &erroffset, tables); if (re == NULL) { @@ -508,7 +508,7 @@ PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *pr /* }}} */ /* {{{ add_offset_pair */ -static inline void add_offset_pair(zval *result, char *str, zend_str_size_int len, long offset, char *name) +static inline void add_offset_pair(zval *result, char *str, int len, int offset, char *name) { zval *match_pair; @@ -533,24 +533,24 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ * /* parameters */ char *regex; /* Regular expression */ char *subject; /* String to match against */ - zend_str_size regex_len; - zend_str_size subject_len; + int regex_len; + int subject_len; pcre_cache_entry *pce; /* Compiled regular expression */ zval *subpats = NULL; /* Array for subpatterns */ long flags = 0; /* Match control flags */ long start_offset = 0; /* Where the new search starts */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|zll", ®ex, ®ex_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|zll", ®ex, ®ex_len, &subject, &subject_len, &subpats, &flags, &start_offset) == FAILURE) { RETURN_FALSE; } /* Compile regex or get it from cache. */ - if ((pce = pcre_get_compiled_regex_cache(regex, (int) regex_len TSRMLS_CC)) == NULL) { + if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) { RETURN_FALSE; } - php_pcre_match_impl(pce, subject, (int) subject_len, return_value, subpats, + php_pcre_match_impl(pce, subject, subject_len, return_value, subpats, global, ZEND_NUM_ARGS() >= 4, flags, start_offset TSRMLS_CC); } /* }}} */ @@ -860,7 +860,7 @@ static int preg_do_repl_func(zval *function, char *subject, int *offsets, char * zval *retval_ptr; /* Function return value */ zval **args[1]; /* Argument to pass to function */ zval *subpats; /* Captured subpatterns */ - int result_len; /* Return value length */ + int result_len; /* Return value length */ int i; MAKE_STD_ZVAL(subpats); @@ -875,8 +875,8 @@ static int preg_do_repl_func(zval *function, char *subject, int *offsets, char * if (call_user_function_ex(EG(function_table), NULL, function, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) { convert_to_string_ex(&retval_ptr); - *result = estrndup(Z_STRVAL_P(retval_ptr), Z_STRSIZE_P(retval_ptr)); - result_len = Z_STRSIZE_P(retval_ptr); + *result = estrndup(Z_STRVAL_P(retval_ptr), Z_STRLEN_P(retval_ptr)); + result_len = Z_STRLEN_P(retval_ptr); zval_ptr_dtor(&retval_ptr); } else { if (!EG(exception)) { @@ -904,10 +904,10 @@ static int preg_do_eval(char *eval_str, int eval_str_len, char *subject, *walk, /* Used to walk the code string */ *segment, /* Start of segment to append while walking */ walk_last; /* Last walked character */ - zend_str_size match_len; /* Length of the match */ - zend_str_size esc_match_len; /* Length of the quote-escaped match */ - zend_str_size result_len; /* Length of the result of the evaluation */ - int backref; /* Current backref */ + int match_len; /* Length of the match */ + int esc_match_len; /* Length of the quote-escaped match */ + int result_len; /* Length of the result of the evaluation */ + int backref; /* Current backref */ char *compiled_string_description; smart_str code = {0}; @@ -969,8 +969,8 @@ static int preg_do_eval(char *eval_str, int eval_str_len, char *subject, convert_to_string(&retval); /* Save the return value and its length */ - *result = estrndup(Z_STRVAL(retval), Z_STRSIZE(retval)); - result_len = Z_STRSIZE(retval); + *result = estrndup(Z_STRVAL(retval), Z_STRLEN(retval)); + result_len = Z_STRLEN(retval); /* Clean up */ zval_dtor(&retval); @@ -1007,7 +1007,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub pcre_extra extra_data; /* Used locally for exec options */ int exoptions = 0; /* Execution options */ int count = 0; /* Count of matched subpatterns */ - int *offsets; /* Array of subpattern offsets */ + int *offsets; /* Array of subpattern offsets */ char **subpat_names; /* Array for named subpatterns */ int num_subpats; /* Number of captured subpatterns */ int size_offsets; /* Size of the offsets array */ @@ -1048,7 +1048,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub } } else { replace = Z_STRVAL_P(replace_val); - replace_len = Z_STRSIZE_P(replace_val); + replace_len = Z_STRLEN_P(replace_val); replace_end = replace + replace_len; } @@ -1261,8 +1261,8 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, /* If regex is an array */ if (Z_TYPE_P(regex) == IS_ARRAY) { /* Duplicate subject string for repeated replacement */ - subject_value = estrndup(Z_STRVAL_PP(subject), Z_STRSIZE_PP(subject)); - subject_len = Z_STRSIZE_PP(subject); + subject_value = estrndup(Z_STRVAL_PP(subject), Z_STRLEN_PP(subject)); + subject_len = Z_STRLEN_PP(subject); *result_len = subject_len; zend_hash_internal_pointer_reset(Z_ARRVAL_P(regex)); @@ -1294,7 +1294,7 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, /* Do the actual replacement and put the result back into subject_value for further replacements. */ if ((result = php_pcre_replace(Z_STRVAL_PP(regex_entry), - Z_STRSIZE_PP(regex_entry), + Z_STRLEN_PP(regex_entry), subject_value, subject_len, replace_value, @@ -1316,9 +1316,9 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, return subject_value; } else { result = php_pcre_replace(Z_STRVAL_P(regex), - Z_STRSIZE_P(regex), + Z_STRLEN_P(regex), Z_STRVAL_PP(subject), - Z_STRSIZE_PP(subject), + Z_STRLEN_PP(subject), replace, is_callable_replace, result_len, @@ -1339,7 +1339,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl **subject_entry, **zcount = NULL; char *result; - int result_len; + int result_len; int limit_val = -1; long limit = -1; char *string_key; @@ -1397,11 +1397,11 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl switch(zend_hash_get_current_key(Z_ARRVAL_PP(subject), &string_key, &num_key, 0)) { case HASH_KEY_IS_STRING: - add_assoc_stringl(return_value, string_key, result, (zend_str_size) result_len, 0); + add_assoc_stringl(return_value, string_key, result, result_len, 0); break; case HASH_KEY_IS_LONG: - add_index_stringl(return_value, num_key, result, (zend_str_size) result_len, 0); + add_index_stringl(return_value, num_key, result, result_len, 0); break; } } else { @@ -1415,7 +1415,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl old_replace_count = replace_count; if ((result = php_replace_in_subject(*regex, *replace, subject, &result_len, limit_val, is_callable_replace, &replace_count TSRMLS_CC)) != NULL) { if (!is_filter || replace_count > old_replace_count) { - RETVAL_STRINGL(result, (zend_str_size) result_len, 0); + RETVAL_STRINGL(result, result_len, 0); } else { efree(result); } @@ -1459,24 +1459,24 @@ static PHP_FUNCTION(preg_split) { char *regex; /* Regular expression */ char *subject; /* String to match against */ - zend_str_size regex_len; - zend_str_size subject_len; + int regex_len; + int subject_len; long limit_val = -1;/* Integer value of limit */ long flags = 0; /* Match control flags */ pcre_cache_entry *pce; /* Compiled regular expression */ /* Get function parameters and do error checking */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ll", ®ex, ®ex_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ll", ®ex, ®ex_len, &subject, &subject_len, &limit_val, &flags) == FAILURE) { RETURN_FALSE; } /* Compile regex or get it from cache. */ - if ((pce = pcre_get_compiled_regex_cache(regex, (int) regex_len TSRMLS_CC)) == NULL) { + if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) { RETURN_FALSE; } - php_pcre_split_impl(pce, subject, (int) subject_len, return_value, limit_val, flags TSRMLS_CC); + php_pcre_split_impl(pce, subject, subject_len, return_value, limit_val, flags TSRMLS_CC); } /* }}} */ @@ -1653,10 +1653,10 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec Quote regular expression characters plus an optional character */ static PHP_FUNCTION(preg_quote) { - zend_str_size in_str_len; + int in_str_len; char *in_str; /* Input string argument */ char *in_str_end; /* End of the input string */ - zend_str_size delim_len = 0; + int delim_len = 0; char *delim = NULL; /* Additional delimiter argument */ char *out_str, /* Output string with quoted characters */ *p, /* Iterator for input string */ @@ -1666,7 +1666,7 @@ static PHP_FUNCTION(preg_quote) zend_bool quote_delim = 0; /* Whether to quote additional delim char */ /* Get the arguments and check for errors */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &in_str, &in_str_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &in_str, &in_str_len, &delim, &delim_len) == FAILURE) { return; } @@ -1741,19 +1741,19 @@ static PHP_FUNCTION(preg_quote) static PHP_FUNCTION(preg_grep) { char *regex; /* Regular expression */ - zend_str_size regex_len; + int regex_len; zval *input; /* Input array */ long flags = 0; /* Match control flags */ pcre_cache_entry *pce; /* Compiled regular expression */ /* Get arguments and do error checking */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sa|l", ®ex, ®ex_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa|l", ®ex, ®ex_len, &input, &flags) == FAILURE) { return; } /* Compile regex or get it from cache. */ - if ((pce = pcre_get_compiled_regex_cache(regex, (int) regex_len TSRMLS_CC)) == NULL) { + if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) { RETURN_FALSE; } @@ -1810,7 +1810,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return /* Perform the match */ count = pcre_exec(pce->re, extra, Z_STRVAL(subject), - Z_STRSIZE(subject), 0, + Z_STRLEN(subject), 0, 0, offsets, size_offsets); /* Check for too many substrings condition. */ diff --git a/ext/pcre/tests/preg_grep_error1.phpt b/ext/pcre/tests/preg_grep_error1.phpt index ae2eb128ba09b..29dfc5af1e4fb 100644 --- a/ext/pcre/tests/preg_grep_error1.phpt +++ b/ext/pcre/tests/preg_grep_error1.phpt @@ -11,9 +11,9 @@ error_reporting(E_ALL&~E_NOTICE); * Testing how preg_grep reacts to being passed bad regexes */ echo "*** Testing preg_grep() : error conditions ***\n"; -$values = array('abcdef', //Regex without delimiter -'/[a-zA-Z]', //Regex without closing delimiter -'[a-zA-Z]/', //Regex without opening delimiter +$values = array('abcdef', //Regex without delimeter +'/[a-zA-Z]', //Regex without closing delimeter +'[a-zA-Z]/', //Regex without opening delimeter '/[a-zA-Z]/F', array('[a-z]', //Array of Regexes '[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string ); diff --git a/ext/pcre/tests/preg_match_all_error1.phpt b/ext/pcre/tests/preg_match_all_error1.phpt index 95ab905d7d4cb..a3cb684044d38 100644 --- a/ext/pcre/tests/preg_match_all_error1.phpt +++ b/ext/pcre/tests/preg_match_all_error1.phpt @@ -11,9 +11,9 @@ error_reporting(E_ALL&~E_NOTICE); * Testing how preg_match_all reacts to being passed the wrong type of regex argument */ echo "*** Testing preg_match_all() : error conditions ***\n"; -$regex_array = array('abcdef', //Regex without delimiter -'/[a-zA-Z]', //Regex without closing delimiter -'[a-zA-Z]/', //Regex without opening delimiter +$regex_array = array('abcdef', //Regex without delimeter +'/[a-zA-Z]', //Regex without closing delimeter +'[a-zA-Z]/', //Regex without opening delimeter '/[a-zA-Z]/F', array('[a-z]', //Array of Regexes '[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string ); diff --git a/ext/pcre/tests/preg_match_error1.phpt b/ext/pcre/tests/preg_match_error1.phpt index ec9cf8cec8cdb..7630481517a17 100644 --- a/ext/pcre/tests/preg_match_error1.phpt +++ b/ext/pcre/tests/preg_match_error1.phpt @@ -11,9 +11,9 @@ error_reporting(E_ALL&~E_NOTICE); * Testing how preg_match reacts to being passed the wrong type of regex argument */ echo "*** Testing preg_match() : error conditions ***\n"; -$regex_array = array('abcdef', //Regex without delimiter -'/[a-zA-Z]', //Regex without closing delimiter -'[a-zA-Z]/', //Regex without opening delimiter +$regex_array = array('abcdef', //Regex without delimeter +'/[a-zA-Z]', //Regex without closing delimeter +'[a-zA-Z]/', //Regex without opening delimeter '/[a-zA-Z]/F', array('[a-z]', //Array of Regexes '[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string ); diff --git a/ext/pcre/tests/preg_replace_error1.phpt b/ext/pcre/tests/preg_replace_error1.phpt index ec573c77bfa13..7ddfcfdef8628 100644 --- a/ext/pcre/tests/preg_replace_error1.phpt +++ b/ext/pcre/tests/preg_replace_error1.phpt @@ -11,9 +11,9 @@ error_reporting(E_ALL&~E_NOTICE); * Testing how preg_replace reacts to being passed the wrong type of regex argument */ echo "*** Testing preg_replace() : error conditions***\n"; -$regex_array = array('abcdef', //Regex without delimiter -'/[a-zA-Z]', //Regex without closing delimiter -'[a-zA-Z]/', //Regex without opening delimiter +$regex_array = array('abcdef', //Regex without delimeter +'/[a-zA-Z]', //Regex without closing delimeter +'[a-zA-Z]/', //Regex without opening delimeter '/[a-zA-Z]/F', array('[a-z]', //Array of Regexes '[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string ); diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 9ac913bea06c5..833c608f66839 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -899,7 +899,7 @@ static PHP_METHOD(PDO, getAttribute) PDO_DBH_CLEAR_ERR(); PDO_CONSTRUCT_CHECK; - /* handle generic PDO-level attributes */ + /* handle generic PDO-level atributes */ switch (attr) { case PDO_ATTR_PERSISTENT: RETURN_BOOL(dbh->is_persistent); diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c index b49ad2691f645..9ed5087369621 100644 --- a/ext/pdo_dblib/dblib_driver.c +++ b/ext/pdo_dblib/dblib_driver.c @@ -274,13 +274,9 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ ,{"5.0",DBVERSION_70} /* FIXME: This does not work with Sybase, but environ will */ ,{"6.0",DBVERSION_70} ,{"7.0",DBVERSION_70} -#ifdef DBVERSION_71 ,{"7.1",DBVERSION_71} -#endif -#ifdef DBVERSION_72 ,{"7.2",DBVERSION_72} ,{"8.0",DBVERSION_72} -#endif ,{"10.0",DBVERSION_100} ,{"auto",0} /* Only works with FreeTDS. Other drivers will bork */ @@ -350,12 +346,6 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ DBSETLAPP(H->login, vars[1].optval); -#ifdef DBSETLDBNAME - if (vars[3].optval) { - DBSETLDBNAME(H->login, vars[3].optval); - } -#endif - H->link = dbopen(H->login, vars[2].optval); if (!H->link) { @@ -369,7 +359,11 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ DBSETOPT(H->link, DBTEXTSIZE, "2147483647"); /* allow double quoted indentifiers */ - DBSETOPT(H->link, DBQUOTEDIDENT, NULL); + DBSETOPT(H->link, DBQUOTEDIDENT, "1"); + + if (vars[3].optval) { + DBSETLDBNAME(H->login, vars[3].optval); + } ret = 1; dbh->max_escaped_char_length = 2; diff --git a/ext/pdo_firebird/config.m4 b/ext/pdo_firebird/config.m4 index a89ab2aea53a8..7b6f669a50497 100644 --- a/ext/pdo_firebird/config.m4 +++ b/ext/pdo_firebird/config.m4 @@ -4,7 +4,7 @@ dnl PHP_ARG_WITH(pdo-firebird,for Firebird support for PDO, [ --with-pdo-firebird[=DIR] PDO: Firebird support. DIR is the Firebird base - install directory [/opt/firebird]]) + install directory [/opt/firebird]]) if test "$PHP_PDO_FIREBIRD" != "no"; then diff --git a/ext/pdo_mysql/config.m4 b/ext/pdo_mysql/config.m4 index f237f413be8cc..a2ba2fdbdd583 100755 --- a/ext/pdo_mysql/config.m4 +++ b/ext/pdo_mysql/config.m4 @@ -4,12 +4,12 @@ dnl vim: se ts=2 sw=2 et: PHP_ARG_WITH(pdo-mysql, for MySQL support for PDO, [ --with-pdo-mysql[=DIR] PDO: MySQL support. DIR is the MySQL base directory - If no value or mysqlnd is passed as DIR, the - MySQL native driver will be used]) + If no value or mysqlnd is passed as DIR, the + MySQL native driver will be used]) if test -z "$PHP_ZLIB_DIR"; then PHP_ARG_WITH(zlib-dir, for the location of libz, - [ --with-zlib-dir[=DIR] PDO_MySQL: Set the path to libz install prefix], no, no) + [ --with-zlib-dir[=DIR] PDO_MySQL: Set the path to libz install prefix], no, no) fi if test "$PHP_PDO_MYSQL" != "no"; then diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index cd86503dd7658..54c2e8dd84870 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -527,9 +527,9 @@ static struct pdo_dbh_methods mysql_methods = { /* }}} */ #ifdef PHP_WIN32 -# define PDO_DEFAULT_MYSQL_UNIX_ADDR NULL +# define MYSQL_UNIX_ADDR NULL #else -# define PDO_DEFAULT_MYSQL_UNIX_ADDR PDO_MYSQL_G(default_socket) +# define MYSQL_UNIX_ADDR PDO_MYSQL_G(default_socket) #endif /* {{{ pdo_mysql_handle_factory */ @@ -545,7 +545,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ { "dbname", "", 0 }, { "host", "localhost", 0 }, { "port", "3306", 0 }, - { "unix_socket", PDO_DEFAULT_MYSQL_UNIX_ADDR, 0 }, + { "unix_socket", MYSQL_UNIX_ADDR, 0 }, }; int connect_opts = 0 #ifdef CLIENT_MULTI_RESULTS @@ -710,7 +710,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ } } -#if MYSQL_VERSION_ID > 50605 || defined(PDO_USE_MYSQLND) +#if MYSQL_VERSION_ID > 50605 || defined(MYSQLI_USE_MYSQLND) { char *public_key = pdo_attr_strval(driver_options, PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY, NULL TSRMLS_CC); if (public_key) { diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c index 78c4ceefe916e..ed51e947cd79b 100644 --- a/ext/pdo_mysql/pdo_mysql.c +++ b/ext/pdo_mysql/pdo_mysql.c @@ -61,7 +61,7 @@ ZEND_DECLARE_MODULE_GLOBALS(pdo_mysql) #include "ext/mysqlnd/mysqlnd_reverse_api.h" static MYSQLND * pdo_mysql_convert_zv_to_mysqlnd(zval * zv TSRMLS_DC) { - if (Z_TYPE_P(zv) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zv), php_pdo_get_dbh_ce() TSRMLS_CC)) { + if (Z_TYPE_P(zv) == IS_OBJECT && Z_OBJCE_P(zv) == php_pdo_get_dbh_ce()) { pdo_dbh_t * dbh = zend_object_store_get_object(zv TSRMLS_CC); if (!dbh || dbh->driver != &pdo_mysql_driver) { @@ -118,7 +118,7 @@ static PHP_MINIT_FUNCTION(pdo_mysql) REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CA", (long)PDO_MYSQL_ATTR_SSL_CA); REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CAPATH", (long)PDO_MYSQL_ATTR_SSL_CAPATH); REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CIPHER", (long)PDO_MYSQL_ATTR_SSL_CIPHER); -#if MYSQL_VERSION_ID > 50605 || defined(PDO_USE_MYSQLND) +#if MYSQL_VERSION_ID > 50605 || defined(MYSQLI_USE_MYSQLND) REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SERVER_PUBLIC_KEY", (long)PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY); #endif diff --git a/ext/pdo_mysql/php_pdo_mysql_int.h b/ext/pdo_mysql/php_pdo_mysql_int.h index 24f7aa2182dc7..42debf07e9336 100644 --- a/ext/pdo_mysql/php_pdo_mysql_int.h +++ b/ext/pdo_mysql/php_pdo_mysql_int.h @@ -171,7 +171,7 @@ enum { PDO_MYSQL_ATTR_SSL_CA, PDO_MYSQL_ATTR_SSL_CAPATH, PDO_MYSQL_ATTR_SSL_CIPHER, -#if MYSQL_VERSION_ID > 50605 || defined(PDO_USE_MYSQLND) +#if MYSQL_VERSION_ID > 50605 || defined(MYSQLI_USE_MYSQLND) PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY #endif }; diff --git a/ext/pdo_mysql/tests/bug_44454.phpt b/ext/pdo_mysql/tests/bug_44454.phpt index eb93d97952c1d..89a4e2a3f72d9 100644 --- a/ext/pdo_mysql/tests/bug_44454.phpt +++ b/ext/pdo_mysql/tests/bug_44454.phpt @@ -73,6 +73,8 @@ require dirname(__FILE__) . '/mysql_pdo_test.inc'; $db = MySQLPDOTest::factory(); $db->exec('DROP TABLE IF EXISTS test'); ?> +--XFAIL-- +For some reason the exception gets thrown at the wrong place --EXPECTF-- Native Prepared Statements ... SELECT has returned 1 row... diff --git a/ext/pdo_mysql/tests/mysql_pdo_test.inc b/ext/pdo_mysql/tests/mysql_pdo_test.inc index 7a97bb4630756..115aeadc5a658 100644 --- a/ext/pdo_mysql/tests/mysql_pdo_test.inc +++ b/ext/pdo_mysql/tests/mysql_pdo_test.inc @@ -162,8 +162,8 @@ class MySQLPDOTest extends PDOTest { phpinfo(); $tmp = ob_get_contents(); ob_end_clean(); - return (preg_match('/PDO Driver for MySQL.*enabled/', $tmp) && - preg_match('/Client API version.*mysqlnd/', $tmp)); + $tmp = stristr($tmp, "PDO Driver for MySQL => enabled"); + return (bool)preg_match('/Client API version.*mysqlnd/', $tmp); } static function dropTestTable($db = NULL) { @@ -174,4 +174,4 @@ class MySQLPDOTest extends PDOTest { } } -?> +?> \ No newline at end of file diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt index ebf22ef61bec0..b550cb8da3184 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt @@ -48,7 +48,6 @@ if (($tmp[1] !== 'localhost') && ($tmp[1] !== '127.0.0.1')) } require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - putenv('PDOTEST_ATTR='.serialize([PDO::MYSQL_ATTR_LOCAL_INFILE=>true])); $db = MySQLPDOTest::factory(); MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); diff --git a/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt b/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt index 74b4a7358447b..a570c1fd49b9c 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt @@ -18,9 +18,10 @@ $db = MySQLPDOTest::factory(); ob_end_clean(); /* PDO Driver for MySQL, client library version => 6.0.3-alpha */ - $reg = 'Client API version.*' . preg_quote($db->getAttribute(PDO::ATTR_CLIENT_VERSION), '/'); + $expected = sprintf('Client API version => %s', + $db->getAttribute(PDO::ATTR_CLIENT_VERSION)); - if (!preg_match("/$reg/", $tmp)) { + if (false === stristr($tmp, $expected)) { printf("[001] Cannot find MySQL PDO driver line in phpinfo() output\n"); } diff --git a/ext/pdo_oci/config.m4 b/ext/pdo_oci/config.m4 index e3795db0ea815..0e42d1f9a9872 100755 --- a/ext/pdo_oci/config.m4 +++ b/ext/pdo_oci/config.m4 @@ -42,11 +42,11 @@ AC_DEFUN([AC_PDO_OCI_CHECK_LIB_DIR],[ PHP_ARG_WITH(pdo-oci, Oracle OCI support for PDO, [ --with-pdo-oci[=DIR] PDO: Oracle OCI support. DIR defaults to \$ORACLE_HOME. - Use --with-pdo-oci=instantclient,prefix,version - for an Oracle Instant Client SDK. - For example on Linux with 11.2 RPMs use: + Use --with-pdo-oci=instantclient,prefix,version + for an Oracle Instant Client SDK. + For example on Linux with 11.2 RPMs use: --with-pdo-oci=instantclient,/usr,11.2 - With 10.2 RPMs use: + With 10.2 RPMs use: --with-pdo-oci=instantclient,/usr,10.2.0.4]) if test "$PHP_PDO_OCI" != "no"; then diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt index ab9b99fc6c916..81e9b74ff9274 100644 --- a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt +++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt @@ -1,5 +1,5 @@ --TEST-- -PDO_OCI: Attribute: closing a connection in non-autocommit mode commits data +PDO_OCI: Atrribute: closing a connection in non-autocommit mode commits data --SKIPIF-- cols[colno].pgsql_type); /* Fetch metadata from Postgres system catalogue */ - spprintf(&q, 0, "SELECT TYPNAME FROM PG_TYPE WHERE OID=%u", S->cols[colno].pgsql_type); + spprintf(&q, 0, "SELECT TYPNAME FROM PG_TYPE WHERE OID=%d", S->cols[colno].pgsql_type); res = PQexec(S->H->server, q); efree(q); diff --git a/ext/pdo_pgsql/tests/bug_33876.phpt b/ext/pdo_pgsql/tests/bug_33876.phpt index 6a93905b439f3..48618e13dba95 100644 --- a/ext/pdo_pgsql/tests/bug_33876.phpt +++ b/ext/pdo_pgsql/tests/bug_33876.phpt @@ -82,7 +82,7 @@ else # false -> "" as string, which pgsql doesn't like if (!$res->execute(array(false))) { $err = $res->errorInfo(); - // Strip additional lines outputted by recent PgSQL versions + // Strip additional lines ouputted by recent PgSQL versions $err[2] = trim(current(explode("\n", $err[2]))); print_r($err); } else { diff --git a/ext/pdo_sqlite/config.m4 b/ext/pdo_sqlite/config.m4 index 0a7d0fe826134..b2b70a5038962 100644 --- a/ext/pdo_sqlite/config.m4 +++ b/ext/pdo_sqlite/config.m4 @@ -4,8 +4,8 @@ dnl vim:et:sw=2:ts=2: PHP_ARG_WITH(pdo-sqlite, for sqlite 3 support for PDO, [ --without-pdo-sqlite[=DIR] - PDO: sqlite 3 support. DIR is the sqlite base - install directory [BUNDLED]], $PHP_PDO) + PDO: sqlite 3 support. DIR is the sqlite base + install directory [BUNDLED]], $PHP_PDO) if test "$PHP_PDO_SQLITE" != "no"; then diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt deleted file mode 100644 index a1d890ac1b52c..0000000000000 --- a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -PDO_sqlite: Testing sqliteCreateFunction() produces warning when -un-callable function passed ---CREDITS-- -Chris MacPherson chris@kombine.co.uk ---SKIPIF-- - ---FILE-- -sqliteCreateFunction('bar-alias', 'bar'); - -?> ---EXPECTF-- -Warning: PDO::sqliteCreateFunction(): function 'bar' is not callable in %s on line %d diff --git a/ext/pgsql/config.m4 b/ext/pgsql/config.m4 index 13837bd832c74..bddb77a151e1a 100644 --- a/ext/pgsql/config.m4 +++ b/ext/pgsql/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(pgsql,for PostgreSQL support, -[ --with-pgsql[=DIR] Include PostgreSQL support. DIR is the PostgreSQL +[ --with-pgsql[=DIR] Include PostgreSQL support. DIR is the PostgreSQL base install directory or the path to pg_config]) if test "$PHP_PGSQL" != "no"; then diff --git a/ext/pgsql/mysql_users.php b/ext/pgsql/mysql_users.php index edfaa1cddcce3..65a2c33967539 100644 --- a/ext/pgsql/mysql_users.php +++ b/ext/pgsql/mysql_users.php @@ -56,7 +56,7 @@ function pg_list_tables($db) /* * mysql_list_fields() * - * See also pg_meta_data(). It returns field definition as array. + * See also pg_meta_data(). It returns field defintion as array. */ function pg_list_fields($db, $table) { diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index f0e1780a79790..0fa4031b37631 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -914,82 +914,6 @@ static void _free_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) } /* }}} */ - -static int _php_pgsql_detect_identifier_escape(const char *identifier, size_t len) -{ - size_t i; - - /* Handle edge case. Cannot be a escaped string */ - if (len <= 2) { - return FAILURE; - } - /* Detect double qoutes */ - if (identifier[0] == '"' && identifier[len-1] == '"') { - /* Detect wrong format of " inside of escaped string */ - for (i = 1; i < len-1; i++) { - if (identifier[i] == '"' && (identifier[++i] != '"' || i == len-1)) { - return FAILURE; - } - } - } else { - return FAILURE; - } - /* Escaped properly */ - return SUCCESS; -} - -#if !HAVE_PQESCAPELITERAL -/* {{{ _php_pgsql_escape_identifier - * Since PQescapeIdentifier() is unavailable (PostgreSQL 9.0 <), idenfifers - * should be escaped by pgsql module. - * Note: this function does not care for encoding. Therefore users should not - * use this with SJIS/BIG5 etc. (i.e. Encoding base injection may possible with - * before PostgreSQL 9.0) - */ -static char *_php_pgsql_escape_identifier(const char *field, size_t field_len) -{ - ulong field_escaped_len = field_len*2 + 3; - ulong i, j = 0; - char *field_escaped; - - field_escaped = (char *)malloc(field_escaped_len); - field_escaped[j++] = '"'; - for (i = 0; i < field_len; i++) { - if (field[i] == '"') { - field_escaped[j++] = '"'; - field_escaped[j++] = '"'; - } else { - field_escaped[j++] = field[i]; - } - } - field_escaped[j++] = '"'; - field_escaped[j] = '\0'; - return field_escaped; -} -/* }}} */ -#endif - -/* {{{ _php_pgsql_strndup, no strndup should be used */ -static char *_php_pgsql_strndup(const char *s, size_t len) -{ - char *new; - - if (NULL == s) { - return (char *)NULL; - } - - new = (char *) malloc(len + 1); - - if (NULL == new) { - return (char *)NULL; - } - - new[len] = '\0'; - - return memmove(new, s, len); -} -/* }}} */ - /* {{{ PHP_INI */ PHP_INI_BEGIN() @@ -4288,7 +4212,6 @@ PHP_FUNCTION(pg_unescape_bytea) to = (char *)php_pgsql_unescape_bytea((unsigned char*)from, &to_len); #endif if (!to) { - php_error_docref(NULL TSRMLS_CC, E_WARNING,"Invalid parameter"); RETURN_FALSE; } RETVAL_STRINGL(to, to_len, 0); @@ -4350,6 +4273,7 @@ static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_l char *from = NULL, *to = NULL, *tmp = NULL; zval *pgsql_link = NULL; PGconn *pgsql; + int to_len; int from_len; int id = -1; @@ -4370,13 +4294,12 @@ static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_l } if (pgsql_link == NULL && id == -1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot get default pgsql link"); RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); if (pgsql == NULL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot get pgsql link"); + php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot get default pgsql link"); RETURN_FALSE; } #ifdef HAVE_PQESCAPELITERAL @@ -5091,9 +5014,8 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z { PGresult *pg_result; char *src, *tmp_name, *tmp_name2 = NULL; - char *escaped; smart_str querystr = {0}; - size_t new_len; + int new_len; int i, num_rows; zval *elem; @@ -5115,29 +5037,20 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z "SELECT a.attname, a.attnum, t.typname, a.attlen, a.attnotnull, a.atthasdef, a.attndims, t.typtype = 'e' " "FROM pg_class as c, pg_attribute a, pg_type t, pg_namespace n " "WHERE a.attnum > 0 AND a.attrelid = c.oid AND c.relname = '"); - escaped = (char *)safe_emalloc(strlen(tmp_name2), 2, 1); -#if HAVE_PQESCAPE_CONN - new_len = PQescapeStringConn(pg_link, escaped, tmp_name2, strlen(tmp_name2), NULL); -#else - new_len = PQescapeString(escaped, tmp_name2, strlen(tmp_name2)); -#endif - smart_str_appends(&querystr, escaped); - efree(escaped); - + tmp_name2 = php_addslashes(tmp_name2, strlen(tmp_name2), &new_len, 0 TSRMLS_CC); + smart_str_appendl(&querystr, tmp_name2, new_len); + smart_str_appends(&querystr, "' AND c.relnamespace = n.oid AND n.nspname = '"); - escaped = (char *)safe_emalloc(strlen(tmp_name), 2, 1); -#if HAVE_PQESCAPE_CONN - new_len = PQescapeStringConn(pg_link, escaped, tmp_name, strlen(tmp_name), NULL); -#else - new_len = PQescapeString(escaped, tmp_name, strlen(tmp_name)); -#endif - smart_str_appends(&querystr, escaped); - efree(escaped); + tmp_name = php_addslashes(tmp_name, strlen(tmp_name), &new_len, 0 TSRMLS_CC); + smart_str_appendl(&querystr, tmp_name, new_len); smart_str_appends(&querystr, "' AND a.atttypid = t.oid ORDER BY a.attnum;"); smart_str_0(&querystr); - efree(src); - + + efree(tmp_name2); + efree(tmp_name); + efree(src); + pg_result = PQexec(pg_link, querystr.c); if (PQresultStatus(pg_result) != PGRES_TUPLES_OK || (num_rows = PQntuples(pg_result)) == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Table '%s' doesn't exists", table_name); @@ -5360,7 +5273,6 @@ static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC) assert(Z_TYPE_P(src) == IS_STRING); assert(should_free == 1 || should_free == 0); - smart_str_appendc(&str, 'E'); smart_str_appendc(&str, '\''); smart_str_appendl(&str, Z_STRVAL_P(src), Z_STRLEN_P(src)); smart_str_appendc(&str, '\''); @@ -5401,7 +5313,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con uint field_len = -1; ulong num_idx = -1; zval *meta, **def, **type, **not_null, **has_default, **is_enum, **val, *new_val; - int key_type, err = 0, skip_field; + int new_len, key_type, err = 0, skip_field; php_pgsql_data_type data_type; assert(pg_link != NULL); @@ -5414,8 +5326,6 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con } MAKE_STD_ZVAL(meta); array_init(meta); - -/* table_name is escaped by php_pgsql_meta_data */ if (php_pgsql_meta_data(pg_link, table_name, meta TSRMLS_CC) == FAILURE) { zval_dtor(meta); FREE_ZVAL(meta); @@ -5427,7 +5337,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con skip_field = 0; new_val = NULL; - if ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &field, &field_len, &num_idx, 0, &pos)) == HASH_KEY_NON_EXISTENT) { + if ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &field, &field_len, &num_idx, 0, &pos)) == HASH_KEY_NON_EXISTANT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to get array key type"); err = 1; } @@ -5435,7 +5345,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con php_error_docref(NULL TSRMLS_CC, E_WARNING, "Accepts only string key for values"); err = 1; } - if (!err && key_type == HASH_KEY_NON_EXISTENT) { + if (!err && key_type == HASH_KEY_NON_EXISTANT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Accepts only string key for values"); err = 1; } @@ -5628,15 +5538,15 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con } else { Z_TYPE_P(new_val) = IS_STRING; -#if HAVE_PQESCAPE_CONN +#if HAVE_PQESCAPE { char *tmp; - tmp = (char *)safe_emalloc(Z_STRLEN_PP(val), 2, 1); - Z_STRLEN_P(new_val) = (int)PQescapeStringConn(pg_link, tmp, Z_STRVAL_PP(val), Z_STRLEN_PP(val), NULL); + tmp = (char *)safe_emalloc(Z_STRLEN_PP(val), 2, 1); + Z_STRLEN_P(new_val) = (int)PQescapeString(tmp, Z_STRVAL_PP(val), Z_STRLEN_PP(val)); Z_STRVAL_P(new_val) = tmp; } #else - Z_STRVAL_P(new_val) = (int)PQescapeString(Z_STRVAL_PP(val), Z_STRLEN_PP(val), &Z_STRLEN_P(new_val), 0 TSRMLS_CC); + Z_STRVAL_P(new_val) = php_addslashes(Z_STRVAL_PP(val), Z_STRLEN_PP(val), &Z_STRLEN_P(new_val), 0 TSRMLS_CC); #endif php_pgsql_add_quotes(new_val, 1 TSRMLS_CC); } @@ -5922,7 +5832,6 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con else { unsigned char *tmp; size_t to_len; - smart_str s = {0}; #ifdef HAVE_PQESCAPE_BYTEA_CONN tmp = PQescapeByteaConn(pg_link, Z_STRVAL_PP(val), Z_STRLEN_PP(val), &to_len); #else @@ -5934,11 +5843,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con memcpy(Z_STRVAL_P(new_val), tmp, to_len); PQfreemem(tmp); php_pgsql_add_quotes(new_val, 1 TSRMLS_CC); - smart_str_appendl(&s, Z_STRVAL_P(new_val), Z_STRLEN_P(new_val)); - smart_str_0(&s); - efree(Z_STRVAL_P(new_val)); - Z_STRVAL_P(new_val) = s.c; - Z_STRLEN_P(new_val) = s.len; + } break; @@ -6023,22 +5928,11 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con FREE_ZVAL(new_val); break; /* break out for() */ } - /* If field is NULL and HAS DEFAULT, should be skipped */ if (!skip_field) { - char *escaped; - size_t field_len = strlen(field); - - if (_php_pgsql_detect_identifier_escape(field, field_len) == SUCCESS) { - escaped = _php_pgsql_strndup(field, field_len); - } else { -#if HAVE_PQESCAPELITERAL - escaped = PQescapeIdentifier(pg_link, field, field_len); -#else - escaped = _php_pgsql_escape_identifier(field, field_len); -#endif - } - add_assoc_zval(result, escaped, new_val); - free(escaped); + /* If field is NULL and HAS DEFAULT, should be skipped */ + field = php_addslashes(field, strlen(field), &new_len, 0 TSRMLS_CC); + add_assoc_zval(result, field, new_val); + efree(field); } } /* for */ zval_dtor(meta); @@ -6113,45 +6007,6 @@ static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, ulong opt T return -1; } -static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const char *table) -{ - char *table_copy, *escaped, *token, *tmp; - size_t len; - - /* schame.table should be "schame"."table" */ - table_copy = estrdup(table); - token = php_strtok_r(table_copy, ".", &tmp); - len = strlen(token); - if (_php_pgsql_detect_identifier_escape(token, len) == SUCCESS) { - escaped = _php_pgsql_strndup(token, len); - } else { -#if HAVE_PQESCAPELITERAL - escaped = PQescapeIdentifier(pg_link, token, len); -#else - escaped = _php_pgsql_escape_identifier(token, len); -#endif - } - smart_str_appends(querystr, escaped); - free(escaped); - if (tmp && *tmp) { - len = strlen(tmp); - /* "schema"."table" format */ - if (_php_pgsql_detect_identifier_escape(tmp, len) == SUCCESS) { - escaped = _php_pgsql_strndup(tmp, len); - } else { -#if HAVE_PQESCAPELITERAL - escaped = PQescapeIdentifier(pg_link, tmp, len); -#else - escaped = _php_pgsql_escape_identifier(tmp, len); -#endif - } - smart_str_appendc(querystr, '.'); - smart_str_appends(querystr, escaped); - free(escaped); - } - efree(table_copy); -} - /* {{{ php_pgsql_insert */ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, ulong opt, char **sql TSRMLS_DC) @@ -6171,7 +6026,7 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var if (zend_hash_num_elements(Z_ARRVAL_P(var_array)) == 0) { smart_str_appends(&querystr, "INSERT INTO "); - build_tablename(&querystr, pg_link, table); + smart_str_appends(&querystr, table); smart_str_appends(&querystr, " DEFAULT VALUES"); goto no_values; @@ -6186,14 +6041,14 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var } var_array = converted; } - + smart_str_appends(&querystr, "INSERT INTO "); - build_tablename(&querystr, pg_link, table); + smart_str_appends(&querystr, table); smart_str_appends(&querystr, " ("); - + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(var_array), &pos); while ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(var_array), &fld, - &fld_len, &num_idx, 0, &pos)) != HASH_KEY_NON_EXISTENT) { + &fld_len, &num_idx, 0, &pos)) != HASH_KEY_NON_EXISTANT) { if (key_type == HASH_KEY_IS_LONG) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects associative array for values to be inserted"); goto cleanup; @@ -6377,7 +6232,7 @@ PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var } smart_str_appends(&querystr, "UPDATE "); - build_tablename(&querystr, pg_link, table); + smart_str_appends(&querystr, table); smart_str_appends(&querystr, " SET "); if (build_assignment_string(&querystr, Z_ARRVAL_P(var_array), 0, ",", 1 TSRMLS_CC)) @@ -6478,7 +6333,7 @@ PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids } smart_str_appends(&querystr, "DELETE FROM "); - build_tablename(&querystr, pg_link, table); + smart_str_appends(&querystr, table); smart_str_appends(&querystr, " WHERE "); if (build_assignment_string(&querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")-1 TSRMLS_CC)) @@ -6614,7 +6469,7 @@ PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids } smart_str_appends(&querystr, "SELECT * FROM "); - build_tablename(&querystr, pg_link, table); + smart_str_appends(&querystr, table); smart_str_appends(&querystr, " WHERE "); if (build_assignment_string(&querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")-1 TSRMLS_CC)) diff --git a/ext/pgsql/tests/00version.phpt b/ext/pgsql/tests/00version.phpt deleted file mode 100644 index d72d9e1f212b7..0000000000000 --- a/ext/pgsql/tests/00version.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -PostgreSQL version ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -array(3) { - ["client"]=> - string(%d) "%s" - ["protocol"]=> - int(%d) - ["server"]=> - string(%d) "%s" -} -string(%d) "%s" -OK diff --git a/ext/pgsql/tests/09notice.phpt b/ext/pgsql/tests/09notice.phpt index 67ef262fcade7..316706916917f 100644 --- a/ext/pgsql/tests/09notice.phpt +++ b/ext/pgsql/tests/09notice.phpt @@ -10,7 +10,7 @@ _skip_lc_messages(); ?> --INI-- pgsql.log_notice=1 -pgsql.ignore_notice=0 +pgsql.ignore_notices=0 --FILE-- --EXPECT-- array(3) { - [""num""]=> + ["num"]=> string(4) "1234" - [""str""]=> - string(6) "E'AAA'" - [""bin""]=> - string(6) "E'BBB'" -} \ No newline at end of file + ["str"]=> + string(5) "'AAA'" + ["bin"]=> + string(5) "'BBB'" +} diff --git a/ext/pgsql/tests/10pg_convert_9.phpt b/ext/pgsql/tests/10pg_convert_9.phpt index 827c96250db8d..bb2e7e6d2a317 100644 --- a/ext/pgsql/tests/10pg_convert_9.phpt +++ b/ext/pgsql/tests/10pg_convert_9.phpt @@ -21,10 +21,10 @@ var_dump($converted); ?> --EXPECT-- array(3) { - [""num""]=> + ["num"]=> string(4) "1234" - [""str""]=> - string(6) "E'AAA'" - [""bin""]=> - string(12) "E'\\x424242'" -} \ No newline at end of file + ["str"]=> + string(5) "'AAA'" + ["bin"]=> + string(11) "'\\x424242'" +} diff --git a/ext/pgsql/tests/12pg_insert.phpt b/ext/pgsql/tests/12pg_insert.phpt index 9fd0dd1e3b9b0..66304944b0870 100644 --- a/ext/pgsql/tests/12pg_insert.phpt +++ b/ext/pgsql/tests/12pg_insert.phpt @@ -20,5 +20,5 @@ echo pg_insert($db, $table_name, $fields, PGSQL_DML_STRING)."\n"; echo "Ok\n"; ?> --EXPECT-- -INSERT INTO "php_pgsql_test" ("num","str","bin") VALUES (1234,E'AAA',E'BBB'); -Ok \ No newline at end of file +INSERT INTO php_pgsql_test (num,str,bin) VALUES (1234,'AAA','BBB'); +Ok diff --git a/ext/pgsql/tests/12pg_insert_9.phpt b/ext/pgsql/tests/12pg_insert_9.phpt index 329364ad6450f..8afae0df91d7f 100644 --- a/ext/pgsql/tests/12pg_insert_9.phpt +++ b/ext/pgsql/tests/12pg_insert_9.phpt @@ -22,5 +22,5 @@ echo pg_insert($db, $table_name, $fields, PGSQL_DML_STRING)."\n"; echo "Ok\n"; ?> --EXPECT-- -INSERT INTO "php_pgsql_test" ("num","str","bin") VALUES (1234,E'AAA',E'\\x424242'); -Ok \ No newline at end of file +INSERT INTO php_pgsql_test (num,str,bin) VALUES (1234,'AAA','\\x424242'); +Ok diff --git a/ext/pgsql/tests/13pg_select.phpt b/ext/pgsql/tests/13pg_select.phpt index db2ca06bf869a..f1504a8b17996 100644 --- a/ext/pgsql/tests/13pg_select.phpt +++ b/ext/pgsql/tests/13pg_select.phpt @@ -33,5 +33,5 @@ array(1) { string(3) "BBB" } } -SELECT * FROM "php_pgsql_test" WHERE "num"=1234; +SELECT * FROM php_pgsql_test WHERE num=1234; Ok diff --git a/ext/pgsql/tests/13pg_select_9.phpt b/ext/pgsql/tests/13pg_select_9.phpt index 67adc9d21d3eb..422c461b6096d 100644 --- a/ext/pgsql/tests/13pg_select_9.phpt +++ b/ext/pgsql/tests/13pg_select_9.phpt @@ -35,5 +35,5 @@ array(1) { string(8) "\x424242" } } -SELECT * FROM "php_pgsql_test" WHERE "num"=1234; -Ok \ No newline at end of file +SELECT * FROM php_pgsql_test WHERE num=1234; +Ok diff --git a/ext/pgsql/tests/14pg_update.phpt b/ext/pgsql/tests/14pg_update.phpt index 347cac94470dc..3260f2b73e1e3 100644 --- a/ext/pgsql/tests/14pg_update.phpt +++ b/ext/pgsql/tests/14pg_update.phpt @@ -21,5 +21,5 @@ echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING)."\n"; echo "Ok\n"; ?> --EXPECT-- -UPDATE "php_pgsql_test" SET "num"=1234,"str"=E'ABC',"bin"=E'XYZ' WHERE "num"=1234; -Ok \ No newline at end of file +UPDATE php_pgsql_test SET num=1234,str='ABC',bin='XYZ' WHERE num=1234; +Ok diff --git a/ext/pgsql/tests/14pg_update_9.phpt b/ext/pgsql/tests/14pg_update_9.phpt index c33f1afbd6e45..bc5cf673e327e 100644 --- a/ext/pgsql/tests/14pg_update_9.phpt +++ b/ext/pgsql/tests/14pg_update_9.phpt @@ -1,5 +1,5 @@ --TEST-- -PostgreSQL pg_update() (9.0+) +PostgreSQL pg_update() (9.0) --SKIPIF-- --EXPECT-- -UPDATE "php_pgsql_test" SET "num"=1234,"str"=E'ABC',"bin"=E'\\x58595a' WHERE "num"=1234; -Ok \ No newline at end of file +UPDATE php_pgsql_test SET num=1234,str='ABC',bin='\\x58595a' WHERE num=1234; +Ok diff --git a/ext/pgsql/tests/80_bug14383.phpt b/ext/pgsql/tests/80_bug14383.phpt index cb54aa8dfb3c7..a736f34c900e3 100644 --- a/ext/pgsql/tests/80_bug14383.phpt +++ b/ext/pgsql/tests/80_bug14383.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #14383 (8.0+) (using postgres with DBA causes DBA not to be able to find any keys) +Bug #14383 (using postgres with DBA causes DBA not to be able to find any keys) --SKIPIF-- ---INI-- -pgsql.ignore_notice=0 --FILE-- ===DONE=== --EXPECTF-- -resource(%d) of type (pgsql result) array(1) { [0]=> string(1) "f" diff --git a/ext/pgsql/tests/80_bug32223b.phpt b/ext/pgsql/tests/80_bug32223b.phpt index 6e1a073b99918..aada3f01ba41d 100644 --- a/ext/pgsql/tests/80_bug32223b.phpt +++ b/ext/pgsql/tests/80_bug32223b.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #32223 (8.0+) (weird behaviour of pg_last_notice using define) +Bug #32223 (weird behaviour of pg_last_notice using define) --SKIPIF-- ---INI-- -pgsql.ignore_notice=0 --FILE-- array(2) { diff --git a/ext/pgsql/tests/bug64609.phpt b/ext/pgsql/tests/bug64609.phpt index 72fac7648efd9..0df63012dafe5 100644 --- a/ext/pgsql/tests/bug64609.phpt +++ b/ext/pgsql/tests/bug64609.phpt @@ -25,6 +25,6 @@ var_dump($converted); ?> --EXPECT-- array(1) { - [""a""]=> - string(5) "E'ok'" -} \ No newline at end of file + ["a"]=> + string(4) "'ok'" +} diff --git a/ext/pgsql/tests/config.inc b/ext/pgsql/tests/config.inc index ffe31a875e322..2b5f05a71dab9 100644 --- a/ext/pgsql/tests/config.inc +++ b/ext/pgsql/tests/config.inc @@ -2,10 +2,8 @@ // These vars are used to connect db and create test table. // values can be set to meet your environment -// "test" database must be existed. i.e. "createdb test" before testing -// PostgreSQL uses login name as username, user must have access to "test" database. -$conn_str = "host=localhost dbname=test port=5432"; // connection string -$table_name = "php_pgsql_test"; // test table that will be created +$conn_str = "host=localhost dbname=test"; // connection string +$table_name = "php_pgsql_test"; // test table that should be exist $num_test_record = 1000; // Number of records to create $table_def = "CREATE TABLE php_pgsql_test (num int, str text, bin bytea);"; // Test table diff --git a/ext/pgsql/tests/pg_delete_001.phpt b/ext/pgsql/tests/pg_delete_001.phpt index a98c95dc4cb58..abb65be142f7a 100644 --- a/ext/pgsql/tests/pg_delete_001.phpt +++ b/ext/pgsql/tests/pg_delete_001.phpt @@ -45,8 +45,8 @@ pg_query('DROP SCHEMA phptests'); ?> --EXPECTF-- -string(43) "DELETE FROM "foo" WHERE "id"=1 AND "id2"=2;" -string(54) "DELETE FROM "phptests"."foo" WHERE "id"=2 AND "id2"=3;" +string(37) "DELETE FROM foo WHERE id=1 AND id2=2;" +string(46) "DELETE FROM phptests.foo WHERE id=2 AND id2=3;" array(2) { [0]=> array(2) { diff --git a/ext/pgsql/tests/pg_insert_001.phpt b/ext/pgsql/tests/pg_insert_001.phpt index 626d4d0f82cfc..7d27219187d21 100644 --- a/ext/pgsql/tests/pg_insert_001.phpt +++ b/ext/pgsql/tests/pg_insert_001.phpt @@ -28,7 +28,7 @@ pg_query('DROP SCHEMA phptests'); --EXPECTF-- Warning: pg_insert(): Table 'foo' doesn't exists in %s on line %d -string(55) "INSERT INTO "phptests"."foo" ("id","id2") VALUES (1,2);" +string(47) "INSERT INTO phptests.foo (id,id2) VALUES (1,2);" array(1) { [0]=> array(2) { diff --git a/ext/pgsql/tests/pg_update_001.phpt b/ext/pgsql/tests/pg_update_001.phpt index 60db35c157b3d..95fa692568476 100644 --- a/ext/pgsql/tests/pg_update_001.phpt +++ b/ext/pgsql/tests/pg_update_001.phpt @@ -35,8 +35,8 @@ pg_query('DROP SCHEMA phptests'); ?> --EXPECT-- -string(38) "UPDATE "foo" SET "id"=10 WHERE "id"=1;" -string(51) "UPDATE "phptests"."foo" SET "id"=100 WHERE "id2"=2;" +string(32) "UPDATE foo SET id=10 WHERE id=1;" +string(43) "UPDATE phptests.foo SET id=100 WHERE id2=2;" array(2) { ["id"]=> string(2) "10" diff --git a/ext/phar/Makefile.frag b/ext/phar/Makefile.frag index faa9db0c706b0..e2b016d846ffb 100644 --- a/ext/phar/Makefile.frag +++ b/ext/phar/Makefile.frag @@ -40,7 +40,3 @@ install-pharcmd: pharcmd $(INSTALL) $(builddir)/phar.phar $(INSTALL_ROOT)$(bindir) -@rm -f $(INSTALL_ROOT)$(bindir)/phar $(LN_S) -f $(bindir)/phar.phar $(INSTALL_ROOT)$(bindir)/phar - @$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1 - @$(INSTALL_DATA) $(builddir)/phar.1 $(INSTALL_ROOT)$(mandir)/man1/phar.1 - @$(INSTALL_DATA) $(builddir)/phar.phar.1 $(INSTALL_ROOT)$(mandir)/man1/phar.phar.1 - diff --git a/ext/phar/config.m4 b/ext/phar/config.m4 index d424060f2a247..2ac7f3dd81324 100644 --- a/ext/phar/config.m4 +++ b/ext/phar/config.m4 @@ -27,6 +27,4 @@ if test "$PHP_PHAR" != "no"; then PHP_ADD_EXTENSION_DEP(phar, hash, true) PHP_ADD_EXTENSION_DEP(phar, spl, true) PHP_ADD_MAKEFILE_FRAGMENT - - PHP_OUTPUT(ext/phar/phar.1 ext/phar/phar.phar.1) fi diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c index b090577306758..277d058ea6ce8 100644 --- a/ext/phar/dirstream.c +++ b/ext/phar/dirstream.c @@ -103,7 +103,7 @@ static size_t phar_dir_read(php_stream *stream, char *buf, size_t count TSRMLS_D return 0; } - if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(data, &key, &keylen, &unused, 0, NULL)) { + if (HASH_KEY_NON_EXISTANT == zend_hash_get_current_key_ex(data, &key, &keylen, &unused, 0, NULL)) { return 0; } @@ -211,7 +211,7 @@ static php_stream *phar_make_dirstream(char *dir, HashTable *manifest TSRMLS_DC) zend_hash_internal_pointer_reset(manifest); while (FAILURE != zend_hash_has_more_elements(manifest)) { - if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(manifest, &key, &keylen, &unused, 0, NULL)) { + if (HASH_KEY_NON_EXISTANT == zend_hash_get_current_key_ex(manifest, &key, &keylen, &unused, 0, NULL)) { break; } @@ -319,7 +319,7 @@ static php_stream *phar_make_dirstream(char *dir, HashTable *manifest TSRMLS_DC) /** * Open a directory handle within a phar archive */ -php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ +php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ { php_url *resource = NULL; php_stream *ret; @@ -403,7 +403,7 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, /* search for directory */ zend_hash_internal_pointer_reset(&phar->manifest); while (FAILURE != zend_hash_has_more_elements(&phar->manifest)) { - if (HASH_KEY_NON_EXISTENT != + if (HASH_KEY_NON_EXISTANT != zend_hash_get_current_key_ex( &phar->manifest, &key, &keylen, &unused, 0, NULL)) { PHAR_STR(key, str_key); @@ -432,7 +432,7 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, /** * Make a new directory within a phar archive */ -int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mode, int options, php_stream_context *context TSRMLS_DC) /* {{{ */ +int phar_wrapper_mkdir(php_stream_wrapper *wrapper, char *url_from, int mode, int options, php_stream_context *context TSRMLS_DC) /* {{{ */ { phar_entry_info entry, *e; phar_archive_data *phar = NULL; @@ -564,7 +564,7 @@ int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mo /** * Remove a directory within a phar archive */ -int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) /* {{{ */ +int phar_wrapper_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) /* {{{ */ { phar_entry_info *entry; phar_archive_data *phar = NULL; @@ -637,7 +637,7 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options if (!entry->is_deleted) { for (zend_hash_internal_pointer_reset(&phar->manifest); - HASH_KEY_NON_EXISTENT != zend_hash_get_current_key_ex(&phar->manifest, &key, &key_len, &unused, 0, NULL); + HASH_KEY_NON_EXISTANT != zend_hash_get_current_key_ex(&phar->manifest, &key, &key_len, &unused, 0, NULL); zend_hash_move_forward(&phar->manifest)) { PHAR_STR(key, str_key); @@ -658,7 +658,7 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options } for (zend_hash_internal_pointer_reset(&phar->virtual_dirs); - HASH_KEY_NON_EXISTENT != zend_hash_get_current_key_ex(&phar->virtual_dirs, &key, &key_len, &unused, 0, NULL); + HASH_KEY_NON_EXISTANT != zend_hash_get_current_key_ex(&phar->virtual_dirs, &key, &key_len, &unused, 0, NULL); zend_hash_move_forward(&phar->virtual_dirs)) { PHAR_STR(key, str_key); diff --git a/ext/phar/dirstream.h b/ext/phar/dirstream.h index 030fe6536e913..9b07c9d799085 100644 --- a/ext/phar/dirstream.h +++ b/ext/phar/dirstream.h @@ -20,11 +20,11 @@ /* $Id$ */ BEGIN_EXTERN_C() -int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mode, int options, php_stream_context *context TSRMLS_DC); -int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC); +int phar_wrapper_mkdir(php_stream_wrapper *wrapper, char *url_from, int mode, int options, php_stream_context *context TSRMLS_DC); +int phar_wrapper_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); #ifdef PHAR_DIRSTREAM -php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options TSRMLS_DC); +php_url* phar_parse_url(php_stream_wrapper *wrapper, char *filename, char *mode, int options TSRMLS_DC); /* directory handlers */ static size_t phar_dir_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC); @@ -33,7 +33,7 @@ static int phar_dir_close(php_stream *stream, int close_handle TSRMLS_DC); static int phar_dir_flush(php_stream *stream TSRMLS_DC); static int phar_dir_seek( php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC); #else -php_stream* phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); +php_stream* phar_wrapper_open_dir(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); #endif END_EXTERN_C() diff --git a/ext/phar/phar.1.in b/ext/phar/phar.1.in deleted file mode 100644 index 259a2bae86c98..0000000000000 --- a/ext/phar/phar.1.in +++ /dev/null @@ -1,523 +0,0 @@ -.TH PHAR 1 "2013" "The PHP Group" "User Commands" -.SH NAME -phar, phar.phar \- PHAR (PHP archive) command line tool -.SH SYNOPSIS -.B phar - [options] ... -.LP -.SH DESCRIPTION -The \fBPHAR\fP file format provides a way to put entire PHP applications into a single -file called a "phar" (PHP Archive) for easy distribution and installation. -.P -With the \fBphar\fP command you can create, update or extract PHP archives. -.P -Commands: -add compress delete extract help help-list info list meta-del -meta-get meta-set pack sign stub-get stub-set tree version - -.SH add command -Add entries to a PHAR package. -.P -Required arguments: -.TP 15 -.PD -.B -f \fIfile\fP -Specifies the phar \fIfile\fP to work on. -.TP -.PD -.B ... -Any number of input files and directories. If -i is in -use then ONLY files and matching the given regular -expression are being packed. If -x is given then files -matching that regular expression are NOT being packed. -.P -Optional arguments: -.TP 15 -.PD -.B \-a \fIalias\fP -Provide an \fIalias\fP name for the phar file. -.TP -.PD -.B \-c \fIalgo\fP -Compression algorithm (see -.SM -.B COMPRESSION -) -.TP -.PD -.B \-i \fIregex\fP -Specifies a regular expression for input files. -.TP -.PD -.B \-l \fIlevel\fP -Number of preceding subdirectories to strip from file entries -.TP -.PD -.B \-x \fIregex\fP -Regular expression for input files to exclude. - -.SH compress command -Compress or uncompress all files or a selected entry. -.P -Required arguments: -.TP 15 -.PD -.B \-c \fIalgo\fP -Compression algorithm (see -.SM -.B COMPRESSION -) -.TP -.PD -.B -f \fIfile\fP -Specifies the phar \fIfile\fP to work on. -.P -Optional arguments: -.TP 15 -.PD -.B -e \fIentry\fP -Name of \fIentry\fP to work on (must include PHAR internal -directory name if any). - -.SH delete command -Delete entry from a PHAR archive -.P -Required arguments: -.TP 15 -.PD -.B \-e \fIentry\fP -Name of \fIentry\fP to work on (must include PHAR internal -directory name if any). -.TP -.PD -.B -f \fIfile\fP -Specifies the phar \fIfile\fP to work on. - -.SH extract command -Extract a PHAR package to a directory. -.P -Required arguments: -.TP 15 -.PD -.B -f \fIfile\fP -Specifies the phar \fIfile\fP to work on. -.P -Optional arguments: -.TP 15 -.PD -.B -i \fIregex\fP -Specifies a regular expression for input files. -.TP -.PD -.B -x \fIregex\fP -Regular expression for input files to exclude. -.TP -.PD -.B ... -Directory to extract to (defaults to '.'). - - -.SH help command -This help or help for a selected command. -.P -Optional arguments: -.TP 15 -.PD -.B ... -Optional command to retrieve help for. - -.SH help-list command -Lists available commands. - -.SH info command -Get information about a PHAR package. -.P -By using -k it is possible to return a single value. -.P -Required arguments: -.TP 15 -.PD -.B -f \fIfile\fP -Specifies the phar \fIfile\fP to work on. -.P -Optional arguments: -.TP 15 -.PD -.B -k \fIindex\fP -Subscription \fIindex\fP to work on. - -.SH list command -List contents of a PHAR archive. -.P -Required arguments: -.TP 15 -.PD -.B -f \fIfile\fP -Specifies the phar \fIfile\fP to work on. -.P -Optional arguments: -.TP 15 -.PD -.B -i \fIregex\fP -Specifies a regular expression for input files. -.TP -.PD -.B -x \fIregex\fP -Regular expression for input files to exclude. - - -.SH meta-del command -Delete meta information of a PHAR entry or a PHAR package. -.P -If -k is given then the metadata is expected to be an array and the -given index is being deleted. -.P -If something was deleted the return value is 0 otherwise it is 1. -.P -Required arguments: -.TP 15 -.PD -.B -f \fIfile\fP -Specifies the phar \fIfile\fP to work on. -.P -Optional arguments: -.TP 15 -.PD -.B -e \fIentry\fP -Name of \fIentry\fP to work on (must include PHAR internal -directory name if any). -.TP -.PD -.B -k \fIindex\fP -Subscription \fIindex\fP to work on. - -.SH meta-get command -Get meta information of a PHAR entry or a PHAR package in serialized from. If -no output file is specified for meta data then stdout is being used. -You can also specify a particular index using -k. In that case the -metadata is expected to be an array and the value of the given index -is returned using echo rather than using serialize. If that index does -not exist or no meta data is present then the return value is 1. -.P -Required arguments: -.TP 15 -.PD -.B -f \fIfile\fP -Specifies the phar \fIfile\fP to work on. -.P -Optional arguments: -.TP 15 -.PD -.B -e \fIentry\fP -Name of \fIentry\fP to work on (must include PHAR internal -directory name if any). -.TP -.PD -.B -k \fIindex\fP -Subscription \fIindex\fP to work on. - -.SH meta-set command -Set meta data of a PHAR entry or a PHAR package using serialized input. If no -input file is specified for meta data then stdin is being used. You can -also specify a particular index using -k. In that case the metadata is -expected to be an array and the value of the given index is being set. -If the metadata is not present or empty a new array will be created. -If the metadata is present and a flat value then the return value is -1. Also using -k the input is been taken directly rather then being -serialized. -.P -Required arguments: -.TP 15 -.PD -.B -f \fIfile\fP -Specifies the phar \fIfile\fP to work on. -.TP -.PD -.B -m \fImeta\fP -Meta data to store with entry (serialized php data). -.P -Optional arguments: -.TP 15 -.PD -.B -e \fIentry\fP -Name of \fIentry\fP to work on (must include PHAR internal -directory name if any). -.TP -.PD -.B -k \fIindex\fP -Subscription \fIindex\fP to work on. - -.SH pack command -Pack files into a PHAR archive. -.P -When using -s , then the stub file is being excluded from the -list of input files/dirs.To create an archive that contains PEAR class -PHP_Archive then point -p argument to PHP/Archive.php. -.P -Required arguments: -.TP 15 -.PD -.B -f \fIfile\fP -Specifies the phar \fIfile\fP to work on. -.TP -.PD -.B ... -Any number of input files and directories. If -i is in -use then ONLY files and matching the given regular -expression are being packed. If -x is given then files -matching that regular expression are NOT being packed. -.P -Optional arguments: -.TP 15 -.PD -.B \-a \fIalias\fP -Provide an \fIalias\fP name for the phar file. -.TP -.PD -.B \-b \fIbang\fP -Hash-bang line to start the archive (e.g. #!/usr/bin/php). -The hash mark itself '#!' and the newline character are optional. -.TP -.PD -.B \-c \fIalgo\fP -Compression algorithm (see -.SM -.B COMPRESSION -) -.TP -.PD -.B \-h \fIhash\fP -Selects the \fIhash\fP algorithm (see -.SM -.B HASH -) -.TP -.PD -.B \-i \fIregex\fP -Specifies a regular expression for input files. -.TP -.PD -.B \-l \fIlevel\fP -Number of preceding subdirectories to strip from file entries -.TP -.PD -.B \-p \fIloader\fP -Location of PHP_Archive class file (pear list-files -PHP_Archive).You can use '0' or '1' to locate it -automatically using the mentioned pear command. When -using '0' the command does not error out when the class -file cannot be located. This switch also adds some code -around the stub so that class PHP_Archive gets -registered as phar:// stream wrapper if necessary. And -finally this switch will add the file phar.inc from -this package and load it to ensure class Phar is -present. -.TP -.PD -.B \-s \fIstub\fP -Select the \fIstub\fP file. -.TP -.PD -.B \-x \fIregex\fP -Regular expression for input files to exclude. -.TP -.PD -.B \-y \fIkey\fP -Private \fIkey\fP for OpenSSL signing. - -.SH sign command -Set signature hash algorithm. -.P -Required arguments: -.TP 15 -.PD -.B -f \fIfile\fP -Specifies the phar \fIfile\fP to work on. -.TP -.PD -.B \-h \fIhash\fP -Selects the \fIhash\fP algorithm (see -.SM -.B HASH -) -.P -Optional arguments: -.TP 15 -.PD -.B \-y \fIkey\fP -Private \fIkey\fP for OpenSSL signing. - -.SH stub-get command -Get the stub of a PHAR file. If no output file is specified as stub then stdout -is being used. -.P -Required arguments: -.TP 15 -.PD -.B -f \fIfile\fP -Specifies the phar \fIfile\fP to work on. -.P -Optional arguments: -.TP 15 -.PD -.B \-s \fIstub\fP -Select the \fIstub\fP file. - -.SH stub-set command -Set the stub of a PHAR file. If no input file is specified as stub then stdin -is being used. -.P -Required arguments: -.TP 15 -.PD -.B -f \fIfile\fP -Specifies the phar \fIfile\fP to work on. -.P -Optional arguments: -.TP 15 -.PD -.B \-b \fIbang\fP -Hash-bang line to start the archive (e.g. #!/usr/bin/php). -The hash mark itself '#!' and the newline character are optional. -.TP -.PD -.B \-p \fIloader\fP -Location of PHP_Archive class file (pear list-files -PHP_Archive).You can use '0' or '1' to locate it -automatically using the mentioned pear command. When -using '0' the command does not error out when the class -file cannot be located. This switch also adds some code -around the stub so that class PHP_Archive gets -registered as phar:// stream wrapper if necessary. And -finally this switch will add the file phar.inc from -this package and load it to ensure class Phar is -present. -.TP -.PD -.B \-s \fIstub\fP -Select the \fIstub\fP file. - - -.SH tree command -Get a directory tree for a PHAR archive. -.P -Required arguments: -.TP 15 -.PD -.B -f \fIfile\fP -Specifies the phar \fIfile\fP to work on. -.P -Optional arguments: -.TP 15 -.PD -.B \-i \fIregex\fP -Specifies a regular expression for input files. -.TP -.PD -.B \-x \fIregex\fP -Regular expression for input files to exclude. - -.SH version command -Get information about the PHAR environment and the tool version. - - -.SH COMPRESSION -Algorithms: -.TP 15 -.PD -.B 0 -No compression -.TP -.PD -.B none -No compression -.TP -.PD -.B auto -Automatically select compression algorithm -.TP -.PD -.B gz -GZip compression -.TP -.PD -.B gzip -GZip compression -.TP -.PD -.B bz2 -BZip2 compression -.TP -.PD -.B bzip2 -BZip2 compression - -.SH HASH -Algorithms: -.TP 15 -.PD -.TP -.PD -.B md5 -MD5 -.TP -.PD -.B sha1 -SHA1 -.TP -.PD -.B sha256 -SHA256 -.TP -.PD -.B sha512 -SHA512 -.TP -.PD -.B openssl -OpenSSL - -.SH SEE ALSO -For a more or less complete description of PHAR look here: -.PD 0 -.P -.B http://php.net/phar -.PD 1 -.P -.SH BUGS -You can view the list of known bugs or report any new bug you -found at: -.PD 0 -.P -.B http://bugs.php.net -.PD 1 -.SH AUTHORS -The PHP Group: Thies C. Arntzen, Stig Bakken, Andi Gutmans, Rasmus Lerdorf, Sam Ruby, Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski. -.P -Work for the PHP archive was done by Gregory Beaver, Marcus Boerger. -.P -A List of active developers can be found here: -.PD 0 -.P -.B http://www.php.net/credits.php -.PD 1 -.P -And last but not least PHP was developed with the help of a huge amount of -contributors all around the world. -.SH VERSION INFORMATION -This manpage describes \fBphar\fP, version @PHP_VERSION@. -.SH COPYRIGHT -Copyright \(co 1997\-2013 The PHP Group -.LP -This source file is subject to version 3.01 of the PHP license, -that is bundled with this package in the file LICENSE, and is -available through the world-wide-web at the following url: -.PD 0 -.P -.B http://www.php.net/license/3_01.txt -.PD 1 -.P -If you did not receive a copy of the PHP license and are unable to -obtain it through the world-wide-web, please send a note to -.B license@php.net -so we can mail you a copy immediately. diff --git a/ext/phar/phar.c b/ext/phar/phar.c index e8d1139cfa862..c5042cc34aceb 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -1964,7 +1964,7 @@ int phar_detect_phar_fname_ext(const char *filename, int filename_len, const cha zend_hash_internal_pointer_reset(&(PHAR_GLOBALS->phar_fname_map)); while (FAILURE != zend_hash_has_more_elements(&(PHAR_GLOBALS->phar_fname_map))) { - if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(&(PHAR_GLOBALS->phar_fname_map), &key, &keylen, &unused, 0, NULL)) { + if (HASH_KEY_NON_EXISTANT == zend_hash_get_current_key_ex(&(PHAR_GLOBALS->phar_fname_map), &key, &keylen, &unused, 0, NULL)) { break; } @@ -1994,7 +1994,7 @@ int phar_detect_phar_fname_ext(const char *filename, int filename_len, const cha zend_hash_internal_pointer_reset(&cached_phars); while (FAILURE != zend_hash_has_more_elements(&cached_phars)) { - if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(&cached_phars, &key, &keylen, &unused, 0, NULL)) { + if (HASH_KEY_NON_EXISTANT == zend_hash_get_current_key_ex(&cached_phars, &key, &keylen, &unused, 0, NULL)) { break; } @@ -2251,13 +2251,13 @@ char *phar_fix_filepath(char *path, int *new_len, int use_cwd TSRMLS_DC) /* {{{ * * This is used by phar_parse_url() */ -int phar_split_fname(const char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC) /* {{{ */ +int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC) /* {{{ */ { const char *ext_str; #ifdef PHP_WIN32 char *save; #endif - int ext_len; + int ext_len, free_filename = 0; if (!strncasecmp(filename, "phar://", 7)) { filename += 7; @@ -2266,6 +2266,7 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a ext_len = 0; #ifdef PHP_WIN32 + free_filename = 1; save = filename; filename = estrndup(filename, filename_len); phar_unixify_path_separators(filename, filename_len); @@ -2281,9 +2282,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a #endif } -#ifdef PHP_WIN32 - efree(filename); -#endif + if (free_filename) { + efree(filename); + } + return FAILURE; } @@ -2306,9 +2308,9 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a *entry = estrndup("/", 1); } -#ifdef PHP_WIN32 - efree(filename); -#endif + if (free_filename) { + efree(filename); + } return SUCCESS; } @@ -2577,7 +2579,6 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert, php_serialize_data_t metadata_hash; smart_str main_metadata_str = {0}; int free_user_stub, free_fp = 1, free_ufp = 1; - int manifest_hack = 0; if (phar->is_persistent) { if (error) { @@ -2929,12 +2930,6 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert, manifest_len = offset + phar->alias_len + sizeof(manifest) + main_metadata_str.len; phar_set_32(manifest, manifest_len); - /* Hack - see bug #65028, add padding byte to the end of the manifest */ - if(manifest[0] == '\r' || manifest[0] == '\n') { - manifest_len++; - phar_set_32(manifest, manifest_len); - manifest_hack = 1; - } phar_set_32(manifest+4, new_manifest_count); if (has_dirs) { *(manifest + 8) = (unsigned char) (((PHAR_API_VERSION) >> 8) & 0xFF); @@ -3059,22 +3054,6 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert, return EOF; } } - /* Hack - see bug #65028, add padding byte to the end of the manifest */ - if(manifest_hack) { - if(1 != php_stream_write(newfile, manifest, 1)) { - if (closeoldfile) { - php_stream_close(oldfile); - } - - php_stream_close(newfile); - - if (error) { - spprintf(error, 0, "unable to write manifest padding byte"); - } - - return EOF; - } - } /* now copy the actual file data to the new phar */ offset = php_stream_tell(newfile); diff --git a/ext/phar/phar.phar.1.in b/ext/phar/phar.phar.1.in deleted file mode 100644 index b5eecbfeba0ed..0000000000000 --- a/ext/phar/phar.phar.1.in +++ /dev/null @@ -1 +0,0 @@ -.so man1/phar.1 diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h index e0a9faf38fb2c..daa85f1b70f8b 100644 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -63,6 +63,9 @@ #include "ext/spl/spl_iterators.h" #endif #include "php_phar.h" +#ifdef HAVE_STDINT_H +#include +#endif #ifdef PHAR_HASH_OK #include "ext/hash/php_hash.h" #include "ext/hash/php_hash_sha.h" @@ -687,11 +690,11 @@ int phar_entry_delref(phar_entry_data *idata TSRMLS_DC); phar_entry_info *phar_get_entry_info(phar_archive_data *phar, char *path, int path_len, char **error, int security TSRMLS_DC); phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, int path_len, char dir, char **error, int security TSRMLS_DC); -phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC); -int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC); +phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, char *mode, char allow_dir, char **error, int security TSRMLS_DC); +int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, char *mode, char allow_dir, char **error, int security TSRMLS_DC); int phar_flush(phar_archive_data *archive, char *user_stub, long len, int convert, char **error TSRMLS_DC); int phar_detect_phar_fname_ext(const char *filename, int filename_len, const char **ext_str, int *ext_len, int executable, int for_create, int is_complete TSRMLS_DC); -int phar_split_fname(const char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC); +int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC); typedef enum { pcr_use_query, diff --git a/ext/phar/stream.c b/ext/phar/stream.c index d3d4cd655b33c..924138d8faaa0 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -56,7 +56,7 @@ php_stream_wrapper php_stream_phar_wrapper = { /** * Open a phar file for streams API */ -php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options TSRMLS_DC) /* {{{ */ +php_url* phar_parse_url(php_stream_wrapper *wrapper, char *filename, char *mode, int options TSRMLS_DC) /* {{{ */ { php_url *resource; char *arch = NULL, *entry = NULL, *error; @@ -155,7 +155,7 @@ php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const /** * used for fopen('phar://...') and company */ -static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ +static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ { phar_archive_data *phar; phar_entry_data *idata; @@ -563,7 +563,7 @@ static int phar_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D /** * Stream wrapper stat implementation of stat() */ -static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int flags, +static int phar_wrapper_stat(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) /* {{{ */ { php_url *resource = NULL; @@ -635,7 +635,7 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f zend_hash_internal_pointer_reset_ex(&phar->mounted_dirs, &pos); while (FAILURE != zend_hash_has_more_elements_ex(&phar->mounted_dirs, &pos)) { - if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(&phar->mounted_dirs, &key, &keylen, &unused, 0, &pos)) { + if (HASH_KEY_NON_EXISTANT == zend_hash_get_current_key_ex(&phar->mounted_dirs, &key, &keylen, &unused, 0, &pos)) { break; } PHAR_STR(key, str_key); @@ -686,7 +686,7 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f /** * Unlink a file within a phar archive */ -static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) /* {{{ */ +static int phar_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) /* {{{ */ { php_url *resource; char *internal_file, *error; @@ -762,7 +762,7 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int } /* }}} */ -static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC) /* {{{ */ +static int phar_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC) /* {{{ */ { php_url *resource_from, *resource_to; char *error; @@ -918,7 +918,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from uint to_len = strlen(resource_to->path+1); for (zend_hash_internal_pointer_reset(&phar->manifest); - HASH_KEY_NON_EXISTENT != (key_type = zend_hash_get_current_key_ex(&phar->manifest, &key, &key_len, &unused, 0, NULL)) && + HASH_KEY_NON_EXISTANT != (key_type = zend_hash_get_current_key_ex(&phar->manifest, &key, &key_len, &unused, 0, NULL)) && SUCCESS == zend_hash_get_current_data(&phar->manifest, (void **) &entry); zend_hash_move_forward(&phar->manifest)) { @@ -952,7 +952,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from } for (zend_hash_internal_pointer_reset(&phar->virtual_dirs); - HASH_KEY_NON_EXISTENT != (key_type = zend_hash_get_current_key_ex(&phar->virtual_dirs, &key, &key_len, &unused, 0, NULL)); + HASH_KEY_NON_EXISTANT != (key_type = zend_hash_get_current_key_ex(&phar->virtual_dirs, &key, &key_len, &unused, 0, NULL)); zend_hash_move_forward(&phar->virtual_dirs)) { PHAR_STR(key, str_key); @@ -979,7 +979,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from } for (zend_hash_internal_pointer_reset(&phar->mounted_dirs); - HASH_KEY_NON_EXISTENT != (key_type = zend_hash_get_current_key_ex(&phar->mounted_dirs, &key, &key_len, &unused, 0, NULL)) && + HASH_KEY_NON_EXISTANT != (key_type = zend_hash_get_current_key_ex(&phar->mounted_dirs, &key, &key_len, &unused, 0, NULL)) && SUCCESS == zend_hash_get_current_data(&phar->mounted_dirs, (void **) &entry); zend_hash_move_forward(&phar->mounted_dirs)) { diff --git a/ext/phar/stream.h b/ext/phar/stream.h index 0155759d12989..b22b67ab01749 100644 --- a/ext/phar/stream.h +++ b/ext/phar/stream.h @@ -21,13 +21,13 @@ BEGIN_EXTERN_C() -php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options TSRMLS_DC); +php_url* phar_parse_url(php_stream_wrapper *wrapper, char *filename, char *mode, int options TSRMLS_DC); void phar_entry_remove(phar_entry_data *idata, char **error TSRMLS_DC); -static php_stream* phar_wrapper_open_url(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); -static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC); -static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC); -static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); +static php_stream* phar_wrapper_open_url(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); +static int phar_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC); +static int phar_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); +static int phar_wrapper_stat(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); /* file/stream handlers */ static size_t phar_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC); diff --git a/ext/phar/tests/bug65028.phpt b/ext/phar/tests/bug65028.phpt deleted file mode 100644 index 74273b850b0e5..0000000000000 --- a/ext/phar/tests/bug65028.phpt +++ /dev/null @@ -1,156 +0,0 @@ ---TEST-- -Phar - test specific manifest length ---INI-- -phar.readonly=0 ---SKIPIF-- - ---FILE-- -addFromString($file, ""); -} - -// Copy phar -copy(__DIR__ . "/bug65028.phar", __DIR__ . "/bug65028-copy.phar"); - -// Open phar -try -{ - $phar = new Phar(__DIR__ . "/bug65028-copy.phar"); - echo "No exception thrown.\n"; -} -catch(UnexpectedValueException $ex) -{ - echo "Exception thrown: " . $ex->getMessage() . "\n"; -} -?> ---CLEAN-- - ---EXPECT-- -No exception thrown. - diff --git a/ext/phar/tests/phpinfo_004.phpt b/ext/phar/tests/phpinfo_004.phpt index c57e850d82f9f..24263f07bee69 100644 --- a/ext/phar/tests/phpinfo_004.phpt +++ b/ext/phar/tests/phpinfo_004.phpt @@ -23,9 +23,9 @@ phpinfo(INFO_MODULES); ?> ===DONE=== --EXPECTF-- -%a +%a

Phar

- +
@@ -36,20 +36,20 @@ phpinfo(INFO_MODULES); -
Phar: PHP Archive supportenabled
Phar EXT version %s
Phar API version 1.1.1
gzip compression enabled
bzip2 compression enabled
OpenSSL support disabled (install ext/openssl)
- +

+ -
Phar based on pear/PHP_Archive, original concept by Davey Shafik.
Phar fully realized by Gregory Beaver and Marcus Boerger.
Portions of tar implementation Copyright (c) %d-%d Tim Kientzle.
- +

+ -
DirectiveLocal ValueMaster Value
phar.cache_listno valueno value
phar.readonlyOffOff
phar.require_hashOffOff
-%a +
+%a

Phar

- +
@@ -60,16 +60,16 @@ Phar based on pear/PHP_Archive, original concept by Davey Shafik.
Phar full -
Phar: PHP Archive supportenabled
Phar EXT version %s
Phar API version 1.1.1
gzip compression enabled
bzip2 compression enabled
OpenSSL support disabled (install ext/openssl)
- +

+ -
Phar based on pear/PHP_Archive, original concept by Davey Shafik.
Phar fully realized by Gregory Beaver and Marcus Boerger.
Portions of tar implementation Copyright (c) %d-%d Tim Kientzle.
- +

+ -
DirectiveLocal ValueMaster Value
phar.cache_listno valueno value
phar.readonlyOnOff
phar.require_hashOnOff
-%a +
+%a
===DONE=== diff --git a/ext/phar/util.c b/ext/phar/util.c index 38aa549f00d57..898d8bd4b2146 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -572,7 +572,7 @@ char *phar_find_in_include_path(char *filename, int filename_len, phar_archive_d * appended, truncated, or read. For read, if the entry is marked unmodified, it is * assumed that the file pointer, if present, is opened for reading */ -int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC) /* {{{ */ +int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, char *mode, char allow_dir, char **error, int security TSRMLS_DC) /* {{{ */ { phar_archive_data *phar; phar_entry_info *entry; @@ -733,7 +733,7 @@ int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char /** * Create a new dummy file slot within a writeable phar for a newly created file */ -phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC) /* {{{ */ +phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, char *mode, char allow_dir, char **error, int security TSRMLS_DC) /* {{{ */ { phar_archive_data *phar; phar_entry_info *entry, etemp; @@ -1554,7 +1554,7 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, in zend_hash_internal_pointer_reset(&phar->mounted_dirs); while (FAILURE != zend_hash_has_more_elements(&phar->mounted_dirs)) { - if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(&phar->mounted_dirs, &key, &keylen, &unused, 0, NULL)) { + if (HASH_KEY_NON_EXISTANT == zend_hash_get_current_key_ex(&phar->mounted_dirs, &key, &keylen, &unused, 0, NULL)) { break; } diff --git a/ext/posix/tests/posix_ctermid.phpt b/ext/posix/tests/posix_ctermid.phpt index 551ed7304e21d..f77da00aabfa3 100644 --- a/ext/posix/tests/posix_ctermid.phpt +++ b/ext/posix/tests/posix_ctermid.phpt @@ -13,7 +13,7 @@ PHP Testfest Berlin 2009-05-10 } // needed because of #ifdef HAVE_CTERMID in posix.c if (!function_exists('posix_ctermid')) { - die('SKIP - Function posix_ctermid() not available'); + die('SKIP - Fuction posix_ctermid() not available'); } ?> --FILE-- diff --git a/ext/pspell/config.m4 b/ext/pspell/config.m4 index 481a9ae8918d7..67e5b2760526d 100644 --- a/ext/pspell/config.m4 +++ b/ext/pspell/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(pspell,for PSPELL support, -[ --with-pspell[=DIR] Include PSPELL support. +[ --with-pspell[=DIR] Include PSPELL support. GNU Aspell version 0.50.0 or higher required]) if test "$PHP_PSPELL" != "no"; then diff --git a/ext/readline/config.m4 b/ext/readline/config.m4 index 0a00370fce579..b1cb0b67e823b 100644 --- a/ext/readline/config.m4 +++ b/ext/readline/config.m4 @@ -3,11 +3,11 @@ dnl $Id$ dnl PHP_ARG_WITH(libedit,for libedit readline replacement, -[ --with-libedit[=DIR] Include libedit readline replacement (CLI/CGI only)]) +[ --with-libedit[=DIR] Include libedit readline replacement (CLI/CGI only)]) if test "$PHP_LIBEDIT" = "no"; then PHP_ARG_WITH(readline,for readline support, - [ --with-readline[=DIR] Include readline support (CLI/CGI only)]) + [ --with-readline[=DIR] Include readline support (CLI/CGI only)]) else dnl "register" the --with-readline option to preven invalid "unknown configure option" warning php_with_readline=no diff --git a/ext/recode/config.m4 b/ext/recode/config.m4 index 7f394d0465d2c..8df4cfc41a0fe 100644 --- a/ext/recode/config.m4 +++ b/ext/recode/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(recode,for recode support, -[ --with-recode[=DIR] Include recode support]) +[ --with-recode[=DIR] Include recode support]) if test "$PHP_RECODE" != "no"; then RECODE_LIST="$PHP_RECODE /usr/local /usr /opt" diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 8a5675b4dc436..b65ccaa26d919 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -114,8 +114,8 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection) /* {{{ Smart string functions */ typedef struct _string { char *string; - zend_str_size_int len; - zend_str_size_int alloced; + int len; + int alloced; } string; static void string_init(string *str) @@ -128,14 +128,14 @@ static void string_init(string *str) static string *string_printf(string *str, const char *format, ...) { - zend_str_size len; + int len; va_list arg; char *s_tmp; va_start(arg, format); len = zend_vspprintf(&s_tmp, 0, format, arg); if (len) { - register zend_str_size nlen = (str->len + len + (1024 - 1)) & ~(1024 - 1); + register int nlen = (str->len + len + (1024 - 1)) & ~(1024 - 1); if (str->alloced < nlen) { str->alloced = nlen; str->string = erealloc(str->string, str->alloced); @@ -148,9 +148,9 @@ static string *string_printf(string *str, const char *format, ...) return str; } -static string *string_write(string *str, char *buf, zend_str_size_int len) +static string *string_write(string *str, char *buf, int len) { - register zend_str_size nlen = (str->len + len + (1024 - 1)) & ~(1024 - 1); + register int nlen = (str->len + len + (1024 - 1)) & ~(1024 - 1); if (str->alloced < nlen) { str->alloced = nlen; str->string = erealloc(str->string, str->alloced); @@ -188,8 +188,8 @@ typedef struct _property_reference { /* Struct for parameters */ typedef struct _parameter_reference { - zend_str_size_uint offset; - zend_str_size_uint required; + zend_uint offset; + zend_uint required; struct _zend_arg_info *arg_info; zend_function *fptr; } parameter_reference; @@ -216,7 +216,7 @@ typedef struct { static zend_object_handlers reflection_object_handlers; -static void _default_get_entry(zval *object, char *name, zend_str_size_int name_len, zval *return_value TSRMLS_DC) /* {{{ */ +static void _default_get_entry(zval *object, char *name, int name_len, zval *return_value TSRMLS_DC) /* {{{ */ { zval **value; @@ -229,7 +229,7 @@ static void _default_get_entry(zval *object, char *name, zend_str_size_int name_ /* }}} */ #ifdef ilia_0 -static void _default_lookup_entry(zval *object, char *name, zend_str_size_int name_len, zval **return_value TSRMLS_DC) /* {{{ */ +static void _default_lookup_entry(zval *object, char *name, int name_len, zval **return_value TSRMLS_DC) /* {{{ */ { zval **value; @@ -435,7 +435,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in HashPosition pos; zval **value; char *key; - zend_str_size key_len; + uint key_len; ulong num_index; zend_hash_internal_pointer_reset_ex(&ce->constants_table, &pos); @@ -566,7 +566,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) { char *prop_name; - zend_str_size prop_name_size; + uint prop_name_size; ulong index; if (zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 1, &pos) == HASH_KEY_IS_STRING) { @@ -605,9 +605,9 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) { char *key; - zend_str_size key_len; + uint key_len; ulong num_index; - zend_str_size len = strlen(mptr->common.function_name); + uint len = strlen(mptr->common.function_name); /* Do not display old-style inherited constructors */ if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 @@ -741,8 +741,8 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg string_write(str, "NULL", sizeof("NULL")-1); } else if (Z_TYPE_P(zv) == IS_STRING) { string_write(str, "'", sizeof("'")-1); - string_write(str, Z_STRVAL_P(zv), MIN(Z_STRSIZE_P(zv), 15)); - if (Z_STRSIZE_P(zv) > 15) { + string_write(str, Z_STRVAL_P(zv), MIN(Z_STRLEN_P(zv), 15)); + if (Z_STRLEN_P(zv) > 15) { string_write(str, "...", sizeof("...")-1); } string_write(str, "'", sizeof("'")-1); @@ -750,7 +750,7 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg string_write(str, "Array", sizeof("Array")-1); } else { zend_make_printable_zval(zv, &zv_copy, &use_copy); - string_write(str, Z_STRVAL(zv_copy), Z_STRSIZE(zv_copy)); + string_write(str, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy)); if (use_copy) { zval_dtor(&zv_copy); } @@ -790,7 +790,7 @@ static void _function_closure_string(string *str, zend_function *fptr, char* ind zend_uint i, count; ulong num_index; char *key; - zend_str_size key_len; + uint key_len; HashTable *static_variables; HashPosition pos; @@ -824,7 +824,7 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry string param_indent; zend_function *overwrites; char *lc_name; - zend_str_size lc_name_len; + unsigned int lc_name_len; /* TBD: Repair indenting of doc comment (or is this to be done in the parser?) * What's "wrong" is that any whitespace before the doc comment start is @@ -1113,7 +1113,7 @@ static void _extension_string(string *str, zend_module_entry *module, char *inde /* Is there a better way of doing this? */ while (func->fname) { - zend_str_size fname_len = strlen(func->fname); + int fname_len = strlen(func->fname); char *lc_name = zend_str_tolower_dup(func->fname, fname_len); if (zend_hash_find(EG(function_table), lc_name, fname_len + 1, (void**) &fptr) == FAILURE) { @@ -1209,7 +1209,7 @@ static void reflection_extension_factory(zval *object, const char *name_str TSRM { reflection_object *intern; zval *name; - zend_str_size name_len = strlen(name_str); + int name_len = strlen(name_str); char *lcname; struct _zend_module_entry *module; ALLOCA_FLAG(use_heap) @@ -1607,7 +1607,7 @@ ZEND_METHOD(reflection_function, __construct) reflection_object *intern; zend_function *fptr; char *name_str; - zend_str_size name_len; + int name_len; object = getThis(); intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC); @@ -1618,7 +1618,7 @@ ZEND_METHOD(reflection_function, __construct) if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "O", &closure, zend_ce_closure) == SUCCESS) { fptr = (zend_function*)zend_get_closure_method_def(closure TSRMLS_CC); Z_ADDREF_P(closure); - } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name_str, &name_len) == SUCCESS) { + } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == SUCCESS) { char *nsname; lcname = zend_str_tolower_dup(name_str, name_len); @@ -2162,10 +2162,10 @@ ZEND_METHOD(reflection_parameter, __construct) /* First, find the function */ switch (Z_TYPE_P(reference)) { case IS_STRING: { - zend_str_size lcname_len; + unsigned int lcname_len; char *lcname; - lcname_len = Z_STRSIZE_P(reference); + lcname_len = Z_STRLEN_P(reference); lcname = zend_str_tolower_dup(Z_STRVAL_P(reference), lcname_len); if (zend_hash_find(EG(function_table), lcname, lcname_len + 1, (void**) &fptr) == FAILURE) { efree(lcname); @@ -2182,7 +2182,7 @@ ZEND_METHOD(reflection_parameter, __construct) zval **classref; zval **method; zend_class_entry **pce; - zend_str_size lcname_len; + unsigned int lcname_len; char *lcname; if ((zend_hash_index_find(Z_ARRVAL_P(reference), 0, (void **) &classref) == FAILURE) @@ -2196,7 +2196,7 @@ ZEND_METHOD(reflection_parameter, __construct) ce = Z_OBJCE_PP(classref); } else { convert_to_string_ex(classref); - if (zend_lookup_class(Z_STRVAL_PP(classref), Z_STRSIZE_PP(classref), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_PP(classref), Z_STRLEN_PP(classref), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_PP(classref)); return; @@ -2205,7 +2205,7 @@ ZEND_METHOD(reflection_parameter, __construct) } convert_to_string_ex(method); - lcname_len = Z_STRSIZE_PP(method); + lcname_len = Z_STRLEN_PP(method); lcname = zend_str_tolower_dup(Z_STRVAL_PP(method), lcname_len); if (ce == zend_ce_closure && Z_TYPE_PP(classref) == IS_OBJECT && (lcname_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) @@ -2647,7 +2647,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValueConstantName) precv = _reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAM_PASSTHRU, param); if (precv && (Z_TYPE_P(precv->op2.zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { - RETURN_STRINGL(Z_STRVAL_P(precv->op2.zv), Z_STRSIZE_P(precv->op2.zv), 1); + RETURN_STRINGL(Z_STRVAL_P(precv->op2.zv), Z_STRLEN_P(precv->op2.zv), 1); } } /* }}} */ @@ -2672,11 +2672,11 @@ ZEND_METHOD(reflection_method, __construct) zend_class_entry *ce; zend_function *mptr; char *name_str, *tmp; - zend_str_size name_len, tmp_len; + int name_len, tmp_len; zval ztmp; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "zS", &classname, &name_str, &name_len) == FAILURE) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "zs", &classname, &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) { return; } if ((tmp = strstr(name_str, "::")) == NULL) { @@ -2704,7 +2704,7 @@ ZEND_METHOD(reflection_method, __construct) /* Find the class entry */ switch (Z_TYPE_P(classname)) { case IS_STRING: - if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRSIZE_P(classname), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(classname)); if (classname == &ztmp) { @@ -3109,7 +3109,7 @@ ZEND_METHOD(reflection_function, inNamespace) RETURN_FALSE; } if (Z_TYPE_PP(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRSIZE_PP(name))) + && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name))) && backslash > Z_STRVAL_PP(name)) { RETURN_TRUE; @@ -3132,7 +3132,7 @@ ZEND_METHOD(reflection_function, getNamespaceName) RETURN_FALSE; } if (Z_TYPE_PP(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRSIZE_PP(name))) + && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name))) && backslash > Z_STRVAL_PP(name)) { RETURN_STRINGL(Z_STRVAL_PP(name), backslash - Z_STRVAL_PP(name), 1); @@ -3155,10 +3155,10 @@ ZEND_METHOD(reflection_function, getShortName) RETURN_FALSE; } if (Z_TYPE_PP(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRSIZE_PP(name))) + && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name))) && backslash > Z_STRVAL_PP(name)) { - RETURN_STRINGL(backslash + 1, Z_STRSIZE_PP(name) - (backslash - Z_STRVAL_PP(name) + 1), 1); + RETURN_STRINGL(backslash + 1, Z_STRLEN_PP(name) - (backslash - Z_STRVAL_PP(name) + 1), 1); } RETURN_ZVAL(*name, 1, 0); } @@ -3320,7 +3320,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob } } else { convert_to_string_ex(&argument); - if (zend_lookup_class(Z_STRVAL_P(argument), Z_STRSIZE_P(argument), &ce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(argument), Z_STRLEN_P(argument), &ce TSRMLS_CC) == FAILURE) { if (!EG(exception)) { zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(argument)); } @@ -3352,7 +3352,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value zend_property_info *prop_info; zval *prop, *prop_copy; char *key; - zend_str_size key_len; + uint key_len; ulong num_index; zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos); @@ -3423,10 +3423,10 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue) reflection_object *intern; zend_class_entry *ce; char *name; - zend_str_size name_len; + int name_len; zval **prop, *def_value = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|z", &name, &name_len, &def_value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &name, &name_len, &def_value) == FAILURE) { return; } @@ -3455,12 +3455,12 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue) reflection_object *intern; zend_class_entry *ce; char *name; - zend_str_size name_len; + int name_len; zval **variable_ptr, *value; int refcount; zend_uchar is_ref; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &name, &name_len, &value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name, &name_len, &value) == FAILURE) { return; } @@ -3660,10 +3660,10 @@ ZEND_METHOD(reflection_class, hasMethod) reflection_object *intern; zend_class_entry *ce; char *name, *lc_name; - zend_str_size name_len; + int name_len; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; } @@ -3690,10 +3690,10 @@ ZEND_METHOD(reflection_class, getMethod) zend_function *mptr; zval obj_tmp; char *name, *lc_name; - zend_str_size name_len; + int name_len; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; } @@ -3731,7 +3731,7 @@ ZEND_METHOD(reflection_class, getMethod) static void _addmethod(zend_function *mptr, zend_class_entry *ce, zval *retval, long filter, zval *obj TSRMLS_DC) { zval *method; - zend_str_size len = strlen(mptr->common.function_name); + uint len = strlen(mptr->common.function_name); zend_function *closure; if (mptr->common.fn_flags & filter) { @@ -3805,11 +3805,11 @@ ZEND_METHOD(reflection_class, hasProperty) zend_property_info *property_info; zend_class_entry *ce; char *name; - zend_str_size name_len; + int name_len; zval *property; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; } @@ -3842,10 +3842,10 @@ ZEND_METHOD(reflection_class, getProperty) zend_class_entry *ce, **pce; zend_property_info *property_info; char *name, *tmp, *classname; - zend_str_size name_len, classname_len; + int name_len, classname_len; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; } @@ -3992,10 +3992,10 @@ ZEND_METHOD(reflection_class, hasConstant) reflection_object *intern; zend_class_entry *ce; char *name; - zend_str_size name_len; + int name_len; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; } @@ -4034,10 +4034,10 @@ ZEND_METHOD(reflection_class, getConstant) zend_class_entry *ce; zval **value; char *name; - zend_str_size name_len; + int name_len; METHOD_NOTSTATIC(reflection_class_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; } @@ -4534,7 +4534,7 @@ ZEND_METHOD(reflection_class, isSubclassOf) switch(class_name->type) { case IS_STRING: - if (zend_lookup_class(Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(class_name)); return; @@ -4579,7 +4579,7 @@ ZEND_METHOD(reflection_class, implementsInterface) switch(interface->type) { case IS_STRING: - if (zend_lookup_class(Z_STRVAL_P(interface), Z_STRSIZE_P(interface), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(interface), Z_STRLEN_P(interface), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Interface %s does not exist", Z_STRVAL_P(interface)); return; @@ -4686,7 +4686,7 @@ ZEND_METHOD(reflection_class, inNamespace) RETURN_FALSE; } if (Z_TYPE_PP(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRSIZE_PP(name))) + && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name))) && backslash > Z_STRVAL_PP(name)) { RETURN_TRUE; @@ -4709,7 +4709,7 @@ ZEND_METHOD(reflection_class, getNamespaceName) RETURN_FALSE; } if (Z_TYPE_PP(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRSIZE_PP(name))) + && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name))) && backslash > Z_STRVAL_PP(name)) { RETURN_STRINGL(Z_STRVAL_PP(name), backslash - Z_STRVAL_PP(name), 1); @@ -4732,10 +4732,10 @@ ZEND_METHOD(reflection_class, getShortName) RETURN_FALSE; } if (Z_TYPE_PP(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRSIZE_PP(name))) + && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name))) && backslash > Z_STRVAL_PP(name)) { - RETURN_STRINGL(backslash + 1, Z_STRSIZE_PP(name) - (backslash - Z_STRVAL_PP(name) + 1), 1); + RETURN_STRINGL(backslash + 1, Z_STRLEN_PP(name) - (backslash - Z_STRVAL_PP(name) + 1), 1); } RETURN_ZVAL(*name, 1, 0); } @@ -4772,8 +4772,7 @@ ZEND_METHOD(reflection_property, __construct) zval *propname, *classname; char *name_str; const char *class_name, *prop_name; - zend_str_size name_len; - int dynam_prop = 0; + int name_len, dynam_prop = 0; zval *object; reflection_object *intern; zend_class_entry **pce; @@ -4781,7 +4780,7 @@ ZEND_METHOD(reflection_property, __construct) zend_property_info *property_info = NULL; property_reference *reference; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &classname, &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &classname, &name_str, &name_len) == FAILURE) { return; } @@ -4794,7 +4793,7 @@ ZEND_METHOD(reflection_property, __construct) /* Find the class entry */ switch (Z_TYPE_P(classname)) { case IS_STRING: - if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRSIZE_P(classname), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &pce TSRMLS_CC) == FAILURE) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(classname)); return; @@ -4854,7 +4853,7 @@ ZEND_METHOD(reflection_property, __construct) if (dynam_prop) { reference->prop.flags = ZEND_ACC_IMPLICIT_PUBLIC; reference->prop.name = Z_STRVAL_P(propname); - reference->prop.name_length = Z_STRSIZE_P(propname); + reference->prop.name_length = Z_STRLEN_P(propname); reference->prop.h = zend_get_hash_value(name_str, name_len+1); reference->prop.doc_comment = NULL; reference->prop.ce = ce; @@ -5092,7 +5091,7 @@ ZEND_METHOD(reflection_property, getDeclaringClass) zend_class_entry *tmp_ce, *ce; zend_property_info *tmp_info; const char *prop_name, *class_name; - zend_str_size prop_name_len; + int prop_name_len; if (zend_parse_parameters_none() == FAILURE) { return; @@ -5179,10 +5178,10 @@ ZEND_METHOD(reflection_extension, __construct) reflection_object *intern; zend_module_entry *module; char *name_str; - zend_str_size name_len; + int name_len; ALLOCA_FLAG(use_heap) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) { return; } @@ -5260,7 +5259,7 @@ ZEND_METHOD(reflection_extension, getVersion) /* }}} */ /* {{{ proto public ReflectionFunction[] ReflectionExtension::getFunctions() - Returns an array of this extension's functions */ + Returns an array of this extension's fuctions */ ZEND_METHOD(reflection_extension, getFunctions) { reflection_object *intern; @@ -5279,7 +5278,7 @@ ZEND_METHOD(reflection_extension, getFunctions) /* Is there a better way of doing this? */ while (func->fname) { - zend_str_size fname_len = strlen(func->fname); + int fname_len = strlen(func->fname); char *lc_name = zend_str_tolower_dup(func->fname, fname_len); if (zend_hash_find(EG(function_table), lc_name, fname_len + 1, (void**) &fptr) == FAILURE) { @@ -5446,7 +5445,7 @@ ZEND_METHOD(reflection_extension, getDependencies) while(dep->name) { char *relation; char *rel_type; - zend_str_size len; + int len; switch(dep->type) { case MODULE_DEP_REQUIRED: @@ -5540,9 +5539,9 @@ ZEND_METHOD(reflection_zend_extension, __construct) reflection_object *intern; zend_extension *extension; char *name_str; - zend_str_size name_len; + int name_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name_str, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) { return; } @@ -6082,9 +6081,9 @@ static zend_object_handlers *zend_std_obj_handlers; static void _reflection_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC) { if ((Z_TYPE_P(member) == IS_STRING) - && zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STRVAL_P(member), Z_STRSIZE_P(member)+1) - && ((Z_STRSIZE_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name"))) - || (Z_STRSIZE_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class"))))) + && zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1) + && ((Z_STRLEN_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name"))) + || (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class"))))) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot set read-only property %s::$%s", Z_OBJCE_P(object)->name, Z_STRVAL_P(member)); diff --git a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt index dfec951f79903..465e868cfa5f1 100644 --- a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt +++ b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -ReflectionExtension::getClassNames() method on an extension which actually returns some information +ReflectionExtension::getClassNames() method on an extension which acually returns some information --CREDITS-- Felix De Vliegher --FILE-- diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index e5733b44f447c..053c617dec232 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -61,9 +61,40 @@ typedef struct { } ps_files; ps_module ps_mod_files = { - PS_MOD_SID(files) + PS_MOD(files) }; +/* If you change the logic here, please also update the error message in + * ps_files_open() appropriately */ +static int ps_files_valid_key(const char *key) +{ + size_t len; + const char *p; + char c; + int ret = 1; + + for (p = key; (c = *p); p++) { + /* valid characters are a..z,A..Z,0..9 */ + if (!((c >= 'a' && c <= 'z') + || (c >= 'A' && c <= 'Z') + || (c >= '0' && c <= '9') + || c == ',' + || c == '-')) { + ret = 0; + break; + } + } + + len = p - key; + + /* Somewhat arbitrary length limit here, but should be way more than + anyone needs and avoids file-level warnings later on if we exceed MAX_PATH */ + if (len == 0 || len > 128) { + ret = 0; + } + + return ret; +} static char *ps_files_path_create(char *buf, size_t buflen, ps_files *data, const char *key) { @@ -124,11 +155,11 @@ static void ps_files_open(ps_files *data, const char *key TSRMLS_DC) ps_files_close(data); - if (php_session_valid_key(key) == FAILURE) { + if (!ps_files_valid_key(key)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,'"); + PS(invalid_session_id) = 1; return; } - if (!ps_files_path_create(buf, sizeof(buf), data, key)) { return; } @@ -222,21 +253,6 @@ static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC) return (nrdels); } -static int ps_files_key_exists(ps_files *data, const char *key TSRMLS_DC) -{ - char buf[MAXPATHLEN]; - struct stat sbuf; - - if (!key || !ps_files_path_create(buf, sizeof(buf), data, key)) { - return FAILURE; - } - if (VCWD_STAT(buf, &sbuf)) { - return FAILURE; - } - return SUCCESS; -} - - #define PS_FILES_DATA ps_files *data = PS_GET_MOD_DATA() PS_OPEN_FUNC(files) @@ -326,24 +342,6 @@ PS_READ_FUNC(files) struct stat sbuf; PS_FILES_DATA; - /* If strict mode, check session id existence */ - if (PS(use_strict_mode) && - ps_files_key_exists(data, key TSRMLS_CC) == FAILURE) { - /* key points to PS(id), but cannot change here. */ - if (key) { - efree(PS(id)); - PS(id) = NULL; - } - PS(id) = PS(mod)->s_create_sid((void **)&data, NULL TSRMLS_CC); - if (!PS(id)) { - return FAILURE; - } - php_session_reset_id(TSRMLS_C); - if (PS(use_cookies)) { - PS(send_cookie) = 1; - } - } - ps_files_open(data, key TSRMLS_CC); if (data->fd < 0) { return FAILURE; @@ -456,30 +454,6 @@ PS_GC_FUNC(files) return SUCCESS; } -PS_CREATE_SID_FUNC(files) -{ - char *sid; - int maxfail = 3; - PS_FILES_DATA; - - do { - sid = php_session_create_id((void **)&data, newlen TSRMLS_CC); - /* Check collision */ - if (data && ps_files_key_exists(data, sid TSRMLS_CC) == SUCCESS) { - if (sid) { - efree(sid); - sid = NULL; - } - if (!(maxfail--)) { - return NULL; - } - } - } while(!sid); - - return sid; -} - - /* * Local variables: * tab-width: 4 diff --git a/ext/session/mod_files.h b/ext/session/mod_files.h index 94cbd6d025de2..c97d168b1ee17 100644 --- a/ext/session/mod_files.h +++ b/ext/session/mod_files.h @@ -24,6 +24,6 @@ extern ps_module ps_mod_files; #define ps_files_ptr &ps_mod_files -PS_FUNCS_SID(files); +PS_FUNCS(files); #endif diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c index 69c0da7bdb9aa..e0d16d1924e83 100644 --- a/ext/session/mod_mm.c +++ b/ext/session/mod_mm.c @@ -124,7 +124,7 @@ static ps_sd *ps_sd_new(ps_mm *data, const char *key) if (!sd) { TSRMLS_FETCH(); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "mm_malloc failed, avail %ld, err %s", mm_available(data->mm), mm_error()); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "mm_malloc failed, avail %d, err %s", mm_available(data->mm), mm_error()); return NULL; } @@ -208,22 +208,8 @@ static ps_sd *ps_sd_lookup(ps_mm *data, const char *key, int rw) return ret; } -static int ps_mm_key_exists(ps_mm *data, const char *key TSRMLS_DC) -{ - ps_sd *sd; - - if (!key) { - return FAILURE; - } - sd = ps_sd_lookup(data, key, 0); - if (sd) { - return SUCCESS; - } - return FAILURE; -} - ps_module ps_mod_mm = { - PS_MOD_SID(mm) + PS_MOD(mm) }; #define PS_MM_DATA ps_mm *data = PS_GET_MOD_DATA() @@ -355,24 +341,6 @@ PS_READ_FUNC(mm) mm_lock(data->mm, MM_LOCK_RD); - /* If there is an ID and strict mode, verify existence */ - if (PS(use_strict_mode) - && ps_mm_key_exists(data, key TSRMLS_CC) == FAILURE) { - /* key points to PS(id), but cannot change here. */ - if (key) { - efree(PS(id)); - PS(id) = NULL; - } - PS(id) = PS(mod)->s_create_sid((void **)&data, NULL TSRMLS_CC); - if (!PS(id)) { - return FAILURE; - } - php_session_reset_id(TSRMLS_C); - if (PS(use_cookies)) { - PS(send_cookie) = 1; - } - } - sd = ps_sd_lookup(data, key, 0); if (sd) { *vallen = sd->datalen; @@ -476,29 +444,6 @@ PS_GC_FUNC(mm) return SUCCESS; } -PS_CREATE_SID_FUNC(mm) -{ - char *sid; - int maxfail = 3; - PS_MM_DATA; - - do { - sid = php_session_create_id((void **)&data, newlen TSRMLS_CC); - /* Check collision */ - if (ps_mm_key_exists(data, sid TSRMLS_CC) == SUCCESS) { - if (sid) { - efree(sid); - sid = NULL; - } - if (!(maxfail--)) { - return NULL; - } - } - } while(!sid); - - return sid; -} - #endif /* diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index 82fd419fcf892..e4261df29493f 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -187,6 +187,7 @@ PS_CREATE_SID_FUNC(user) { /* maintain backwards compatibility */ if (PSF(create_sid) != NULL) { + zval *args[1]; char *id = NULL; STDVARS; diff --git a/ext/session/php_session.h b/ext/session/php_session.h index 4307e6afc5c14..1dd5b1a1a613e 100644 --- a/ext/session/php_session.h +++ b/ext/session/php_session.h @@ -29,9 +29,6 @@ #define PHP_SESSION_API 20020330 -/* To check php_session_valid_key()/php_session_reset_id() */ -#define PHP_SESSION_STRICT 1 - #define PS_OPEN_ARGS void **mod_data, const char *save_path, const char *session_name TSRMLS_DC #define PS_CLOSE_ARGS void **mod_data TSRMLS_DC #define PS_READ_ARGS void **mod_data, const char *key, char **val, int *vallen TSRMLS_DC @@ -78,7 +75,7 @@ typedef struct ps_module_struct { #x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \ ps_delete_##x, ps_gc_##x, php_session_create_id -/* SID creation enabled module handler definitions */ +/* SID enabled module handler definitions */ #define PS_FUNCS_SID(x) \ PS_OPEN_FUNC(x); \ PS_CLOSE_FUNC(x); \ @@ -178,9 +175,6 @@ typedef struct _php_ps_globals { smart_str rfc1867_name; /* session.upload_progress.name */ long rfc1867_freq; /* session.upload_progress.freq */ double rfc1867_min_freq; /* session.upload_progress.min_freq */ - - zend_bool use_strict_mode; /* whether or not PHP accepts unknown session ids */ - unsigned char session_data_hash[16]; /* binary MD5 hash length */ } php_ps_globals; typedef php_ps_globals zend_ps_globals; @@ -236,9 +230,6 @@ PHPAPI void php_session_start(TSRMLS_D); PHPAPI ps_module *_php_find_ps_module(char *name TSRMLS_DC); PHPAPI const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC); -PHPAPI int php_session_valid_key(const char *key); -PHPAPI void php_session_reset_id(TSRMLS_D); - #define PS_ADD_VARL(name,namelen) do { \ php_add_session_var(name, namelen TSRMLS_CC); \ } while (0) @@ -263,7 +254,7 @@ PHPAPI void php_session_reset_id(TSRMLS_D); int key_type; \ \ for (zend_hash_internal_pointer_reset(_ht); \ - (key_type = zend_hash_get_current_key_ex(_ht, &key, &key_length, &num_key, 0, NULL)) != HASH_KEY_NON_EXISTENT; \ + (key_type = zend_hash_get_current_key_ex(_ht, &key, &key_length, &num_key, 0, NULL)) != HASH_KEY_NON_EXISTANT; \ zend_hash_move_forward(_ht)) { \ if (key_type == HASH_KEY_IS_LONG) { \ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Skipping numeric key %ld", num_key); \ diff --git a/ext/session/session.c b/ext/session/session.c index 606c334161bc8..48b9d1157744f 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -86,8 +86,6 @@ zend_class_entry *php_session_id_iface_entry; return FAILURE; \ } -static void php_session_send_cookie(TSRMLS_D); - /* Dispatched by RINIT and by php_session_destroy */ static inline void php_rinit_session_globals(TSRMLS_D) /* {{{ */ { @@ -128,7 +126,7 @@ static int php_session_destroy(TSRMLS_D) /* {{{ */ return FAILURE; } - if (PS(id) && PS(mod)->s_destroy(&PS(mod_data), PS(id) TSRMLS_CC) == FAILURE) { + if (PS(mod)->s_destroy(&PS(mod_data), PS(id) TSRMLS_CC) == FAILURE) { retval = FAILURE; php_error_docref(NULL TSRMLS_CC, E_WARNING, "Session object destruction failed"); } @@ -346,7 +344,7 @@ PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */ unsigned char rbuf[2048]; size_t toread = PS(entropy_length); - if (php_win32_get_random_bytes(rbuf, MIN(toread, sizeof(rbuf))) == SUCCESS){ + if (php_win32_get_random_bytes(rbuf, (size_t) toread) == SUCCESS){ switch (PS(hash_func)) { case PS_HASH_FUNC_MD5: @@ -430,45 +428,17 @@ PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */ } /* }}} */ -/* Default session id char validation function allowed by ps_modules. - * If you change the logic here, please also update the error message in - * ps_modules appropriately */ -PHPAPI int php_session_valid_key(const char *key) /* {{{ */ -{ - size_t len; - const char *p; - char c; - int ret = SUCCESS; - - for (p = key; (c = *p); p++) { - /* valid characters are a..z,A..Z,0..9 */ - if (!((c >= 'a' && c <= 'z') - || (c >= 'A' && c <= 'Z') - || (c >= '0' && c <= '9') - || c == ',' - || c == '-')) { - ret = FAILURE; - break; - } - } - - len = p - key; - - /* Somewhat arbitrary length limit here, but should be way more than - anyone needs and avoids file-level warnings later on if we exceed MAX_PATH */ - if (len == 0 || len > 128) { - ret = FAILURE; - } - - return ret; -} -/* }}} */ - static void php_session_initialize(TSRMLS_D) /* {{{ */ { - char *val = NULL; + char *val; int vallen; + /* check session name for invalid characters */ + if (PS(id) && strpbrk(PS(id), "\r\n\t <>'\"\\")) { + efree(PS(id)); + PS(id) = NULL; + } + if (!PS(mod)) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "No storage module chosen - failed to initialize session"); return; @@ -482,47 +452,28 @@ static void php_session_initialize(TSRMLS_D) /* {{{ */ /* If there is no ID, use session module to create one */ if (!PS(id)) { +new_session: PS(id) = PS(mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC); - if (!PS(id)) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path)); - return; - } if (PS(use_cookies)) { PS(send_cookie) = 1; } } - php_session_reset_id(TSRMLS_C); - PS(session_status) = php_session_active; - /* Read data */ + /* Question: if you create a SID here, should you also try to read data? + * I'm not sure, but while not doing so will remove one session operation + * it could prove usefull for those sites which wish to have "default" + * session information. */ php_session_track_init(TSRMLS_C); - if (PS(mod)->s_read(&PS(mod_data), PS(id), &val, &vallen TSRMLS_CC) == FAILURE) { - /* Some broken save handler implementation returns FAILURE for non-existent session ID */ - /* It's better to rase error for this, but disabled error for better compatibility */ - /* - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Failed to read session data: %s (path: %s)", PS(mod)->s_name, PS(save_path)); - */ - } - if (val) { - PHP_MD5_CTX context; - - /* Store read data's MD5 hash */ - PHP_MD5Init(&context); - PHP_MD5Update(&context, val, vallen); - PHP_MD5Final(PS(session_data_hash), &context); - + PS(invalid_session_id) = 0; + if (PS(mod)->s_read(&PS(mod_data), PS(id), &val, &vallen TSRMLS_CC) == SUCCESS) { php_session_decode(val, vallen TSRMLS_CC); efree(val); - } else { - memset(PS(session_data_hash),'\0', 16); - } - - if (!PS(use_cookies) && PS(send_cookie)) { - if (PS(use_trans_sid) && !PS(use_only_cookies)) { - PS(apply_trans_sid) = 1; - } - PS(send_cookie) = 0; + } else if (PS(invalid_session_id)) { /* address instances where the session read fails due to an invalid id */ + PS(invalid_session_id) = 0; + efree(PS(id)); + PS(id) = NULL; + goto new_session; } } /* }}} */ @@ -538,19 +489,7 @@ static void php_session_save_current_state(TSRMLS_D) /* {{{ */ val = php_session_encode(&vallen TSRMLS_CC); if (val) { - PHP_MD5_CTX context; - unsigned char digest[16]; - - /* Generate data's MD5 hash */ - PHP_MD5Init(&context); - PHP_MD5Update(&context, val, vallen); - PHP_MD5Final(digest, &context); - /* Write only when save is required */ - if (memcmp(digest, PS(session_data_hash), 16)) { - ret = PS(mod)->s_write(&PS(mod_data), PS(id), val, vallen TSRMLS_CC); - } else { - ret = SUCCESS; - } + ret = PS(mod)->s_write(&PS(mod_data), PS(id), val, vallen TSRMLS_CC); efree(val); } else { ret = PS(mod)->s_write(&PS(mod_data), PS(id), "", 0 TSRMLS_CC); @@ -748,7 +687,6 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */ } #endif /* HAVE_HASH_EXT }}} */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "session.configuration 'session.hash_function' must be existing hash function. %s does not exist.", new_value); return FAILURE; } /* }}} */ @@ -798,7 +736,7 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("session.save_path", "", PHP_INI_ALL, OnUpdateSaveDir,save_path, php_ps_globals, ps_globals) STD_PHP_INI_ENTRY("session.name", "PHPSESSID", PHP_INI_ALL, OnUpdateName, session_name, php_ps_globals, ps_globals) PHP_INI_ENTRY("session.save_handler", "files", PHP_INI_ALL, OnUpdateSaveHandler) - STD_PHP_INI_BOOLEAN("session.auto_start", "0", PHP_INI_PERDIR, OnUpdateBool, auto_start, php_ps_globals, ps_globals) + STD_PHP_INI_BOOLEAN("session.auto_start", "0", PHP_INI_ALL, OnUpdateBool, auto_start, php_ps_globals, ps_globals) STD_PHP_INI_ENTRY("session.gc_probability", "1", PHP_INI_ALL, OnUpdateLong, gc_probability, php_ps_globals, ps_globals) STD_PHP_INI_ENTRY("session.gc_divisor", "100", PHP_INI_ALL, OnUpdateLong, gc_divisor, php_ps_globals, ps_globals) STD_PHP_INI_ENTRY("session.gc_maxlifetime", "1440", PHP_INI_ALL, OnUpdateLong, gc_maxlifetime, php_ps_globals, ps_globals) @@ -810,7 +748,6 @@ PHP_INI_BEGIN() STD_PHP_INI_BOOLEAN("session.cookie_httponly", "", PHP_INI_ALL, OnUpdateBool, cookie_httponly, php_ps_globals, ps_globals) STD_PHP_INI_BOOLEAN("session.use_cookies", "1", PHP_INI_ALL, OnUpdateBool, use_cookies, php_ps_globals, ps_globals) STD_PHP_INI_BOOLEAN("session.use_only_cookies", "1", PHP_INI_ALL, OnUpdateBool, use_only_cookies, php_ps_globals, ps_globals) - STD_PHP_INI_BOOLEAN("session.use_strict_mode", "0", PHP_INI_ALL, OnUpdateBool, use_strict_mode, php_ps_globals, ps_globals) STD_PHP_INI_ENTRY("session.referer_check", "", PHP_INI_ALL, OnUpdateString, extern_referer_chk, php_ps_globals, ps_globals) #if HAVE_DEV_URANDOM STD_PHP_INI_ENTRY("session.entropy_file", "/dev/urandom", PHP_INI_ALL, OnUpdateString, entropy_file, php_ps_globals, ps_globals) @@ -1118,7 +1055,7 @@ static inline void strcpy_gmt(char *ubuf, time_t *when) /* {{{ */ res = php_gmtime_r(when, &tm); if (!res) { - ubuf[0] = '\0'; + buf[0] = '\0'; return; } @@ -1360,15 +1297,10 @@ PHPAPI const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC) /* {{{ convert_to_string((*ppid)); \ PS(id) = estrndup(Z_STRVAL_PP(ppid), Z_STRLEN_PP(ppid)) -PHPAPI void php_session_reset_id(TSRMLS_D) /* {{{ */ +static void php_session_reset_id(TSRMLS_D) /* {{{ */ { int module_number = PS(module_number); - if (!PS(id)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot set session ID - session ID is not initialized"); - return; - } - if (PS(use_cookies) && PS(send_cookie)) { php_session_send_cookie(TSRMLS_C); PS(send_cookie) = 0; @@ -1515,14 +1447,19 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */ } } - /* Finally check session id for dangarous characters - * Security note: session id may be embedded in HTML pages.*/ - if (PS(id) && strpbrk(PS(id), "\r\n\t <>'\"\\")) { - efree(PS(id)); - PS(id) = NULL; + php_session_initialize(TSRMLS_C); + + if (!PS(use_cookies) && PS(send_cookie)) { + if (PS(use_trans_sid) && !PS(use_only_cookies)) { + PS(apply_trans_sid) = 1; + } + PS(send_cookie) = 0; } - php_session_initialize(TSRMLS_C); + php_session_reset_id(TSRMLS_C); + + PS(session_status) = php_session_active; + php_session_cache_limiter(TSRMLS_C); if ((PS(mod_data) || PS(mod_user_implemented)) && PS(gc_probability) > 0) { @@ -1550,26 +1487,6 @@ static void php_session_flush(TSRMLS_D) /* {{{ */ } /* }}} */ -static void php_session_abort(TSRMLS_D) /* {{{ */ -{ - if (PS(session_status) == php_session_active) { - PS(session_status) = php_session_none; - if (PS(mod_data) || PS(mod_user_implemented)) { - PS(mod)->s_close(&PS(mod_data) TSRMLS_CC); - } - } -} -/* }}} */ - -static void php_session_reset(TSRMLS_D) /* {{{ */ -{ - if (PS(session_status) == php_session_active) { - php_session_initialize(TSRMLS_C); - } -} -/* }}} */ - - PHPAPI void session_adapt_url(const char *url, size_t urllen, char **new, size_t *newlen TSRMLS_DC) /* {{{ */ { if (PS(apply_trans_sid) && (PS(session_status) == php_session_active)) { @@ -1688,31 +1605,6 @@ static PHP_FUNCTION(session_module_name) } /* }}} */ -/* {{{ proto mixed session_serializer_name([string newname]) - Return the current serializer name used for encode/decode session data. If newname is given, the serialzer name is replaced with newname and return bool */ -static PHP_FUNCTION(session_serializer_name) -{ - char *name = NULL; - int name_len; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) { - return; - } - - /* Return serializer name */ - if (!name) { - RETURN_STRING(zend_ini_string("session.serialize_handler", sizeof("session.serialize_handler"), 0), 1); - } - - /* Set serializer name */ - if (zend_alter_ini_entry("session.serialize_handler", sizeof("session.serialize_handler"), name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME) == SUCCESS) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } -} -/* }}} */ - /* {{{ proto void session_set_save_handler(string open, string close, string read, string write, string destroy, string gc, string create_sid) Sets user-level functions */ static PHP_FUNCTION(session_set_save_handler) @@ -1883,9 +1775,9 @@ static PHP_FUNCTION(session_save_path) static PHP_FUNCTION(session_id) { char *name = NULL; - int name_len, argc = ZEND_NUM_ARGS(); + int name_len; - if (zend_parse_parameters(argc TSRMLS_CC, "|s", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) { return; } @@ -1930,13 +1822,11 @@ static PHP_FUNCTION(session_regenerate_id) } PS(id) = PS(mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC); - if (PS(id)) { - PS(send_cookie) = 1; - php_session_reset_id(TSRMLS_C); - RETURN_TRUE; - } else { - PS(id) = STR_EMPTY_ALLOC(); - } + + PS(send_cookie) = 1; + php_session_reset_id(TSRMLS_C); + + RETURN_TRUE; } RETURN_FALSE; } @@ -2076,22 +1966,6 @@ static PHP_FUNCTION(session_write_close) } /* }}} */ -/* {{{ proto void session_abort(void) - Abort session and end session. Session data will not be written */ -static PHP_FUNCTION(session_abort) -{ - php_session_abort(TSRMLS_C); -} -/* }}} */ - -/* {{{ proto void session_reset(void) - Reset session data from saved session data */ -static PHP_FUNCTION(session_reset) -{ - php_session_reset(TSRMLS_C); -} -/* }}} */ - /* {{{ proto int session_status(void) Returns the current session status */ static PHP_FUNCTION(session_status) @@ -2104,39 +1978,6 @@ static PHP_FUNCTION(session_status) } /* }}} */ -/* {{{ proto int session_gc([int maxlifetime]) - Execute garbage collection returns number of deleted data */ -static PHP_FUNCTION(session_gc) -{ - int nrdels = -1; - long maxlifetime = PS(gc_maxlifetime); - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &maxlifetime) == FAILURE) { - return; - } - - /* Session must be active to have PS(mod) */ - if (PS(session_status) != php_session_active) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to garbage collect without active session"); - RETURN_FALSE; - } - - if (!PS(mod) || !PS(mod)->s_gc) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Session save handler does not have gc()"); - RETURN_FALSE; - } - PS(mod)->s_gc(&PS(mod_data), maxlifetime, &nrdels TSRMLS_CC); - - if (nrdels < 0) { - /* Files save handler return -1 if there is not a permission to remove. - Save handlder should return negative nrdels when something wrong. */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Session gc failed. Check permission or session storage"); - RETURN_FALSE; - } - RETURN_LONG((long)nrdels); -} -/* }}} */ - /* {{{ proto void session_register_shutdown(void) Registers session_write_close() as a shutdown function */ static PHP_FUNCTION(session_register_shutdown) @@ -2183,10 +2024,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_session_module_name, 0, 0, 0) ZEND_ARG_INFO(0, module) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_session_serializer_name, 0, 0, 0) - ZEND_ARG_INFO(0, module) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_session_save_path, 0, 0, 0) ZEND_ARG_INFO(0, path) ZEND_END_ARG_INFO() @@ -2232,10 +2069,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_session_set_cookie_params, 0, 0, 1) ZEND_ARG_INFO(0, httponly) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_session_gc, 0) - ZEND_ARG_INFO(0, maxlifetime) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO(arginfo_session_class_open, 0) ZEND_ARG_INFO(0, save_path) ZEND_ARG_INFO(0, session_name) @@ -2270,7 +2103,6 @@ ZEND_END_ARG_INFO() static const zend_function_entry session_functions[] = { PHP_FE(session_name, arginfo_session_name) PHP_FE(session_module_name, arginfo_session_module_name) - PHP_FE(session_serializer_name, arginfo_session_serializer_name) PHP_FE(session_save_path, arginfo_session_save_path) PHP_FE(session_id, arginfo_session_id) PHP_FE(session_regenerate_id, arginfo_session_regenerate_id) @@ -2285,10 +2117,7 @@ static const zend_function_entry session_functions[] = { PHP_FE(session_set_cookie_params, arginfo_session_set_cookie_params) PHP_FE(session_get_cookie_params, arginfo_session_void) PHP_FE(session_write_close, arginfo_session_void) - PHP_FE(session_abort, arginfo_session_void) - PHP_FE(session_reset, arginfo_session_void) PHP_FE(session_status, arginfo_session_void) - PHP_FE(session_gc, arginfo_session_gc) PHP_FE(session_register_shutdown, arginfo_session_void) PHP_FALIAS(session_commit, session_write_close, arginfo_session_void) PHP_FE_END @@ -2465,11 +2294,8 @@ static PHP_MSHUTDOWN_FUNCTION(session) /* {{{ */ PHP_MSHUTDOWN(ps_mm) (SHUTDOWN_FUNC_ARGS_PASSTHRU); #endif - /* reset rfc1867 callbacks */ - php_session_rfc1867_orig_callback = NULL; - if (php_rfc1867_callback == php_session_rfc1867_callback) { - php_rfc1867_callback = NULL; - } + /* restore the orig callback */ + php_rfc1867_callback = php_session_rfc1867_orig_callback; ps_serializers[PREDEFINED_SERIALIZERS].name = NULL; memset(&ps_modules[PREDEFINED_MODULES], 0, (MAX_MODULES-PREDEFINED_MODULES)*sizeof(ps_module *)); diff --git a/ext/session/tests/003.phpt b/ext/session/tests/003.phpt index 8725f06a69f37..03c3b957667d5 100644 --- a/ext/session/tests/003.phpt +++ b/ext/session/tests/003.phpt @@ -4,7 +4,6 @@ session object deserialization --INI-- session.use_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.serialize_handler=php session.save_handler=files diff --git a/ext/session/tests/004.phpt b/ext/session/tests/004.phpt index 4547c65574914..aeb2c8b36307e 100644 --- a/ext/session/tests/004.phpt +++ b/ext/session/tests/004.phpt @@ -4,7 +4,6 @@ session_set_save_handler test --INI-- session.use_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.name=PHPSESSID session.serialize_handler=php diff --git a/ext/session/tests/005.phpt b/ext/session/tests/005.phpt index 796d9c377eacb..a970e6b71d1ab 100644 --- a/ext/session/tests/005.phpt +++ b/ext/session/tests/005.phpt @@ -4,7 +4,6 @@ custom save handler, multiple session_start()s, complex data structure test. --INI-- session.use_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.name=PHPSESSID session.serialize_handler=php diff --git a/ext/session/tests/006.phpt b/ext/session/tests/006.phpt index dba6894c7eeff..03fca103811fe 100644 --- a/ext/session/tests/006.phpt +++ b/ext/session/tests/006.phpt @@ -4,7 +4,6 @@ correct instantiation of references between variables in sessions --INI-- session.use_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.serialize_handler=php session.save_handler=files diff --git a/ext/session/tests/009.phpt b/ext/session/tests/009.phpt index 6d8d11c331a65..d73bc238c9cf2 100644 --- a/ext/session/tests/009.phpt +++ b/ext/session/tests/009.phpt @@ -4,7 +4,6 @@ unset($_SESSION["name"]); test --INI-- session.use_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.serialize_handler=php session.save_handler=files diff --git a/ext/session/tests/012.phpt b/ext/session/tests/012.phpt index c555d2ca1e8b9..87080112736a8 100644 --- a/ext/session/tests/012.phpt +++ b/ext/session/tests/012.phpt @@ -4,7 +4,6 @@ registering $_SESSION should not segfault --INI-- session.use_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.serialize_handler=php session.save_handler=files diff --git a/ext/session/tests/013.phpt b/ext/session/tests/013.phpt index 32909eb58c6fa..8d0f284b173e7 100644 --- a/ext/session/tests/013.phpt +++ b/ext/session/tests/013.phpt @@ -4,7 +4,6 @@ redefining SID should not cause warnings --INI-- session.use_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.serialize_handler=php session.save_handler=files diff --git a/ext/session/tests/014.phpt b/ext/session/tests/014.phpt index cbf22b142d614..73bc28ea66ca5 100644 --- a/ext/session/tests/014.phpt +++ b/ext/session/tests/014.phpt @@ -5,7 +5,6 @@ a script should not be able to modify session.use_trans_sid --INI-- session.use_trans_sid=0 session.use_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.name=PHPSESSID session.serialize_handler=php diff --git a/ext/session/tests/015.phpt b/ext/session/tests/015.phpt index 527b86bc1d1b0..7d7b737340d11 100644 --- a/ext/session/tests/015.phpt +++ b/ext/session/tests/015.phpt @@ -6,7 +6,6 @@ use_trans_sid should not affect SID session.use_trans_sid=1 session.use_cookies=0 session.use_only_cookies=0 -session.use_strict_mode=0 session.cache_limiter= arg_separator.output=& session.name=PHPSESSID diff --git a/ext/session/tests/016.phpt b/ext/session/tests/016.phpt index 0e368e2f828b4..83703294a3dd2 100644 --- a/ext/session/tests/016.phpt +++ b/ext/session/tests/016.phpt @@ -16,11 +16,10 @@ session.serialize_handler=php ---EXPECTF-- -Warning: session_write_close(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (123;:/really\completely:::/invalid;;,23123;213) in %s on line %d +--EXPECT-- I live diff --git a/ext/session/tests/018.phpt b/ext/session/tests/018.phpt index 5ec132b34f090..def1f419ce170 100644 --- a/ext/session/tests/018.phpt +++ b/ext/session/tests/018.phpt @@ -5,7 +5,6 @@ rewriter correctly handles attribute names which contain dashes --INI-- session.use_cookies=0 session.use_only_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.use_trans_sid=1 session.name=PHPSESSID diff --git a/ext/session/tests/019.phpt b/ext/session/tests/019.phpt index 0f06add5a1154..3ee8ccd420826 100644 --- a/ext/session/tests/019.phpt +++ b/ext/session/tests/019.phpt @@ -4,7 +4,6 @@ serializing references test case using globals --INI-- session.use_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.serialize_handler=php session.save_handler=files diff --git a/ext/session/tests/020.phpt b/ext/session/tests/020.phpt index 267e52191cf25..f43bac5d1fd00 100644 --- a/ext/session/tests/020.phpt +++ b/ext/session/tests/020.phpt @@ -1,11 +1,10 @@ --TEST-- -rewriter uses arg_separator.output for modifying URLs +rewriter uses arg_seperator.output for modifying URLs --SKIPIF-- --INI-- session.use_cookies=0 session.use_only_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.use_trans_sid=1 arg_separator.output="&" diff --git a/ext/session/tests/021.phpt b/ext/session/tests/021.phpt index e199972899447..1ad3c5d5f7b1f 100644 --- a/ext/session/tests/021.phpt +++ b/ext/session/tests/021.phpt @@ -5,7 +5,6 @@ rewriter handles form and fieldset tags correctly --INI-- session.use_cookies=0 session.use_only_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.use_trans_sid=1 url_rewriter.tags="a=href,area=href,frame=src,input=src,form=,fieldset=" diff --git a/ext/session/tests/023.phpt b/ext/session/tests/023.phpt index 592b4a8c3b8a9..42b1e5b1beb79 100644 --- a/ext/session/tests/023.phpt +++ b/ext/session/tests/023.phpt @@ -4,7 +4,6 @@ session object deserialization --INI-- session.use_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.serialize_handler=php session.save_handler=files diff --git a/ext/session/tests/024.phpt b/ext/session/tests/024.phpt index 2b273e2b2ef1f..2ad26067a505b 100644 --- a/ext/session/tests/024.phpt +++ b/ext/session/tests/024.phpt @@ -4,7 +4,6 @@ session_set_save_handler test --INI-- session.use_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.name=PHPSESSID session.serialize_handler=php diff --git a/ext/session/tests/025.phpt b/ext/session/tests/025.phpt index a9ad8fb649163..4fd095f817a3f 100644 --- a/ext/session/tests/025.phpt +++ b/ext/session/tests/025.phpt @@ -4,7 +4,6 @@ custom save handler, multiple session_start()s, complex data structure test. --INI-- session.use_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.name=PHPSESSID session.serialize_handler=php diff --git a/ext/session/tests/026.phpt b/ext/session/tests/026.phpt index 44f0ae0ec0180..06c135d046814 100644 --- a/ext/session/tests/026.phpt +++ b/ext/session/tests/026.phpt @@ -4,7 +4,6 @@ correct instantiation of references between variables in sessions --INI-- session.use_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.serialize_handler=php session.save_handler=files diff --git a/ext/session/tests/027.phpt b/ext/session/tests/027.phpt index 63828522fb5b8..600a992f7f9e3 100644 --- a/ext/session/tests/027.phpt +++ b/ext/session/tests/027.phpt @@ -4,7 +4,6 @@ unset($_SESSION["name"]); should work --INI-- session.use_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.serialize_handler=php session.save_handler=files diff --git a/ext/session/tests/030.phpt b/ext/session/tests/030.phpt index 32909eb58c6fa..8d0f284b173e7 100644 --- a/ext/session/tests/030.phpt +++ b/ext/session/tests/030.phpt @@ -4,7 +4,6 @@ redefining SID should not cause warnings --INI-- session.use_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.serialize_handler=php session.save_handler=files diff --git a/ext/session/tests/bug41600.phpt b/ext/session/tests/bug41600.phpt index 79d5e128419f4..690347ac8d322 100644 --- a/ext/session/tests/bug41600.phpt +++ b/ext/session/tests/bug41600.phpt @@ -5,7 +5,6 @@ Bug #41600 (url rewriter tags doesn't work with namespaced tags) --INI-- session.use_cookies=0 session.use_only_cookies=0 -session.use_strict_mode=0 session.cache_limiter= session.use_trans_sid=1 arg_separator.output="&" diff --git a/ext/session/tests/bug50308.phpt b/ext/session/tests/bug50308.phpt deleted file mode 100644 index 110277ce3c852..0000000000000 --- a/ext/session/tests/bug50308.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -Bug #50308 (session id not appended properly for empty anchor tags) ---SKIPIF-- - ---INI-- -session.name=PHPSESSID -session.save_handler=files -session.use_trans_sid=1 -session.use_only_cookies=0 ---FILE-- - - - - - - - - - ---EXPECTF-- - - - - - - - - diff --git a/ext/session/tests/bug60634.phpt b/ext/session/tests/bug60634.phpt index e2dfd15b37a87..2ec0c26c13c5c 100644 --- a/ext/session/tests/bug60634.phpt +++ b/ext/session/tests/bug60634.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #60634 (Segmentation fault when trying to die() in SessionHandler::write()) +--XFAIL-- +Long term low priority bug, working on it --INI-- session.save_path= session.name=PHPSESSID @@ -42,4 +44,3 @@ echo "um, hi\n"; ?> --EXPECTF-- write: goodbye cruel world -close: goodbye cruel world diff --git a/ext/session/tests/bug60634_error_1.phpt b/ext/session/tests/bug60634_error_1.phpt index e41592f18dd09..3b6e394eed597 100644 --- a/ext/session/tests/bug60634_error_1.phpt +++ b/ext/session/tests/bug60634_error_1.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #60634 (Segmentation fault when trying to die() in SessionHandler::write()) - fatal error in write during exec +--XFAIL-- +Long term low priority bug, working on it --INI-- session.save_path= session.name=PHPSESSID @@ -45,4 +47,3 @@ echo "um, hi\n"; write: goodbye cruel world Fatal error: Call to undefined function undefined_function() in %s on line %d -close: goodbye cruel world diff --git a/ext/session/tests/bug60634_error_2.phpt b/ext/session/tests/bug60634_error_2.phpt index 7c50948ba837b..265fb303f78d7 100644 --- a/ext/session/tests/bug60634_error_2.phpt +++ b/ext/session/tests/bug60634_error_2.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #60634 (Segmentation fault when trying to die() in SessionHandler::write()) - exception in write during exec +--XFAIL-- +Long term low priority bug, working on it --INI-- session.save_path= session.name=PHPSESSID @@ -45,8 +47,3 @@ echo "um, hi\n"; write: goodbye cruel world Fatal error: Uncaught exception 'Exception' in %s -Stack trace: -#0 [internal function]: write('%s', '') -#1 %s(%d): session_write_close() -#2 {main} - thrown in %s on line %d diff --git a/ext/session/tests/bug60634_error_3.phpt b/ext/session/tests/bug60634_error_3.phpt index 4a508a4d8fe07..b2004d68bcb9b 100644 --- a/ext/session/tests/bug60634_error_3.phpt +++ b/ext/session/tests/bug60634_error_3.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #60634 (Segmentation fault when trying to die() in SessionHandler::write()) - fatal error in write after exec +--XFAIL-- +Long term low priority bug, working on it --INI-- session.save_path= session.name=PHPSESSID @@ -44,4 +46,3 @@ session_start(); write: goodbye cruel world Fatal error: Call to undefined function undefined_function() in %s on line %d -close: goodbye cruel world diff --git a/ext/session/tests/bug60634_error_4.phpt b/ext/session/tests/bug60634_error_4.phpt index f21d077b54f10..60bc0dcf54594 100644 --- a/ext/session/tests/bug60634_error_4.phpt +++ b/ext/session/tests/bug60634_error_4.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #60634 (Segmentation fault when trying to die() in SessionHandler::write()) - exception in write after exec +--XFAIL-- +Long term low priority bug, working on it --INI-- session.save_path= session.name=PHPSESSID @@ -44,8 +46,3 @@ session_start(); write: goodbye cruel world Fatal error: Uncaught exception 'Exception' in %s -Stack trace: -#0 [internal function]: write('%s', '') -#1 {main} - thrown in %s on line %d -close: goodbye cruel world diff --git a/ext/session/tests/rfc1867_sid_invalid.phpt b/ext/session/tests/rfc1867_sid_invalid.phpt index 4dd8f1f979923..b28a2e341b155 100644 --- a/ext/session/tests/rfc1867_sid_invalid.phpt +++ b/ext/session/tests/rfc1867_sid_invalid.phpt @@ -46,16 +46,6 @@ session_destroy(); ?> --EXPECTF-- Warning: Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0 - -Warning: Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0 - -Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0 - -Warning: Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0 - -Warning: Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0 - -Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0 string(%d) "%s" bool(true) array(2) { diff --git a/ext/session/tests/session_abort_basic.phpt b/ext/session/tests/session_abort_basic.phpt deleted file mode 100644 index 4a6702f0dc667..0000000000000 --- a/ext/session/tests/session_abort_basic.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -Test session_abort() function : basic functionality ---SKIPIF-- - ---INI-- -session.save_path= -session.name=PHPSESSID ---FILE-- - ---EXPECTF-- -*** Testing session_abort() : basic functionality *** -array(2) { - ["foo"]=> - int(123) - ["bar"]=> - int(456) -} -array(1) { - ["foo"]=> - int(123) -} -Done diff --git a/ext/session/tests/session_commit_variation4.phpt b/ext/session/tests/session_commit_variation4.phpt index 69854a6cf99e5..57f42539d29fb 100644 --- a/ext/session/tests/session_commit_variation4.phpt +++ b/ext/session/tests/session_commit_variation4.phpt @@ -2,8 +2,6 @@ Test session_commit() function : variation --SKIPIF-- ---INI-- -session.use_strict_mode=0 --FILE-- ---INI-- -session.serialize_handler=php -session.save_handler=files -session.maxlifetime=782000 ---FILE-- -= 3); - -echo "Done".PHP_EOL; - -?> ---EXPECTF-- -*** Testing session_gc() : basic functionality *** - -Warning: session_gc(): Trying to garbage collect without active session in %s on line 15 -bool(false) -int(%d) -int(0) -bool(true) -Done diff --git a/ext/session/tests/session_hash_function_basic.phpt b/ext/session/tests/session_hash_function_basic.phpt deleted file mode 100644 index 45b8bc0710a1f..0000000000000 --- a/ext/session/tests/session_hash_function_basic.phpt +++ /dev/null @@ -1,50 +0,0 @@ ---TEST-- -Test session.hash_function ini setting : basic functionality ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -*** Testing session.hash_function : basic functionality *** -string(1) "0" -bool(true) -bool(true) -string(32) "%s" -bool(true) -string(3) "md5" -bool(true) -bool(true) -string(40) "%s" -bool(true) - -Warning: ini_set(): session.configuration 'session.hash_function' must be existing hash function. none does not exist. in %s/session_hash_function_basic.php on line 17 -bool(false) -bool(true) -bool(true) -string(40) "%s" -bool(true) -Done diff --git a/ext/session/tests/session_reset_basic.phpt b/ext/session/tests/session_reset_basic.phpt deleted file mode 100644 index 75c6a04119106..0000000000000 --- a/ext/session/tests/session_reset_basic.phpt +++ /dev/null @@ -1,49 +0,0 @@ ---TEST-- -Test session_reset() function : basic functionality ---SKIPIF-- - ---INI-- -session.save_path= -session.name=PHPSESSID ---FILE-- - ---EXPECTF-- -*** Testing session_abort() : basic functionality *** -array(2) { - ["foo"]=> - int(123) - ["bar"]=> - int(456) -} -array(1) { - ["foo"]=> - int(123) -} -Done diff --git a/ext/session/tests/session_save_path_variation2.phpt b/ext/session/tests/session_save_path_variation2.phpt index dff070100c5f4..6b08480312268 100644 --- a/ext/session/tests/session_save_path_variation2.phpt +++ b/ext/session/tests/session_save_path_variation2.phpt @@ -32,7 +32,7 @@ ob_end_flush(); *** Testing session_save_path() : variation *** string(5) "/blah" -Warning: session_start(): open(/blah/%s, O_RDWR) failed: No such file or directory (2) in %s on line %d +Warning: session_start(): open(%s, O_RDWR) failed: No such file or directory (2) in %s on line %d bool(true) string(5) "/blah" bool(true) diff --git a/ext/session/tests/session_save_path_variation5.phpt b/ext/session/tests/session_save_path_variation5.phpt index c015dcc95c478..5407b5e15a698 100644 --- a/ext/session/tests/session_save_path_variation5.phpt +++ b/ext/session/tests/session_save_path_variation5.phpt @@ -9,6 +9,7 @@ if(substr(PHP_OS, 0, 3) == "WIN") session.save_handler=files session.save_path= session.name=PHPSESSID +open_basedir=. --FILE-- ---FILE-- - ---EXPECTF-- -*** Testing session_serializer_name() : basic functionality *** -string(3) "php" -bool(true) -bool(true) - -Warning: session_serializer_name(): Cannot find serialization handler 'none' in %s/session_serializer_name_basic.php on line 16 -bool(false) -string(10) "php_binary" -Done - diff --git a/ext/session/tests/session_set_save_handler_basic.phpt b/ext/session/tests/session_set_save_handler_basic.phpt index e8496e8afb72e..3897ba9a92752 100644 --- a/ext/session/tests/session_set_save_handler_basic.phpt +++ b/ext/session/tests/session_set_save_handler_basic.phpt @@ -43,7 +43,6 @@ session_id($session_id); session_set_save_handler("open", "close", "read", "write", "destroy", "gc"); session_start(); var_dump($_SESSION); -$_SESSION['Bar'] = 'Foo'; session_write_close(); ob_end_flush(); @@ -92,5 +91,5 @@ array(3) { ["Guff"]=> int(1234567890) } -Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;Bar|s:3:"Foo";] +Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;] Close [%s,PHPSESSID] diff --git a/ext/session/tests/session_set_save_handler_class_003.phpt b/ext/session/tests/session_set_save_handler_class_003.phpt index 29b3846851263..e9a3cc2febab4 100644 --- a/ext/session/tests/session_set_save_handler_class_003.phpt +++ b/ext/session/tests/session_set_save_handler_class_003.phpt @@ -58,7 +58,6 @@ session_set_save_handler($handler); session_start(); -$_SESSION['bar'] = 'hello'; session_write_close(); session_unset(); @@ -72,10 +71,8 @@ array(1) { } int(4) string(%d) "%s" -array(2) { +array(1) { ["foo"]=> string(5) "hello" - ["bar"]=> - string(5) "hello" } string(3) "hai" diff --git a/ext/session/tests/session_set_save_handler_class_007.phpt b/ext/session/tests/session_set_save_handler_class_007.phpt index 55f722515ea6f..7344ae1ef30b2 100644 --- a/ext/session/tests/session_set_save_handler_class_007.phpt +++ b/ext/session/tests/session_set_save_handler_class_007.phpt @@ -56,7 +56,6 @@ $handler = new MySession(2); session_set_save_handler($handler); session_start(); -$_SESSION['abc'] = 'xyz'; // implicit close (called by shutdown function) echo "done\n"; ob_end_flush(); @@ -70,6 +69,6 @@ ob_end_flush(); (#2) constructor called (#1) destructor called done -(#2) writing %s = foo|s:3:"bar";abc|s:3:"xyz"; +(#2) writing %s = foo|s:3:"bar"; (#2) closing %s (#2) destructor called diff --git a/ext/session/tests/session_set_save_handler_closures.phpt b/ext/session/tests/session_set_save_handler_closures.phpt index 1251886b011f9..21b2c68737099 100644 --- a/ext/session/tests/session_set_save_handler_closures.phpt +++ b/ext/session/tests/session_set_save_handler_closures.phpt @@ -42,7 +42,6 @@ echo "Starting session again..!\n"; session_id($session_id); session_set_save_handler($open_closure, $close_closure, $read_closure, $write_closure, $destroy_closure, $gc_closure); session_start(); -$_SESSION['Bar'] = 'Foo'; var_dump($_SESSION); session_write_close(); @@ -84,15 +83,13 @@ array(3) { Starting session again..! Open [%s,PHPSESSID] Read [%s,%s] -array(4) { +array(3) { ["Blah"]=> string(12) "Hello World!" ["Foo"]=> bool(false) ["Guff"]=> int(1234567890) - ["Bar"]=> - string(3) "Foo" } -Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;Bar|s:3:"Foo";] +Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;] Close [%s,PHPSESSID] diff --git a/ext/session/tests/session_set_save_handler_error2.phpt b/ext/session/tests/session_set_save_handler_error2.phpt index 1f2a8b9e6a0a9..03ba3b04d0fb6 100644 --- a/ext/session/tests/session_set_save_handler_error2.phpt +++ b/ext/session/tests/session_set_save_handler_error2.phpt @@ -2,8 +2,6 @@ Test session_set_save_handler() function : error functionality --SKIPIF-- ---INI-- -error_reporting=0 --FILE-- ---FILE-- - ---EXPECTF-- -*** Testing session_set_save_handler() : test write short circuit *** - -Open [%s,PHPSESSID] -Read [%s,%s] -array(3) { - ["Blah"]=> - string(12) "Hello World!" - ["Foo"]=> - bool(false) - ["Guff"]=> - int(1234567890) -} -Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;] -Close [%s,PHPSESSID] -array(3) { - ["Blah"]=> - string(12) "Hello World!" - ["Foo"]=> - bool(false) - ["Guff"]=> - int(1234567890) -} -Starting session again..! -Open [%s,PHPSESSID] -Read [%s,%s] -array(3) { - ["Blah"]=> - string(12) "Hello World!" - ["Foo"]=> - bool(false) - ["Guff"]=> - int(1234567890) -} -Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;Bar|s:3:"Foo";] -Close [%s,PHPSESSID] -Starting session again..! -Open [%s,PHPSESSID] -Read [%s,%s] -array(4) { - ["Blah"]=> - string(12) "Hello World!" - ["Foo"]=> - bool(false) - ["Guff"]=> - int(1234567890) - ["Bar"]=> - string(3) "Foo" -} -Close [%s,PHPSESSID] \ No newline at end of file diff --git a/ext/session/tests/session_status_disabled.phpt b/ext/session/tests/session_status_disabled.phpt index c4d1f2192db1e..24e0ecd7bf76d 100644 --- a/ext/session/tests/session_status_disabled.phpt +++ b/ext/session/tests/session_status_disabled.phpt @@ -3,7 +3,7 @@ Test session_status() function : disabled --SKIPIF-- --INI-- -session.save_handler=non-existent +session.save_handler=non-existant --FILE-- ---INI-- -session.use_strict_mode=0 --FILE-- = 20010901 + STANDARD_MODULE_HEADER, +#endif + "extname", + extname_functions, + PHP_MINIT(extname), + PHP_MSHUTDOWN(extname), + PHP_RINIT(extname), /* Replace with NULL if there's nothing to do at request start */ + PHP_RSHUTDOWN(extname), /* Replace with NULL if there's nothing to do at request end */ + PHP_MINFO(extname), +#if ZEND_MODULE_API_NO >= 20010901 + "0.1", /* Replace with version number for your extension */ +#endif + STANDARD_MODULE_PROPERTIES +}; +/* }}} */ + +#ifdef COMPILE_DL_EXTNAME +ZEND_GET_MODULE(extname) +#endif + /* {{{ PHP_INI */ /* Remove comments and fill if you need to have entries in php.ini @@ -26,35 +61,6 @@ PHP_INI_END() */ /* }}} */ -/* Remove the following function when you have successfully modified config.m4 - so that your module can be compiled into PHP, it exists only for testing - purposes. */ - -/* Every user-visible function in PHP should document itself in the source */ -/* {{{ proto string confirm_extname_compiled(string arg) - Return a string to confirm that the module is compiled in */ -PHP_FUNCTION(confirm_extname_compiled) -{ - char *arg = NULL; - int arg_len, len; - char *strg; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { - return; - } - - len = spprintf(&strg, 0, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "extname", arg); - RETURN_STRINGL(strg, len, 0); -} -/* }}} */ -/* The previous line is meant for vim and emacs, so it can correctly fold and - unfold functions in source code. See the corresponding marks just before - function definition, where the functions purpose is also documented. Please - follow this convention for the convenience of others editing your code. -*/ - -/* __function_stubs_here__ */ - /* {{{ php_extname_init_globals */ /* Uncomment this function if you have INI entries @@ -120,36 +126,35 @@ PHP_MINFO_FUNCTION(extname) } /* }}} */ -/* {{{ extname_functions[] - * - * Every user visible function must have an entry in extname_functions[]. - */ -const zend_function_entry extname_functions[] = { - PHP_FE(confirm_extname_compiled, NULL) /* For testing, remove later. */ - /* __function_entries_here__ */ - PHP_FE_END /* Must be the last line in extname_functions[] */ -}; -/* }}} */ -/* {{{ extname_module_entry - */ -zend_module_entry extname_module_entry = { - STANDARD_MODULE_HEADER, - "extname", - extname_functions, - PHP_MINIT(extname), - PHP_MSHUTDOWN(extname), - PHP_RINIT(extname), /* Replace with NULL if there's nothing to do at request start */ - PHP_RSHUTDOWN(extname), /* Replace with NULL if there's nothing to do at request end */ - PHP_MINFO(extname), - "0.1", /* Replace with version number for your extension */ - STANDARD_MODULE_PROPERTIES -}; +/* Remove the following function when you have successfully modified config.m4 + so that your module can be compiled into PHP, it exists only for testing + purposes. */ + +/* Every user-visible function in PHP should document itself in the source */ +/* {{{ proto string confirm_extname_compiled(string arg) + Return a string to confirm that the module is compiled in */ +PHP_FUNCTION(confirm_extname_compiled) +{ + char *arg = NULL; + int arg_len, len; + char *strg; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { + return; + } + + len = spprintf(&strg, 0, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "extname", arg); + RETURN_STRINGL(strg, len, 0); +} /* }}} */ +/* The previous line is meant for vim and emacs, so it can correctly fold and + unfold functions in source code. See the corresponding marks just before + function definition, where the functions purpose is also documented. Please + follow this convention for the convenience of others editing your code. +*/ -#ifdef COMPILE_DL_EXTNAME -ZEND_GET_MODULE(extname) -#endif +/* __function_stubs_here__ */ /* * Local variables: diff --git a/ext/snmp/config.m4 b/ext/snmp/config.m4 index dd7a3bf68d17a..9c0b82f77860c 100644 --- a/ext/snmp/config.m4 +++ b/ext/snmp/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(snmp,for SNMP support, -[ --with-snmp[=DIR] Include SNMP support]) +[ --with-snmp[=DIR] Include SNMP support]) PHP_ARG_WITH(openssl-dir,OpenSSL dir for SNMP, [ --with-openssl-dir[=DIR] SNMP: openssl install prefix], no, no) diff --git a/ext/soap/config.m4 b/ext/soap/config.m4 index 7fa8c6f0ec391..8acad8dee371e 100644 --- a/ext/soap/config.m4 +++ b/ext/soap/config.m4 @@ -6,7 +6,7 @@ PHP_ARG_ENABLE(soap, whether to enable SOAP support, if test -z "$PHP_LIBXML_DIR"; then PHP_ARG_WITH(libxml-dir, libxml2 install dir, - [ --with-libxml-dir=DIR SOAP: libxml2 install prefix], no, no) + [ --with-libxml-dir=DIR SOAP: libxml2 install prefix], no, no) fi if test "$PHP_SOAP" != "no"; then diff --git a/ext/soap/interop/client_round2_interop.php b/ext/soap/interop/client_round2_interop.php index b8ee893d8daed..5b978734e8eac 100644 --- a/ext/soap/interop/client_round2_interop.php +++ b/ext/soap/interop/client_round2_interop.php @@ -300,7 +300,7 @@ function _saveResults($endpoint_id, &$soap_test) { /** * decodeSoapval - * decodes a soap value to php type, used for test result comparisons + * decodes a soap value to php type, used for test result comparisions * * @param SOAP_Value soapval * @return mixed result @@ -398,7 +398,7 @@ function doEndpointMethod(&$endpoint_info, &$soap_test) { $namespace = $soapaction = 'http://soapinterop.org/'; // hack to make tests work with MS SoapToolkit // it's the only one that uses this soapaction, and breaks if - // it isn't right. Can't wait for soapaction to be fully deprecated + // it isn't right. Can't wait for soapaction to be fully depricated if ($this->currentTest == 'base' && strstr($endpoint_info['endpointName'],'MS SOAP ToolKit 2.0')) { $soapaction = 'urn:soapinterop'; diff --git a/ext/soap/interop/index.php b/ext/soap/interop/index.php index fc12bc8cb724b..1ae25d92f02ef 100644 --- a/ext/soap/interop/index.php +++ b/ext/soap/interop/index.php @@ -35,7 +35,7 @@ classes to define what the type of the value is.

Client Test Interface

The client interface allows you to run the PHP SOAP -Client against a chosen interop server. Each run updates the results database below.

+Client against a choosen interop server. Each run updates the results database below.

Interop Client Test Results

This is a database of the current test results using PHP SOAP Clients against interop servers.

diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 86ab03d9c80c7..5af308c180239 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -194,7 +194,7 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph if (use_ssl && !*use_proxy) { if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method"), (void **) &tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_LONG) { - /* uses constants declared in soap.c to determine ssl uri protocol */ + /* uses contants declared in soap.c to determine ssl uri protocol */ switch (Z_LVAL_PP(tmp)) { case SOAP_SSL_METHOD_TLS: protocol = "tls"; diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c index 25bb177273657..7d2e129746ef2 100644 --- a/ext/soap/php_schema.c +++ b/ext/soap/php_schema.c @@ -1081,14 +1081,6 @@ static int schema_group(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr groupType, sdlTyp nsptr = xmlSearchNs(groupType->doc, groupType, BAD_CAST(ns)); if (nsptr != NULL) { smart_str_appends(&key, (char*)nsptr->href); - } else { - xmlAttrPtr ns = get_attribute(groupType->properties, "targetNamespace"); - if (ns == NULL) { - ns = tns; - } - if (ns) { - smart_str_appends(&key, (char*)ns->children->content); - } } smart_str_appendc(&key, ':'); smart_str_appends(&key, type); @@ -1517,14 +1509,6 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, sdlTyp if (nsptr != NULL) { smart_str_appends(&nscat, (char*)nsptr->href); newType->namens = estrdup((char*)nsptr->href); - } else { - xmlAttrPtr ns = get_attribute(attrs, "targetNamespace"); - if (ns == NULL) { - ns = tns; - } - if (ns) { - smart_str_appends(&nscat, (char*)ns->children->content); - } } smart_str_appendc(&nscat, ':'); smart_str_appends(&nscat, type); @@ -1751,14 +1735,6 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl if (nsptr != NULL) { smart_str_appends(&key, (char*)nsptr->href); newAttr->namens = estrdup((char*)nsptr->href); - } else { - xmlAttrPtr ns = get_attribute(attrType->properties, "targetNamespace"); - if (ns == NULL) { - ns = tns; - } - if (ns) { - smart_str_appends(&key, (char*)ns->children->content); - } } smart_str_appendc(&key, ':'); smart_str_appends(&key, attr_name); @@ -2060,31 +2036,13 @@ static void copy_extra_attribute(void *attribute) } } -static void* schema_find_by_ref(HashTable *ht, char *ref) -{ - void **tmp; - - if (zend_hash_find(ht, ref, strlen(ref)+1, (void**)&tmp) == SUCCESS) { - return tmp; - } else { - ref = strrchr(ref, ':'); - if (ref) { - if (zend_hash_find(ht, ref, strlen(ref)+1, (void**)&tmp) == SUCCESS) { - return tmp; - } - } - } - return NULL; -} - static void schema_attribute_fixup(sdlCtx *ctx, sdlAttributePtr attr) { sdlAttributePtr *tmp; if (attr->ref != NULL) { if (ctx->attributes != NULL) { - tmp = (sdlAttributePtr*)schema_find_by_ref(ctx->attributes, attr->ref); - if (tmp) { + if (zend_hash_find(ctx->attributes, attr->ref, strlen(attr->ref)+1, (void**)&tmp) == SUCCESS) { schema_attribute_fixup(ctx, *tmp); if ((*tmp)->name != NULL && attr->name == NULL) { attr->name = estrdup((*tmp)->name); @@ -2134,8 +2092,7 @@ static void schema_attributegroup_fixup(sdlCtx *ctx, sdlAttributePtr attr, HashT if (attr->ref != NULL) { if (ctx->attributeGroups != NULL) { - tmp = (sdlTypePtr*)schema_find_by_ref(ctx->attributeGroups, attr->ref); - if (tmp) { + if (zend_hash_find(ctx->attributeGroups, attr->ref, strlen(attr->ref)+1, (void**)&tmp) == SUCCESS) { if ((*tmp)->attributes) { zend_hash_internal_pointer_reset((*tmp)->attributes); while (zend_hash_get_current_data((*tmp)->attributes,(void**)&tmp_attr) == SUCCESS) { @@ -2192,7 +2149,7 @@ static void schema_content_model_fixup(sdlCtx *ctx, sdlContentModelPtr model) model->kind = XSD_CONTENT_GROUP; model->u.group = (*tmp); } else { - soap_error1(E_ERROR, "Parsing Schema: unresolved group 'ref' attribute '%s'", model->u.group_ref); + soap_error0(E_ERROR, "Parsing Schema: unresolved group 'ref' attribute"); } break; } @@ -2236,8 +2193,7 @@ static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type) if (type->ref != NULL) { if (ctx->sdl->elements != NULL) { - tmp = (sdlTypePtr*)schema_find_by_ref(ctx->sdl->elements, type->ref); - if (tmp) { + if (zend_hash_find(ctx->sdl->elements, type->ref, strlen(type->ref)+1, (void**)&tmp) == SUCCESS) { type->kind = (*tmp)->kind; type->encode = (*tmp)->encode; if ((*tmp)->nillable) { @@ -2253,7 +2209,7 @@ static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type) } else if (strcmp(type->ref, SCHEMA_NAMESPACE ":schema") == 0) { type->encode = get_conversion(XSD_ANYXML); } else { - soap_error1(E_ERROR, "Parsing Schema: unresolved element 'ref' attribute '%s'", type->ref); + soap_error0(E_ERROR, "Parsing Schema: unresolved element 'ref' attribute"); } } efree(type->ref); diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 00e80efbcbca4..8a41ff4e4fdac 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1290,7 +1290,7 @@ PHP_METHOD(SoapServer, setClass) } } } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to set a non existent class (%s)", classname); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to set a non existant class (%s)", classname); return; } @@ -1421,7 +1421,7 @@ PHP_METHOD(SoapServer, addFunction) zend_str_tolower_copy(key, Z_STRVAL_PP(tmp_function), key_len); if (zend_hash_find(EG(function_table), key, key_len+1, (void**)&f) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_PP(tmp_function)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existant function '%s'", Z_STRVAL_PP(tmp_function)); return; } @@ -1443,7 +1443,7 @@ PHP_METHOD(SoapServer, addFunction) zend_str_tolower_copy(key, Z_STRVAL_P(function_name), key_len); if (zend_hash_find(EG(function_table), key, key_len+1, (void**)&f) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_P(function_name)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existant function '%s'", Z_STRVAL_P(function_name)); return; } if (service->soap_functions.ft == NULL) { @@ -3669,44 +3669,7 @@ static sdlFunctionPtr deserialize_function_call(sdlPtr sdl, xmlDocPtr request, c return function; } -static void set_soap_header_attributes(xmlNodePtr h, HashTable *ht, int version) -{ - zval **tmp; - - if (zend_hash_find(ht, "mustUnderstand", sizeof("mustUnderstand"), (void**)&tmp) == SUCCESS && - Z_TYPE_PP(tmp) == IS_BOOL && Z_LVAL_PP(tmp)) { - if (version == SOAP_1_1) { - xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":mustUnderstand"), BAD_CAST("1")); - } else { - xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":mustUnderstand"), BAD_CAST("true")); - } - } - if (zend_hash_find(ht, "actor", sizeof("actor"), (void**)&tmp) == SUCCESS) { - if (Z_TYPE_PP(tmp) == IS_STRING) { - if (version == SOAP_1_1) { - xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), BAD_CAST(Z_STRVAL_PP(tmp))); - } else { - xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(Z_STRVAL_PP(tmp))); - } - } else if (Z_TYPE_PP(tmp) == IS_LONG) { - if (version == SOAP_1_1) { - if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NEXT) { - xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), BAD_CAST(SOAP_1_1_ACTOR_NEXT)); - } - } else { - if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NEXT) { - xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NEXT)); - } else if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NONE) { - xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NONE)); - } else if (Z_LVAL_PP(tmp) == SOAP_ACTOR_UNLIMATERECEIVER) { - xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_UNLIMATERECEIVER)); - } - } - } - } -} - -static int serialize_response_call2(xmlNodePtr body, sdlFunctionPtr function, char *function_name, char *uri, zval *ret, int version, int main, xmlNodePtr *node TSRMLS_DC) +static int serialize_response_call2(xmlNodePtr body, sdlFunctionPtr function, char *function_name, char *uri, zval *ret, int version, int main TSRMLS_DC) { xmlNodePtr method = NULL, param; sdlParamPtr parameter = NULL; @@ -3806,9 +3769,6 @@ static int serialize_response_call2(xmlNodePtr body, sdlFunctionPtr function, ch if (use == SOAP_ENCODED && version == SOAP_1_2 && method != NULL) { xmlSetNsProp(method, body->ns, BAD_CAST("encodingStyle"), BAD_CAST(SOAP_1_2_ENC_NAMESPACE)); } - if (node) { - *node = method; - } return use; } @@ -3890,7 +3850,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function } if (headers->function) { - if (serialize_response_call2(head, headers->function, Z_STRVAL(headers->function_name), uri, hdr_ret, version, 0, NULL TSRMLS_CC) == SOAP_ENCODED) { + if (serialize_response_call2(head, headers->function, Z_STRVAL(headers->function_name), uri, hdr_ret, version, 0 TSRMLS_CC) == SOAP_ENCODED) { use = SOAP_ENCODED; } } else { @@ -4076,15 +4036,15 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function zval *hdr_ret = &h->retval; char *hdr_ns = h->hdr?h->hdr->ns:NULL; char *hdr_name = Z_STRVAL(h->function_name); - HashTable *ht = NULL; + if (Z_TYPE(h->retval) == IS_OBJECT && instanceof_function(Z_OBJCE(h->retval), soap_header_class_entry TSRMLS_CC)) { + HashTable* ht = Z_OBJPROP(h->retval); zval **tmp; sdlSoapBindingFunctionHeaderPtr *hdr; smart_str key = {0}; - ht = Z_OBJPROP(h->retval); if (zend_hash_find(ht, "namespace", sizeof("namespace"), (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) { smart_str_appendl(&key, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); @@ -4115,14 +4075,9 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function } if (h->function) { - xmlNodePtr xmlHdr = NULL; - - if (serialize_response_call2(head, h->function, Z_STRVAL(h->function_name), uri, hdr_ret, version, 0, &xmlHdr TSRMLS_CC) == SOAP_ENCODED) { + if (serialize_response_call2(head, h->function, Z_STRVAL(h->function_name), uri, hdr_ret, version, 0 TSRMLS_CC) == SOAP_ENCODED) { use = SOAP_ENCODED; } - if (ht) { - set_soap_header_attributes(xmlHdr, ht, version); - } } else { xmlNodePtr xmlHdr = master_to_xml(hdr_enc, hdr_ret, hdr_use, head TSRMLS_CC); if (hdr_name) { @@ -4132,9 +4087,6 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function xmlNsPtr nsptr = encode_add_ns(xmlHdr,hdr_ns); xmlSetNs(xmlHdr, nsptr); } - if (ht) { - set_soap_header_attributes(xmlHdr, ht, version); - } } } h = h->next; @@ -4148,7 +4100,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function body = xmlNewChild(envelope, ns, BAD_CAST("Body"), NULL); - if (serialize_response_call2(body, function, function_name, uri, ret, version, 1, NULL TSRMLS_CC) == SOAP_ENCODED) { + if (serialize_response_call2(body, function, function_name, uri, ret, version, 1 TSRMLS_CC) == SOAP_ENCODED) { use = SOAP_ENCODED; } @@ -4340,7 +4292,38 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function } nsptr = encode_add_ns(h, Z_STRVAL_PP(ns)); xmlSetNs(h, nsptr); - set_soap_header_attributes(h, ht, version); + + if (zend_hash_find(ht, "mustUnderstand", sizeof("mustUnderstand"), (void**)&tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_BOOL && Z_LVAL_PP(tmp)) { + if (version == SOAP_1_1) { + xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":mustUnderstand"), BAD_CAST("1")); + } else { + xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":mustUnderstand"), BAD_CAST("true")); + } + } + if (zend_hash_find(ht, "actor", sizeof("actor"), (void**)&tmp) == SUCCESS) { + if (Z_TYPE_PP(tmp) == IS_STRING) { + if (version == SOAP_1_1) { + xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), BAD_CAST(Z_STRVAL_PP(tmp))); + } else { + xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(Z_STRVAL_PP(tmp))); + } + } else if (Z_TYPE_PP(tmp) == IS_LONG) { + if (version == SOAP_1_1) { + if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NEXT) { + xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), BAD_CAST(SOAP_1_1_ACTOR_NEXT)); + } + } else { + if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NEXT) { + xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NEXT)); + } else if (Z_LVAL_PP(tmp) == SOAP_ACTOR_NONE) { + xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NONE)); + } else if (Z_LVAL_PP(tmp) == SOAP_ACTOR_UNLIMATERECEIVER) { + xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_UNLIMATERECEIVER)); + } + } + } + } } zend_hash_move_forward(soap_headers); } diff --git a/ext/soap/tests/bugs/bug28985.phpt b/ext/soap/tests/bugs/bug28985.phpt index 73ff899c395b1..59d96e2c77ce1 100644 --- a/ext/soap/tests/bugs/bug28985.phpt +++ b/ext/soap/tests/bugs/bug28985.phpt @@ -44,10 +44,10 @@ array(42) { string iUserPassword; }" [8]=> - string(87) "struct MGCodeLibelle { + string(86) "struct MGCodeLibelle { string Code; string Libelle; - boolean Default; + boolean Defaut; anyType Tag; }" [9]=> @@ -203,4 +203,4 @@ array(42) { string(76) "struct GetEnvironnementResponse { MGEnvironnement GetEnvironnementResult; }" -} +} \ No newline at end of file diff --git a/ext/soap/tests/bugs/bug28985.wsdl b/ext/soap/tests/bugs/bug28985.wsdl index 50c2fcda849ee..ee528818bbe2c 100644 --- a/ext/soap/tests/bugs/bug28985.wsdl +++ b/ext/soap/tests/bugs/bug28985.wsdl @@ -67,7 +67,7 @@ type="s:string" /> type="s:string" /> - diff --git a/ext/soap/tests/bugs/bug65018.phpt b/ext/soap/tests/bugs/bug65018.phpt deleted file mode 100644 index bbb9b5e42d369..0000000000000 --- a/ext/soap/tests/bugs/bug65018.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Bug #65018 (SoapHeader problems with SoapServer) ---SKIPIF-- - ---FILE-- -'.PHP_EOL. - ''. - 'abc'. - ''; - - $soap = new SoapServer(null, array('uri' => '127.0.0.1')); - $soap->setClass('Tool'); - $soap->handle($input); -?> ---EXPECT-- - -abc diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c index ed55ed52fa754..ea1c95201f640 100644 --- a/ext/sockets/conversions.c +++ b/ext/sockets/conversions.c @@ -98,8 +98,8 @@ typedef struct { } field_descriptor; #define KEY_FILL_SOCKADDR "fill_sockaddr" -#define KEY_RECVMSG_RET "recvmsg_ret" -#define KEY_CMSG_LEN "cmsg_len" +#define KEY_RECVMSG_RET "recvmsg_ret" +#define KEY_CMSG_LEN "cmsg_len" const struct key_value empty_key_value_list[] = {{0}}; @@ -223,7 +223,6 @@ static unsigned from_array_iterate(const zval *arr, char buf[sizeof("element #4294967295")]; char *bufp = buf; - /* Note i starts at 1, not 0! */ for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), &pos), i = 1; !ctx->err.has_error && zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **)&elem, &pos) == SUCCESS; @@ -667,13 +666,6 @@ static void from_zval_write_sun_path(const zval *path, char *sockaddr_un_c, ser_ path = &lzval; } - /* code in this file relies on the path being nul terminated, even though - * this is not required, at least on linux for abstract paths. It also - * assumes that the path is not empty */ - if (Z_STRLEN_P(path) == 0) { - do_from_zval_err(ctx, "%s", "the path is cannot be empty"); - return; - } if (Z_STRLEN_P(path) >= sizeof(saddr->sun_path)) { do_from_zval_err(ctx, "the path is too long, the maximum permitted " "length is %ld", sizeof(saddr->sun_path) - 1); @@ -775,22 +767,10 @@ static void from_zval_write_sockaddr_aux(const zval *container, return; } *sockaddr_ptr = accounted_ecalloc(1, sizeof(struct sockaddr_un), ctx); + *sockaddr_len = sizeof(struct sockaddr_un); if (fill_sockaddr) { - struct sockaddr_un *sock_un = (struct sockaddr_un*)*sockaddr_ptr; - from_zval_write_sockaddr_un(container, (char*)*sockaddr_ptr, ctx); (*sockaddr_ptr)->sa_family = AF_UNIX; - - /* calculating length is more complicated here. Giving the size of - * struct sockaddr_un here and relying on the nul termination of - * sun_path does not work for paths in the abstract namespace. Note - * that we always assume the path is not empty and nul terminated */ - *sockaddr_len = offsetof(struct sockaddr_un, sun_path) + - (sock_un->sun_path[0] == '\0' - ? (1 + strlen(&sock_un->sun_path[1])) - : strlen(sock_un->sun_path)); - } else { - *sockaddr_len = sizeof(struct sockaddr_un); } break; @@ -889,14 +869,7 @@ static void from_zval_write_control(const zval *arr, } if (entry->calc_space) { - zval **data_elem; - /* arr must be an array at this point */ - if (zend_hash_find(Z_ARRVAL_P(arr), "data", sizeof("data"), - (void**)&data_elem) == FAILURE) { - do_from_zval_err(ctx, "cmsghdr should have a 'data' element here"); - return; - } - data_len = entry->calc_space(*data_elem, ctx); + data_len = entry->calc_space(arr, ctx); if (ctx->err.has_error) { return; } @@ -1397,7 +1370,7 @@ static void from_zval_write_fd_array_aux(zval **elem, unsigned i, void **args, s return; } - if (php_stream_cast(stream, PHP_STREAM_AS_FD, (void **)&iarr[i - 1], + if (php_stream_cast(stream, PHP_STREAM_AS_FD, (void **)&iarr[i], REPORT_ERRORS) == FAILURE) { do_from_zval_err(ctx, "cast stream to file descriptor failed"); return; diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 4a2a41b5fd830..10375ab850402 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -64,8 +64,6 @@ # endif #endif -#include - #include "sockaddr_conv.h" #include "multicast.h" #include "sendrecvmsg.h" @@ -346,7 +344,7 @@ const zend_function_entry sockets_functions[] = { PHP_FE(socket_recvmsg, arginfo_socket_recvmsg) PHP_FE(socket_cmsg_space, arginfo_socket_cmsg_space) - /* for downwards compatibility */ + /* for downwards compatability */ PHP_FALIAS(socket_getopt, socket_get_option, arginfo_socket_get_option) PHP_FALIAS(socket_setopt, socket_set_option, arginfo_socket_set_option) @@ -1481,7 +1479,7 @@ PHP_FUNCTION(socket_strerror) PHP_FUNCTION(socket_bind) { zval *arg1; - php_sockaddr_storage sa_storage = {0}; + php_sockaddr_storage sa_storage; struct sockaddr *sock_type = (struct sockaddr*) &sa_storage; php_socket *php_sock; char *addr; @@ -1499,19 +1497,10 @@ PHP_FUNCTION(socket_bind) case AF_UNIX: { struct sockaddr_un *sa = (struct sockaddr_un *) sock_type; - + memset(sa, 0, sizeof(sa_storage)); sa->sun_family = AF_UNIX; - - if (addr_len >= sizeof(sa->sun_path)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, - "Invalid path: too long (maximum size is %d)", - (int)sizeof(sa->sun_path) - 1); - RETURN_FALSE; - } - memcpy(&sa->sun_path, addr, addr_len); - - retval = bind(php_sock->bsd_socket, (struct sockaddr *) sa, - offsetof(struct sockaddr_un, sun_path) + addr_len); + snprintf(sa->sun_path, 108, "%s", addr); + retval = bind(php_sock->bsd_socket, (struct sockaddr *) sa, SUN_LEN(sa)); break; } @@ -1519,6 +1508,8 @@ PHP_FUNCTION(socket_bind) { struct sockaddr_in *sa = (struct sockaddr_in *) sock_type; + memset(sa, 0, sizeof(sa_storage)); /* Apparently, Mac OSX needs this */ + sa->sin_family = AF_INET; sa->sin_port = htons((unsigned short) port); @@ -1534,6 +1525,8 @@ PHP_FUNCTION(socket_bind) { struct sockaddr_in6 *sa = (struct sockaddr_in6 *) sock_type; + memset(sa, 0, sizeof(sa_storage)); /* Apparently, Mac OSX needs this */ + sa->sin6_family = AF_INET6; sa->sin6_port = htons((unsigned short) port); diff --git a/ext/sockets/tests/socket_abstract_path.phpt b/ext/sockets/tests/socket_abstract_path.phpt deleted file mode 100644 index 816e5c11bb488..0000000000000 --- a/ext/sockets/tests/socket_abstract_path.phpt +++ /dev/null @@ -1,44 +0,0 @@ ---TEST-- -Support for paths in the abstract namespace (bind, connect) ---SKIPIF-- - ---FILE-- - [ "addr" => $path, ], - "iov" => ["test ", "thing", "\n"], -], 0); -var_dump($r); -checktimeout($conns, 500); - -if (!socket_recv($conns, $buf, 20, 0)) die("recv"); -print_r($buf); -?> ---EXPECTF-- -creating server socket -creating client socket -int(11) -test thing diff --git a/ext/sockets/tests/socket_abstract_path_sendmsg.phpt b/ext/sockets/tests/socket_abstract_path_sendmsg.phpt deleted file mode 100644 index 5a9275a26b127..0000000000000 --- a/ext/sockets/tests/socket_abstract_path_sendmsg.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Support for paths in the abstract namespace (bind, sendmsg, recvmsg) ---SKIPIF-- - ---FILE-- - [ "path" => $path], - "iov" => ["test ", "thing", "\n"], -], 0); -var_dump($r); -checktimeout($s, 500); - -if (!socket_recv($s, $buf, 20, 0)) die("recv"); -print_r($buf); -?> ---EXPECTF-- -creating send socket -creating receive socket -int(11) -test thing diff --git a/ext/sockets/tests/socket_cmsg_rights.phpt b/ext/sockets/tests/socket_cmsg_rights.phpt index 8c1734a568027..8290f03880c4b 100644 --- a/ext/sockets/tests/socket_cmsg_rights.phpt +++ b/ext/sockets/tests/socket_cmsg_rights.phpt @@ -84,7 +84,6 @@ Array [0] => Resource id #%d [1] => Resource id #%d [2] => Resource id #%d - [3] => Resource id #%d ) ) diff --git a/ext/spl/internal/iteratoriterator.inc b/ext/spl/internal/iteratoriterator.inc index 451d05da32014..37676e0537c12 100644 --- a/ext/spl/internal/iteratoriterator.inc +++ b/ext/spl/internal/iteratoriterator.inc @@ -17,7 +17,7 @@ * an Iterator. It is very important to understand that most classes that do * not implement Iterator have their reasone to. Most likely they do not allow * the full Iterator feature set. If so you need to provide techniques to - * prevent missuse. If you do not you must expect exceptions or fatal errors. + * prevent missuse. If you do not you must expect exceptions or fatal erros. * * It is also possible to derive the class and implement IteratorAggregate by * downcasting the instances returned in getIterator. See the following diff --git a/ext/spl/internal/multipleiterator.inc b/ext/spl/internal/multipleiterator.inc index 12df011ecc8b9..2ed71d53a7e1c 100644 --- a/ext/spl/internal/multipleiterator.inc +++ b/ext/spl/internal/multipleiterator.inc @@ -163,7 +163,7 @@ class MultipleIterator implements Iterator $retval = array(); foreach($this->iterators as $iter) { - if ($iter->valid()) + if ($it->valid()) { if ($this->flags & self::MIT_KEYS_ASSOC) { @@ -205,7 +205,7 @@ class MultipleIterator implements Iterator $retval = array(); foreach($this->iterators as $iter) { - if ($iter->valid()) + if ($it->valid()) { $retval[] = $iter->key(); } diff --git a/ext/spl/internal/splobjectstorage.inc b/ext/spl/internal/splobjectstorage.inc index ffc6c994889df..fa164066c70f8 100644 --- a/ext/spl/internal/splobjectstorage.inc +++ b/ext/spl/internal/splobjectstorage.inc @@ -16,7 +16,7 @@ * @since PHP 5.1.2 * * This container allows to store objects uniquly without the need to compare - * them one by one. This is only possible internally. The code representation + * them one by one. This is only possible internally. The code represenation * here therefore has a complexity of O(n) while the actual implementation has * complexity O(1). */ diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index b87603bc3bd49..35f4e5056bb45 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -105,7 +105,7 @@ PHP_FUNCTION(class_parents) } if (Z_TYPE_P(obj) == IS_STRING) { - if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), Z_STRSIZE_P(obj), autoload TSRMLS_CC))) { + if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), Z_STRLEN_P(obj), autoload TSRMLS_CC))) { RETURN_FALSE; } } else { @@ -138,7 +138,7 @@ PHP_FUNCTION(class_implements) } if (Z_TYPE_P(obj) == IS_STRING) { - if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), Z_STRSIZE_P(obj), autoload TSRMLS_CC))) { + if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), Z_STRLEN_P(obj), autoload TSRMLS_CC))) { RETURN_FALSE; } } else { @@ -167,7 +167,7 @@ PHP_FUNCTION(class_uses) } if (Z_TYPE_P(obj) == IS_STRING) { - if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), Z_STRSIZE_P(obj), autoload TSRMLS_CC))) { + if (NULL == (ce = spl_find_ce_by_name(Z_STRVAL_P(obj), Z_STRLEN_P(obj), autoload TSRMLS_CC))) { RETURN_FALSE; } } else { @@ -316,14 +316,13 @@ static int spl_autoload(const char *class_name, const char * lc_name, int class_ PHP_FUNCTION(spl_autoload) { char *class_name, *lc_name, *file_exts = SPL_G(autoload_extensions); - zend_str_size_int class_name_len, file_exts_len = SPL_G(autoload_extensions_len); - int found = 0; + int class_name_len, file_exts_len = SPL_G(autoload_extensions_len), found = 0; char *copy, *pos1, *pos2; zval **original_return_value = EG(return_value_ptr_ptr); zend_op **original_opline_ptr = EG(opline_ptr); zend_op_array *original_active_op_array = EG(active_op_array); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &class_name, &class_name_len, &file_exts, &file_exts_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &class_name, &class_name_len, &file_exts, &file_exts_len) == FAILURE) { RETURN_FALSE; } @@ -372,9 +371,9 @@ PHP_FUNCTION(spl_autoload) PHP_FUNCTION(spl_autoload_extensions) { char *file_exts = NULL; - zend_str_size_int file_exts_len; + int file_exts_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &file_exts, &file_exts_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &file_exts, &file_exts_len) == FAILURE) { return; } if (file_exts) { @@ -414,9 +413,9 @@ static void autoload_func_info_dtor(autoload_func_info *alfi) PHP_FUNCTION(spl_autoload_call) { zval *class_name, *retval = NULL; - zend_str_size_int class_name_len; + int class_name_len; char *func_name, *lc_name; - zend_str_size_uint func_name_len; + uint func_name_len; ulong dummy; HashPosition function_pos; autoload_func_info *alfi; @@ -428,7 +427,7 @@ PHP_FUNCTION(spl_autoload_call) if (SPL_G(autoload_functions)) { int l_autoload_running = SPL_G(autoload_running); SPL_G(autoload_running) = 1; - class_name_len = Z_STRSIZE_P(class_name); + class_name_len = Z_STRLEN_P(class_name); lc_name = zend_str_tolower_dup(Z_STRVAL_P(class_name), class_name_len); zend_hash_internal_pointer_reset_ex(SPL_G(autoload_functions), &function_pos); while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions), &function_pos) == SUCCESS) { @@ -467,7 +466,7 @@ PHP_FUNCTION(spl_autoload_call) PHP_FUNCTION(spl_autoload_register) { char *func_name, *error = NULL; - zend_str_size_int func_name_len; + int func_name_len; char *lc_name = NULL; zval *zcallable = NULL; zend_bool do_throw = 1; @@ -483,7 +482,7 @@ PHP_FUNCTION(spl_autoload_register) if (ZEND_NUM_ARGS()) { if (Z_TYPE_P(zcallable) == IS_STRING) { - if (Z_STRSIZE_P(zcallable) == sizeof("spl_autoload_call") - 1) { + if (Z_STRLEN_P(zcallable) == sizeof("spl_autoload_call") - 1) { if (!zend_binary_strcasecmp(Z_STRVAL_P(zcallable), sizeof("spl_autoload_call"), "spl_autoload_call", sizeof("spl_autoload_call"))) { if (do_throw) { zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Function spl_autoload_call() cannot be registered"); @@ -628,7 +627,7 @@ PHP_FUNCTION(spl_autoload_register) PHP_FUNCTION(spl_autoload_unregister) { char *func_name, *error = NULL; - zend_str_size_int func_name_len; + int func_name_len; char *lc_name = NULL; zval *zcallable; int success = FAILURE; @@ -744,17 +743,8 @@ PHP_FUNCTION(spl_autoload_functions) } add_next_index_string(tmp, alfi->func_ptr->common.function_name, 1); add_next_index_zval(return_value, tmp); - } else { - if (strncmp(alfi->func_ptr->common.function_name, "__lambda_func", sizeof("__lambda_func") - 1)) { - add_next_index_string(return_value, alfi->func_ptr->common.function_name, 1); - } else { - char *key; - uint len; - long dummy; - zend_hash_get_current_key_ex(SPL_G(autoload_functions), &key, &len, &dummy, 0, &function_pos); - add_next_index_stringl(return_value, key, len - 1, 1); - } - } + } else + add_next_index_string(return_value, alfi->func_ptr->common.function_name, 1); zend_hash_move_forward_ex(SPL_G(autoload_functions), &function_pos); } @@ -801,7 +791,7 @@ PHPAPI void php_spl_object_hash(zval *obj, char *result TSRMLS_DC) /* {{{*/ hash_handle = SPL_G(hash_mask_handle)^(intptr_t)Z_OBJ_HANDLE_P(obj); hash_handlers = SPL_G(hash_mask_handlers)^(intptr_t)Z_OBJ_HT_P(obj); - spprintf(&hex, 32, "%016lx%016lx", hash_handle, hash_handlers); + spprintf(&hex, 32, "%016x%016x", hash_handle, hash_handlers); strlcpy(result, hex, 33); efree(hex); diff --git a/ext/spl/php_spl.h b/ext/spl/php_spl.h index d3f040a256b38..4794f12443eaa 100644 --- a/ext/spl/php_spl.h +++ b/ext/spl/php_spl.h @@ -20,6 +20,11 @@ #define PHP_SPL_H #include "php.h" +#if defined(PHP_WIN32) +# include "win32/php_stdint.h" +#elif defined(HAVE_STDINT_H) +# include +#endif #include #if 0 @@ -61,7 +66,7 @@ ZEND_BEGIN_MODULE_GLOBALS(spl) char * autoload_extensions; HashTable * autoload_functions; int autoload_running; - zend_str_size_int autoload_extensions_len; + int autoload_extensions_len; intptr_t hash_mask_handle; intptr_t hash_mask_handlers; int hash_mask_init; diff --git a/ext/spl/spl.php b/ext/spl/spl.php index 3638a5a2b7783..fdffda36875b0 100755 --- a/ext/spl/spl.php +++ b/ext/spl/spl.php @@ -260,7 +260,7 @@ class Exception /** The exception message */ protected $message; - /** The string representations as generated during construction */ + /** The string represenations as generated during construction */ private $string; /** The code passed to the constructor */ @@ -336,7 +336,7 @@ final public function getTraceAsString() { } - /** @return string representation of exception + /** @return string represenation of exception */ public function __toString() { diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index c9c299eafbb2f..ed13b8e576479 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -318,9 +318,9 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object, switch(Z_TYPE_P(offset)) { case IS_NULL: Z_STRVAL_P(offset) = ""; - Z_STRSIZE_P(offset) = 0; + Z_STRLEN_P(offset) = 0; case IS_STRING: - if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, (void **) &retval) == FAILURE) { + if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: zend_error(E_NOTICE, "Undefined index: %s", Z_STRVAL_P(offset)); @@ -333,7 +333,7 @@ static zval **spl_array_get_dimension_ptr_ptr(int check_inherited, zval *object, case BP_VAR_W: { zval *value; ALLOC_INIT_ZVAL(value); - zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, (void**)&value, sizeof(void*), (void **)&retval); + zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), (void **)&retval); } } } @@ -463,7 +463,7 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval return; } Z_ADDREF_P(value); - zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, (void**)&value, sizeof(void*), NULL); + zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), NULL); return; case IS_DOUBLE: case IS_RESOURCE: @@ -523,11 +523,11 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval return; } if (ht == &EG(symbol_table)) { - if (zend_delete_global_variable(Z_STRVAL_P(offset), Z_STRSIZE_P(offset) TSRMLS_CC)) { + if (zend_delete_global_variable(Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC)) { zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); } } else { - if (zend_symtable_del(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1) == FAILURE) { + if (zend_symtable_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1) == FAILURE) { zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); } else { spl_array_object *obj = intern; @@ -613,7 +613,7 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o case IS_STRING: { HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); - if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, (void **) &tmp) != FAILURE) { + if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &tmp) != FAILURE) { switch (check_empty) { case 0: return Z_TYPE_PP(tmp) != IS_NULL; @@ -795,7 +795,7 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(obj TSRMLS_CC); zval *tmp, *storage; - zend_str_size name_len; + int name_len; char *zname; zend_class_entry *base; @@ -916,7 +916,7 @@ static int spl_array_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ static int spl_array_skip_protected(spl_array_object *intern, HashTable *aht TSRMLS_DC) /* {{{ */ { char *string_key; - zend_str_size string_length; + uint string_length; ulong num_key; if (Z_TYPE_P(intern->array) == IS_OBJECT) { @@ -1430,7 +1430,7 @@ SPL_METHOD(Array, count) RETURN_LONG(count); } /* }}} */ -static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, zend_str_size_int fname_len, int use_arg) /* {{{ */ +static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fname_len, int use_arg) /* {{{ */ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); @@ -1646,7 +1646,7 @@ SPL_METHOD(Array, getChildren) return; } if (instanceof_function(Z_OBJCE_PP(entry), Z_OBJCE_P(getThis()) TSRMLS_CC)) { - RETURN_ZVAL(*entry, 1, 0); + RETURN_ZVAL(*entry, 0, 0); } } @@ -1722,13 +1722,13 @@ SPL_METHOD(Array, unserialize) spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *buf; - zend_str_size buf_len; + int buf_len; const unsigned char *p, *s; php_unserialize_data_t var_hash; zval *pmembers, *pflags = NULL; long flags; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &buf, &buf_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) { return; } diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 4e4220e4ff6d5..1a417d0f5850a 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -183,7 +183,7 @@ static zend_object_value spl_filesystem_object_new_check(zend_class_entry *class /* }}} */ -PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, zend_str_size_int *len TSRMLS_DC) /* {{{ */ +PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, int *len TSRMLS_DC) /* {{{ */ { #ifdef HAVE_GLOB if (intern->type == SPL_FS_DIR) { @@ -383,7 +383,7 @@ static zend_object_value spl_filesystem_object_clone(zval *zobject TSRMLS_DC) } /* }}} */ -void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path, zend_str_size_int len, int use_copy TSRMLS_DC) /* {{{ */ +void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path, int len, int use_copy TSRMLS_DC) /* {{{ */ { char *p1, *p2; @@ -417,7 +417,7 @@ void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path, intern->_path = estrndup(path, intern->_path_len); } /* }}} */ -static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_object *source, char *file_path, zend_str_size_int file_path_len, int use_copy, zend_class_entry *ce, zval *return_value TSRMLS_DC) /* {{{ */ +static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_object *source, char *file_path, int file_path_len, int use_copy, zend_class_entry *ce, zval *return_value TSRMLS_DC) /* {{{ */ { spl_filesystem_object *intern; zval *arg1; @@ -531,7 +531,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil intern->u.file.open_mode = "r"; intern->u.file.open_mode_len = 1; - if (ht && zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|Sbr", + if (ht && zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sbr", &intern->u.file.open_mode, &intern->u.file.open_mode_len, &use_include_path, &intern->u.file.zcontext) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); @@ -565,7 +565,7 @@ static int spl_filesystem_is_invalid_or_dot(const char * d_name) /* {{{ */ } /* }}} */ -static char *spl_filesystem_object_get_pathname(spl_filesystem_object *intern, zend_str_size_int *len TSRMLS_DC) { /* {{{ */ +static char *spl_filesystem_object_get_pathname(spl_filesystem_object *intern, int *len TSRMLS_DC) { /* {{{ */ switch (intern->type) { case SPL_FS_INFO: case SPL_FS_FILE: @@ -589,7 +589,7 @@ static HashTable* spl_filesystem_object_get_debug_info(zval *obj, int *is_temp T HashTable *rv; zval *tmp, zrv; char *pnstr, *path; - zend_str_size_int pnlen, path_len; + int pnlen, path_len; char stmp[2]; *is_temp = 1; @@ -659,7 +659,7 @@ static HashTable* spl_filesystem_object_get_debug_info(zval *obj, int *is_temp T } /* }}} */ -zend_function *spl_filesystem_object_get_method_check(zval **object_ptr, char *method, zend_str_size_int method_len, const struct _zend_literal *key TSRMLS_DC) /* {{{ */ +zend_function *spl_filesystem_object_get_method_check(zval **object_ptr, char *method, int method_len, const struct _zend_literal *key TSRMLS_DC) /* {{{ */ { spl_filesystem_object *fsobj = zend_object_store_get_object(*object_ptr TSRMLS_CC); @@ -680,8 +680,7 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, long ctor_fla { spl_filesystem_object *intern; char *path; - int parsed; - zend_str_size_int len; + int parsed, len; long flags; zend_error_handling error_handling; @@ -689,10 +688,10 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, long ctor_fla if (SPL_HAS_FLAG(ctor_flags, DIT_CTOR_FLAGS)) { flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO; - parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &path, &len, &flags); + parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &len, &flags); } else { flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF; - parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &path, &len); + parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len); } if (SPL_HAS_FLAG(ctor_flags, SPL_FILE_DIR_SKIPDOTS)) { flags |= SPL_FILE_DIR_SKIPDOTS; @@ -870,7 +869,7 @@ SPL_METHOD(SplFileInfo, getPath) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *path; - zend_str_size_int path_len; + int path_len; if (zend_parse_parameters_none() == FAILURE) { return; @@ -886,7 +885,7 @@ SPL_METHOD(SplFileInfo, getPath) SPL_METHOD(SplFileInfo, getFilename) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - zend_str_size_int path_len; + int path_len; if (zend_parse_parameters_none() == FAILURE) { return; @@ -924,7 +923,7 @@ SPL_METHOD(SplFileInfo, getExtension) char *fname = NULL; const char *p; size_t flen; - zend_str_size_int path_len, idx; + int path_len, idx; if (zend_parse_parameters_none() == FAILURE) { return; @@ -965,7 +964,7 @@ SPL_METHOD(DirectoryIterator, getExtension) char *fname = NULL; const char *p; size_t flen; - zend_str_size_int idx; + int idx; if (zend_parse_parameters_none() == FAILURE) { return; @@ -995,9 +994,9 @@ SPL_METHOD(SplFileInfo, getBasename) spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *fname, *suffix = 0; size_t flen; - zend_str_size_int slen = 0, path_len; + int slen = 0, path_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &suffix, &slen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &suffix, &slen) == FAILURE) { return; } @@ -1023,10 +1022,10 @@ SPL_METHOD(DirectoryIterator, getBasename) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *suffix = 0, *fname; - zend_str_size_int slen = 0; + int slen = 0; size_t flen; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &suffix, &slen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &suffix, &slen) == FAILURE) { return; } @@ -1042,7 +1041,7 @@ SPL_METHOD(SplFileInfo, getPathname) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *path; - zend_str_size_int path_len; + int path_len; if (zend_parse_parameters_none() == FAILURE) { return; @@ -1125,12 +1124,12 @@ SPL_METHOD(SplFileInfo, __construct) { spl_filesystem_object *intern; char *path; - zend_str_size_int len; + int len; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &path, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } @@ -1402,7 +1401,7 @@ SPL_METHOD(SplFileInfo, getPathInfo) zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) == SUCCESS) { - zend_str_size_int path_len; + int path_len; char *path = spl_filesystem_object_get_pathname(intern, &path_len TSRMLS_CC); if (path) { char *dpath = estrndup(path, path_len); @@ -2206,8 +2205,8 @@ static int spl_filesystem_file_read_line_ex(zval * this_ptr, spl_filesystem_obje } spl_filesystem_file_free_line(intern TSRMLS_CC); if (Z_TYPE_P(retval) == IS_STRING) { - intern->u.file.current_line = estrndup(Z_STRVAL_P(retval), Z_STRSIZE_P(retval)); - intern->u.file.current_line_len = Z_STRSIZE_P(retval); + intern->u.file.current_line = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); + intern->u.file.current_line_len = Z_STRLEN_P(retval); } else { MAKE_STD_ZVAL(intern->u.file.current_zval); ZVAL_ZVAL(intern->u.file.current_zval, retval, 1, 0); @@ -2229,13 +2228,13 @@ static int spl_filesystem_file_is_empty_line(spl_filesystem_object *intern TSRML } else if (intern->u.file.current_zval) { switch(Z_TYPE_P(intern->u.file.current_zval)) { case IS_STRING: - return Z_STRSIZE_P(intern->u.file.current_zval) == 0; + return Z_STRLEN_P(intern->u.file.current_zval) == 0; case IS_ARRAY: if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_CSV) && zend_hash_num_elements(Z_ARRVAL_P(intern->u.file.current_zval)) == 1) { zval ** first = Z_ARRVAL_P(intern->u.file.current_zval)->pListHead->pData; - return Z_TYPE_PP(first) == IS_STRING && Z_STRSIZE_PP(first) == 0; + return Z_TYPE_PP(first) == IS_STRING && Z_STRLEN_PP(first) == 0; } return zend_hash_num_elements(Z_ARRVAL_P(intern->u.file.current_zval)) == 0; case IS_NULL: @@ -2283,7 +2282,7 @@ SPL_METHOD(SplFileObject, __construct) zend_bool use_include_path = 0; char *p1, *p2; char *tmp_path; - zend_str_size_int tmp_path_len; + int tmp_path_len; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC); @@ -2291,7 +2290,7 @@ SPL_METHOD(SplFileObject, __construct) intern->u.file.open_mode = NULL; intern->u.file.open_mode_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|Sbr", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|sbr", &intern->file_name, &intern->file_name_len, &intern->u.file.open_mode, &intern->u.file.open_mode_len, &use_include_path, &intern->u.file.zcontext) == FAILURE) { @@ -2581,9 +2580,9 @@ SPL_METHOD(SplFileObject, fgetcsv) spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure, escape = intern->u.file.escape; char *delim = NULL, *enclo = NULL, *esc = NULL; - zend_str_size_int d_len = 0, e_len = 0, esc_len = 0; + int d_len = 0, e_len = 0, esc_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|SSS", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sss", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) { switch(ZEND_NUM_ARGS()) { case 3: @@ -2622,11 +2621,10 @@ SPL_METHOD(SplFileObject, fputcsv) spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure, escape = intern->u.file.escape; char *delim = NULL, *enclo = NULL; - zend_str_size_int d_len = 0, e_len = 0; - int ret; + int d_len = 0, e_len = 0, ret; zval *fields = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|SS", &fields, &delim, &d_len, &enclo, &e_len) == SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|ss", &fields, &delim, &d_len, &enclo, &e_len) == SUCCESS) { switch(ZEND_NUM_ARGS()) { case 3: @@ -2660,9 +2658,9 @@ SPL_METHOD(SplFileObject, setCsvControl) spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char delimiter = ',', enclosure = '"', escape='\\'; char *delim = NULL, *enclo = NULL, *esc = NULL; - zend_str_size_int d_len = 0, e_len = 0, esc_len = 0; + int d_len = 0, e_len = 0, esc_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|SSS", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sss", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) { switch(ZEND_NUM_ARGS()) { case 3: @@ -2833,10 +2831,10 @@ SPL_METHOD(SplFileObject, fwrite) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *str; - zend_str_size_int str_len; + int str_len; long length = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &str_len, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &length) == FAILURE) { return; } diff --git a/ext/spl/spl_directory.h b/ext/spl/spl_directory.h index 48e0d87a32a6a..d95ba550f8a30 100644 --- a/ext/spl/spl_directory.h +++ b/ext/spl/spl_directory.h @@ -45,7 +45,7 @@ typedef struct _spl_filesystem_object spl_filesystem_object; typedef void (*spl_foreign_dtor_t)(spl_filesystem_object *object TSRMLS_DC); typedef void (*spl_foreign_clone_t)(spl_filesystem_object *src, spl_filesystem_object *dst TSRMLS_DC); -PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, zend_str_size_int *len TSRMLS_DC); +PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, int *len TSRMLS_DC); typedef struct _spl_other_handler { spl_foreign_dtor_t dtor; @@ -64,10 +64,10 @@ struct _spl_filesystem_object { void *oth; spl_other_handler *oth_handler; char *_path; - zend_str_size_int _path_len; + int _path_len; char *orig_path; char *file_name; - zend_str_size_int file_name_len; + int file_name_len; SPL_FS_OBJ_TYPE type; long flags; zend_class_entry *file_class; @@ -77,7 +77,7 @@ struct _spl_filesystem_object { php_stream *dirp; php_stream_dirent entry; char *sub_path; - zend_str_size_int sub_path_len; + int sub_path_len; int index; int is_recursive; zend_function *func_rewind; @@ -89,7 +89,7 @@ struct _spl_filesystem_object { php_stream_context *context; zval *zcontext; char *open_mode; - size_t open_mode_len; + int open_mode_len; zval *current_zval; char *current_line; size_t current_line_len; diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 7e8a78b25fe49..aa462dfd76460 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -511,7 +511,7 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp TSRML spl_ptr_llist_element *current = intern->llist->head, *next; zval *tmp, zrv, *dllist_array; char *pnstr; - zend_str_size_int pnlen; + int pnlen; int i = 0; *is_temp = 0; @@ -1183,11 +1183,11 @@ SPL_METHOD(SplDoublyLinkedList, unserialize) spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zval *flags, *elem; char *buf; - zend_str_size_int buf_len; + int buf_len; const unsigned char *p, *s; php_unserialize_data_t var_hash; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &buf, &buf_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) { return; } diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c index 5cec25654dd31..ea2349f41e9dd 100644 --- a/ext/spl/spl_engine.c +++ b/ext/spl/spl_engine.c @@ -47,7 +47,7 @@ PHPAPI long spl_offset_convert_to_long(zval *offset TSRMLS_DC) /* {{{ */ { switch (Z_TYPE_P(offset)) { case IS_STRING: - ZEND_HANDLE_NUMERIC(Z_STRVAL_P(offset), Z_STRSIZE_P(offset)+1, idx); + ZEND_HANDLE_NUMERIC(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, idx); break; case IS_DOUBLE: return (long)Z_DVAL_P(offset); diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c index 93ed1b34e260b..7f17d5ef239fa 100644 --- a/ext/spl/spl_functions.c +++ b/ext/spl/spl_functions.c @@ -133,7 +133,7 @@ int spl_add_classes(zend_class_entry *pce, zval *list, int sub, int allow, int c } /* }}} */ -char * spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, zend_str_size_int prop_len, zend_str_size_int *name_len TSRMLS_DC) /* {{{ */ +char * spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, int prop_len, int *name_len TSRMLS_DC) /* {{{ */ { char *rv; diff --git a/ext/spl/spl_functions.h b/ext/spl/spl_functions.h index 119eb54836c67..29ce4a7640dea 100644 --- a/ext/spl/spl_functions.h +++ b/ext/spl/spl_functions.h @@ -66,7 +66,7 @@ void spl_add_traits(zval * list, zend_class_entry * pce, int allow, int ce_flags int spl_add_classes(zend_class_entry *pce, zval *list, int sub, int allow, int ce_flags TSRMLS_DC); /* caller must efree(return) */ -char * spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, zend_str_size_int prop_len, zend_str_size_int *name_len TSRMLS_DC); +char * spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, int prop_len, int *name_len TSRMLS_DC); #define SPL_ME(class_name, function_name, arg_info, flags) \ PHP_ME( spl_ ## class_name, function_name, arg_info, flags) diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index c99d5c07e6356..cb1f68dcf1196 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -523,7 +523,7 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(obj TSRMLS_CC); zval *tmp, zrv, *heap_array; char *pnstr; - zend_str_size_int pnlen; + int pnlen; int i; *is_temp = 0; diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index e3046f09dac2b..25b8b4c126eeb 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -117,7 +117,6 @@ typedef struct _spl_recursive_it_object { zend_function *nextElement; zend_class_entry *ce; smart_str prefix[6]; - smart_str postfix[1]; } spl_recursive_it_object; typedef struct _spl_recursive_it_iterator { @@ -829,7 +828,7 @@ SPL_METHOD(RecursiveIteratorIterator, getMaxDepth) } } /* }}} */ -static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char *method, zend_str_size_int method_len, const zend_literal *key TSRMLS_DC) +static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char *method, int method_len, const zend_literal *key TSRMLS_DC) { union _zend_function *function_handler; spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(*object_ptr TSRMLS_CC); @@ -887,8 +886,6 @@ static void spl_RecursiveIteratorIterator_free_storage(void *_object TSRMLS_DC) smart_str_free(&object->prefix[4]); smart_str_free(&object->prefix[5]); - smart_str_free(&object->postfix[0]); - efree(object); } /* }}} */ @@ -909,8 +906,6 @@ static zend_object_value spl_RecursiveIteratorIterator_new_ex(zend_class_entry * smart_str_appendl(&intern->prefix[3], "|-", 2); smart_str_appendl(&intern->prefix[4], "\\-", 2); smart_str_appendl(&intern->prefix[5], "", 0); - - smart_str_appendl(&intern->postfix[0], "", 0); } zend_object_std_init(&intern->std, class_type TSRMLS_CC); @@ -1030,7 +1025,7 @@ static void spl_recursive_tree_iterator_get_entry(spl_recursive_it_object * obje static void spl_recursive_tree_iterator_get_postfix(spl_recursive_it_object * object, zval * return_value TSRMLS_DC) { - RETVAL_STRINGL(object->postfix[0].c, object->postfix[0].len, 1); + RETVAL_STRINGL("", 0, 1); } /* {{{ proto void RecursiveTreeIterator::__construct(RecursiveIterator|IteratorAggregate it [, int flags = RTIT_BYPASS_KEY [, int cit_flags = CIT_CATCH_GET_CHILD [, mode = RIT_SELF_FIRST ]]]) throws InvalidArgumentException @@ -1047,9 +1042,9 @@ SPL_METHOD(RecursiveTreeIterator, setPrefixPart) spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); long part; char* prefix; - zend_str_size_int prefix_len; + int prefix_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lS", &part, &prefix, &prefix_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &part, &prefix, &prefix_len) == FAILURE) { return; } if (0 > part || part > 5) { @@ -1073,22 +1068,6 @@ SPL_METHOD(RecursiveTreeIterator, getPrefix) spl_recursive_tree_iterator_get_prefix(object, return_value TSRMLS_CC); } /* }}} */ -/* {{{ proto void RecursiveTreeIterator::setPostfix(string prefix) - Sets postfix as used in getPostfix() */ -SPL_METHOD(RecursiveTreeIterator, setPostfix) -{ - spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - char* postfix; - int postfix_len; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &postfix, &postfix_len) == FAILURE) { - return; - } - - smart_str_free(&object->postfix[0]); - smart_str_appendl(&object->postfix[0], postfix, postfix_len); -} /* }}} */ - /* {{{ proto string RecursiveTreeIterator::getEntry() Returns the string presentation built for current element */ SPL_METHOD(RecursiveTreeIterator, getEntry) @@ -1151,16 +1130,16 @@ SPL_METHOD(RecursiveTreeIterator, current) } spl_recursive_tree_iterator_get_postfix(object, &postfix TSRMLS_CC); - str_len = Z_STRSIZE(prefix) + Z_STRSIZE(entry) + Z_STRSIZE(postfix); + str_len = Z_STRLEN(prefix) + Z_STRLEN(entry) + Z_STRLEN(postfix); str = (char *) emalloc(str_len + 1U); ptr = str; - memcpy(ptr, Z_STRVAL(prefix), Z_STRSIZE(prefix)); - ptr += Z_STRSIZE(prefix); - memcpy(ptr, Z_STRVAL(entry), Z_STRSIZE(entry)); - ptr += Z_STRSIZE(entry); - memcpy(ptr, Z_STRVAL(postfix), Z_STRSIZE(postfix)); - ptr += Z_STRSIZE(postfix); + memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix)); + ptr += Z_STRLEN(prefix); + memcpy(ptr, Z_STRVAL(entry), Z_STRLEN(entry)); + ptr += Z_STRLEN(entry); + memcpy(ptr, Z_STRVAL(postfix), Z_STRLEN(postfix)); + ptr += Z_STRLEN(postfix); *ptr = 0; zval_dtor(&prefix); @@ -1208,16 +1187,16 @@ SPL_METHOD(RecursiveTreeIterator, key) spl_recursive_tree_iterator_get_prefix(object, &prefix TSRMLS_CC); spl_recursive_tree_iterator_get_postfix(object, &postfix TSRMLS_CC); - str_len = Z_STRSIZE(prefix) + Z_STRSIZE(key) + Z_STRSIZE(postfix); + str_len = Z_STRLEN(prefix) + Z_STRLEN(key) + Z_STRLEN(postfix); str = (char *) emalloc(str_len + 1U); ptr = str; - memcpy(ptr, Z_STRVAL(prefix), Z_STRSIZE(prefix)); - ptr += Z_STRSIZE(prefix); - memcpy(ptr, Z_STRVAL(key), Z_STRSIZE(key)); - ptr += Z_STRSIZE(key); - memcpy(ptr, Z_STRVAL(postfix), Z_STRSIZE(postfix)); - ptr += Z_STRSIZE(postfix); + memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix)); + ptr += Z_STRLEN(prefix); + memcpy(ptr, Z_STRVAL(key), Z_STRLEN(key)); + ptr += Z_STRLEN(key); + memcpy(ptr, Z_STRVAL(postfix), Z_STRLEN(postfix)); + ptr += Z_STRLEN(postfix); *ptr = 0; zval_dtor(&prefix); @@ -1256,7 +1235,6 @@ static const zend_function_entry spl_funcs_RecursiveTreeIterator[] = { SPL_ME(RecursiveTreeIterator, getPrefix, arginfo_recursive_it_void, ZEND_ACC_PUBLIC) SPL_ME(RecursiveTreeIterator, setPrefixPart, arginfo_recursive_tree_it_setPrefixPart, ZEND_ACC_PUBLIC) SPL_ME(RecursiveTreeIterator, getEntry, arginfo_recursive_it_void, ZEND_ACC_PUBLIC) - SPL_ME(RecursiveTreeIterator, setPostfix, arginfo_recursive_it_void, ZEND_ACC_PUBLIC) SPL_ME(RecursiveTreeIterator, getPostfix, arginfo_recursive_it_void, ZEND_ACC_PUBLIC) PHP_FE_END }; @@ -1277,7 +1255,7 @@ static int spl_dual_it_gets_implemented(zend_class_entry *interface, zend_class_ } #endif -static union _zend_function *spl_dual_it_get_method(zval **object_ptr, char *method, zend_str_size_int method_len, const zend_literal *key TSRMLS_DC) +static union _zend_function *spl_dual_it_get_method(zval **object_ptr, char *method, int method_len, const zend_literal *key TSRMLS_DC) { union _zend_function *function_handler; spl_dual_it_object *intern; @@ -1424,9 +1402,9 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z case DIT_IteratorIterator: { zend_class_entry **pce_cast; char * class_name = NULL; - zend_str_size_int class_name_len = 0; + int class_name_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|S", &zobject, ce_inner, &class_name, &class_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|s", &zobject, ce_inner, &class_name, &class_name_len) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return NULL; } @@ -1474,13 +1452,13 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z case DIT_RegexIterator: case DIT_RecursiveRegexIterator: { char *regex; - zend_str_size_int regex_len; + int regex_len; long mode = REGIT_MODE_MATCH; intern->u.regex.use_flags = ZEND_NUM_ARGS() >= 5; intern->u.regex.flags = 0; intern->u.regex.preg_flags = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|lll", &zobject, ce_inner, ®ex, ®ex_len, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|lll", &zobject, ce_inner, ®ex, ®ex_len, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return NULL; } @@ -1966,8 +1944,7 @@ SPL_METHOD(RegexIterator, accept) { spl_dual_it_object *intern; char *subject, *result; - zend_str_size_int subject_len; - int use_copy, count = 0, result_len; + int subject_len, use_copy, count = 0, result_len; zval *subject_ptr, subject_copy, zcount, *replacement, tmp_replacement; if (zend_parse_parameters_none() == FAILURE) { @@ -1989,10 +1966,10 @@ SPL_METHOD(RegexIterator, accept) zend_make_printable_zval(subject_ptr, &subject_copy, &use_copy); if (use_copy) { subject = Z_STRVAL(subject_copy); - subject_len = Z_STRSIZE(subject_copy); + subject_len = Z_STRLEN(subject_copy); } else { subject = Z_STRVAL_P(subject_ptr); - subject_len = Z_STRSIZE_P(subject_ptr); + subject_len = Z_STRLEN_P(subject_ptr); } switch (intern->u.regex.mode) @@ -2750,7 +2727,7 @@ SPL_METHOD(CachingIterator, __toString) return; } if (intern->u.caching.zstr) { - RETURN_STRINGL(Z_STRVAL_P(intern->u.caching.zstr), Z_STRSIZE_P(intern->u.caching.zstr), 1); + RETURN_STRINGL(Z_STRVAL_P(intern->u.caching.zstr), Z_STRLEN_P(intern->u.caching.zstr), 1); } else { RETURN_NULL(); } @@ -2762,7 +2739,7 @@ SPL_METHOD(CachingIterator, offsetSet) { spl_dual_it_object *intern; char *arKey; - zend_str_size_uint nKeyLength; + uint nKeyLength; zval *value; SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); @@ -2772,7 +2749,7 @@ SPL_METHOD(CachingIterator, offsetSet) return; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &arKey, &nKeyLength, &value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &arKey, &nKeyLength, &value) == FAILURE) { return; } @@ -2787,7 +2764,7 @@ SPL_METHOD(CachingIterator, offsetGet) { spl_dual_it_object *intern; char *arKey; - zend_str_size_uint nKeyLength; + uint nKeyLength; zval **value; SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); @@ -2797,7 +2774,7 @@ SPL_METHOD(CachingIterator, offsetGet) return; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arKey, &nKeyLength) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arKey, &nKeyLength) == FAILURE) { return; } @@ -2816,7 +2793,7 @@ SPL_METHOD(CachingIterator, offsetUnset) { spl_dual_it_object *intern; char *arKey; - zend_str_size_uint nKeyLength; + uint nKeyLength; SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); @@ -2825,7 +2802,7 @@ SPL_METHOD(CachingIterator, offsetUnset) return; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arKey, &nKeyLength) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arKey, &nKeyLength) == FAILURE) { return; } @@ -2839,7 +2816,7 @@ SPL_METHOD(CachingIterator, offsetExists) { spl_dual_it_object *intern; char *arKey; - zend_str_size_uint nKeyLength; + uint nKeyLength; SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); @@ -2848,7 +2825,7 @@ SPL_METHOD(CachingIterator, offsetExists) return; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arKey, &nKeyLength) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arKey, &nKeyLength) == FAILURE) { return; } diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h index c99b2001f303b..73d9d2e6147f2 100644 --- a/ext/spl/spl_iterators.h +++ b/ext/spl/spl_iterators.h @@ -160,7 +160,7 @@ typedef struct _spl_dual_it_object { long preg_flags; pcre_cache_entry *pce; char *regex; - zend_str_size_uint regex_len; + uint regex_len; } regex; #endif _spl_cbfilter_it_intern *cbfilter; diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index baf39383b35b7..5d89566eec1fa 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -110,13 +110,13 @@ void spl_SplOjectStorage_free_storage(void *object TSRMLS_DC) /* {{{ */ efree(object); } /* }}} */ -static char *spl_object_storage_get_hash(spl_SplObjectStorage *intern, zval *this, zval *obj, zend_str_size_int *hash_len_ptr TSRMLS_DC) { +static char *spl_object_storage_get_hash(spl_SplObjectStorage *intern, zval *this, zval *obj, int *hash_len_ptr TSRMLS_DC) { if (intern->fptr_get_hash) { zval *rv; zend_call_method_with_1_params(&this, intern->std.ce, &intern->fptr_get_hash, "getHash", &rv, obj); if (rv) { if (Z_TYPE_P(rv) == IS_STRING) { - zend_str_size_int hash_len = Z_STRSIZE_P(rv); + int hash_len = Z_STRLEN_P(rv); char *hash = emalloc((hash_len+1)*sizeof(char)); strncpy(hash, Z_STRVAL_P(rv), hash_len); hash[hash_len] = 0; @@ -183,7 +183,7 @@ static void spl_object_storage_dtor(spl_SplObjectStorageElement *element) /* {{{ zval_ptr_dtor(&element->inf); } /* }}} */ -spl_SplObjectStorageElement* spl_object_storage_get(spl_SplObjectStorage *intern, char *hash, zend_str_size_int hash_len TSRMLS_DC) /* {{{ */ +spl_SplObjectStorageElement* spl_object_storage_get(spl_SplObjectStorage *intern, char *hash, int hash_len TSRMLS_DC) /* {{{ */ { spl_SplObjectStorageElement *element; if (zend_hash_find(&intern->storage, hash, hash_len, (void**)&element) == SUCCESS) { @@ -197,7 +197,7 @@ void spl_object_storage_attach(spl_SplObjectStorage *intern, zval *this, zval *o { spl_SplObjectStorageElement *pelement, element; - zend_str_size_int hash_len; + int hash_len; char *hash = spl_object_storage_get_hash(intern, this, obj, &hash_len TSRMLS_CC); if (!hash) { return; @@ -225,8 +225,7 @@ void spl_object_storage_attach(spl_SplObjectStorage *intern, zval *this, zval *o int spl_object_storage_detach(spl_SplObjectStorage *intern, zval *this, zval *obj TSRMLS_DC) /* {{{ */ { - zend_str_size_int hash_len; - int ret = FAILURE; + int hash_len, ret = FAILURE; char *hash = spl_object_storage_get_hash(intern, this, obj, &hash_len TSRMLS_CC); if (!hash) { return ret; @@ -319,7 +318,7 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp TSRMLS_D HashPosition pos; zval *tmp, *storage; char md5str[33]; - zend_str_size_int name_len; + int name_len; char *zname; *is_temp = 0; @@ -439,8 +438,7 @@ static zend_object_value spl_SplObjectStorage_new(zend_class_entry *class_type T int spl_object_storage_contains(spl_SplObjectStorage *intern, zval *this, zval *obj TSRMLS_DC) /* {{{ */ { - zend_str_size_int hash_len; - int found; + int hash_len, found; char *hash = spl_object_storage_get_hash(intern, this, obj, &hash_len TSRMLS_CC); if (!hash) { return 0; @@ -507,7 +505,7 @@ SPL_METHOD(SplObjectStorage, offsetGet) spl_SplObjectStorageElement *element; spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); char *hash; - zend_str_size_int hash_len; + int hash_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) { return; @@ -805,13 +803,13 @@ SPL_METHOD(SplObjectStorage, unserialize) spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); char *buf; - zend_str_size_int buf_len; + int buf_len; const unsigned char *p, *s; php_unserialize_data_t var_hash; zval *pentry, *pmembers, *pcount = NULL, *pinf; long count; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &buf, &buf_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) { return; } @@ -840,7 +838,7 @@ SPL_METHOD(SplObjectStorage, unserialize) while(count-- > 0) { spl_SplObjectStorageElement *pelement; char *hash; - zend_str_size_int hash_len; + int hash_len; if (*p != ';') { goto outexcept; @@ -1222,7 +1220,7 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_ add_index_zval(return_value, Z_LVAL_P(element->inf), retval); break; case IS_STRING: - add_assoc_zval_ex(return_value, Z_STRVAL_P(element->inf), Z_STRSIZE_P(element->inf)+1U, retval); + add_assoc_zval_ex(return_value, Z_STRVAL_P(element->inf), Z_STRLEN_P(element->inf)+1U, retval); break; default: zval_ptr_dtor(&retval); diff --git a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt index 4402d6ca4c32e..32705f0919b7b 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -SplFileObject::fgetcsv with alternative delimiter +SplFileObject::fgetcsv with alternative delimeter --FILE-- rewind( "invalid" ); -?> ---CLEAN-- - --EXPECTF-- Warning: SplFileObject::rewind() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/bug61697.phpt b/ext/spl/tests/bug61697.phpt index 064aaa2e2bf19..d95caef978595 100644 --- a/ext/spl/tests/bug61697.phpt +++ b/ext/spl/tests/bug61697.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #61697 (spl_autoload_functions returns lambda functions incorrectly) +--XFAIL-- +Bug #61697 not fixed yet --FILE-- head = $head ? : new Node('HEAD'); - } - - /** - * @return Node - */ - public function getHead() - { - return $this->head; - } - - /** - * @param mixed $uid - * @return Node|bool - */ - public function find($uid) - { - $iterator = $this->getIterator(); - - /** @var Node $node */ - foreach($iterator as $node) { - if($node->getUid() === $uid) { - return $node; - } - } - - return false; - } - - /** - * @param mixed $uid - * @return \SplStack - */ - public function & findAll($uid) - { - $result = new \SplStack(); - - /** @var Node $node */ - foreach($this->getIterator() as $node) { - if($node->getUid() == $uid) { - $result->push($node); - } - } - - return $result; - } - - /** - * @return \RecursiveIteratorIterator - */ - public function getIterator() - { - return new \RecursiveIteratorIterator( - $this->head->getChildren(), - \RecursiveIteratorIterator::SELF_FIRST - ); - } -} - -class Node extends \RecursiveArrayIterator implements \Countable -{ - /** - * @var array - */ - protected $children = []; - - /** - * @var Node - */ - protected $parent; - - /** - * @var mixed - */ - protected $data; - - /** - * @var mixed - */ - protected $uid; - - /** - * @var int - */ - protected $index = 0; - - /** - * @var bool - */ - protected $assureUnique; - - /** - * @param mixed $data - * @param mixed $uid - * @param Node $parent - * @param bool $assureUnique - */ - public function __construct($data, $uid = null, Node $parent = null, $assureUnique = false) - { - if(null !== $parent) { - $this->parent = $parent; - } - - $this->data = $data; - $this->uid = $uid ? : uniqid(sha1(serialize($data)), true); - $this->assureUnique = $assureUnique; - } - - /** - * @param mixed $uid - */ - public function setUid($uid) - { - $this->uid = $uid; - } - - /** - * @return mixed - */ - public function getUid() - { - return $this->uid; - } - - /** - * @param Node $child - */ - public function addChild(Node $child) - { - $child->setParent($this); - $this->children[] = $child; - } - - /** - * @param array $children - */ - public function setChildren(array $children) - { - $this->children = $children; - } - - /** - * @return array - */ - public function getChildrenArray() - { - return $this->children; - } - - /** - * @param mixed $data - */ - public function setData($data) - { - $this->data = $data; - } - - /** - * @return mixed - */ - public function getData() - { - return $this->data; - } - - /** - * @param Node $parent - * @throws \RuntimeException - */ - public function setParent(Node $parent) - { - if(true === $this->assureUnique && !self::checkUnique($parent, $this->uid)) { - throw new \RuntimeException("Node uid is not unique in assigned node tree"); - } - - $this->parent = $parent; - } - - /** - * @param Node $node - * @param mixed $uid - * @return bool - */ - protected static function checkUnique(Node $node, $uid) - { - $headNode = $node; - do { - $headNode = $node; - } while($node = $node->getParent()); - - $tree = new Tree($headNode); - - return !$tree->find($uid); - } - - /** - * @return \IJsonRPC\Helpers\Tree\Node - */ - public function getParent() - { - return $this->parent; - } - - /** - * @return Node - */ - public function current() - { - return $this->children[$this->index]; - } - - /** - * @return scalar - */ - public function key() - { - return $this->index; - } - - /** - * @return void - */ - public function next() - { - ++$this->index; - } - - /** - * @return void - */ - public function rewind() - { - $this->index = 0; - } - - /** - * @return bool - */ - public function valid() - { - return array_key_exists($this->index, $this->children); - } - - /** - * @return int - */ - public function count() - { - return count($this->children); - } - - /** - * @return bool - */ - public function hasChildren() - { - return !empty($this->children); - } - - /** - * @return \RecursiveArrayIterator - */ - public function getChildren() - { - return new \RecursiveArrayIterator($this->children); - } -} - -$tree = new Tree(); -$node1 = new Node('value1', 1); -$tree->getHead()->addChild($node1); -$node2 = new Node('value2', 2); -$node1->addChild($node2); - -print_r($tree->findAll(2)->offsetGet(0)); ---EXPECTF-- -Node Object -( - [children:protected] => Array - ( - ) - - [parent:protected] => Node Object - ( - [children:protected] => Array - ( - [0] => Node Object - *RECURSION* - ) - - [parent:protected] => Node Object - ( - [children:protected] => Array - ( - [0] => Node Object - *RECURSION* - ) - - [parent:protected] => - [data:protected] => HEAD - [uid:protected] => %s - [index:protected] => 0 - [assureUnique:protected] => - [storage:ArrayIterator:private] => Array - ( - ) - - ) - - [data:protected] => value1 - [uid:protected] => 1 - [index:protected] => 1 - [assureUnique:protected] => - [storage:ArrayIterator:private] => Array - ( - ) - - ) - - [data:protected] => value2 - [uid:protected] => 2 - [index:protected] => 0 - [assureUnique:protected] => - [storage:ArrayIterator:private] => Array - ( - ) - -) diff --git a/ext/spl/tests/recursive_tree_iterator_setpostfix.phpt b/ext/spl/tests/recursive_tree_iterator_setpostfix.phpt deleted file mode 100644 index d59e278fd63f9..0000000000000 --- a/ext/spl/tests/recursive_tree_iterator_setpostfix.phpt +++ /dev/null @@ -1,88 +0,0 @@ ---TEST-- -SPL: RecursiveTreeIterator::setPostfix() ---CREDITS-- -Joshua Thijssen (jthijssen@noxlogic.nl) ---FILE-- - array( - "a", - 1, - ), - "a" => array( - 2, - "b", - 3 => array( - 4, - "c", - ), - "3" => array( - 4, - "c", - ), - ), -); - -$it = new RecursiveArrayIterator($arr); -$it = new RecursiveTreeIterator($it); - -echo "----\n"; -echo $it->getPostfix(); -echo "\n\n"; - -echo "----\n"; -$it->setPostfix("POSTFIX"); -echo $it->getPostfix(); -echo "\n\n"; - -echo "----\n"; -foreach($it as $k => $v) { - echo "[$k] => $v\n"; -} - -echo "----\n"; -$it->setPostfix(""); -echo $it->getPostfix(); -echo "\n\n"; - -echo "----\n"; -foreach($it as $k => $v) { - echo "[$k] => $v\n"; -} - - - -?> -===DONE=== ---EXPECTF-- ----- - - ----- -POSTFIX - ----- -[0] => |-ArrayPOSTFIX -[0] => | |-aPOSTFIX -[1] => | \-1POSTFIX -[a] => \-ArrayPOSTFIX -[0] => |-2POSTFIX -[1] => |-bPOSTFIX -[3] => \-ArrayPOSTFIX -[0] => |-4POSTFIX -[1] => \-cPOSTFIX ----- - - ----- -[0] => |-Array -[0] => | |-a -[1] => | \-1 -[a] => \-Array -[0] => |-2 -[1] => |-b -[3] => \-Array -[0] => |-4 -[1] => \-c -===DONE=== diff --git a/ext/spl/tests/spl_priorityqeue_insert_two_params_error.phpt b/ext/spl/tests/spl_priorityqeue_insert_two_params_error.phpt index 076c68771239c..659ffb4bc065d 100644 --- a/ext/spl/tests/spl_priorityqeue_insert_two_params_error.phpt +++ b/ext/spl/tests/spl_priorityqeue_insert_two_params_error.phpt @@ -1,5 +1,5 @@ --TEST-- -SPL: priorityQueue parameter test on insert method +SPL: priorityQueue paramter test on insert method --CREDITS-- Sean Burlington www.practicalweb.co.uk TestFest London May 2009 diff --git a/ext/sqlite3/config0.m4 b/ext/sqlite3/config0.m4 index 6959a6f916f3b..1365def033160 100644 --- a/ext/sqlite3/config0.m4 +++ b/ext/sqlite3/config0.m4 @@ -3,7 +3,7 @@ dnl config.m4 for extension sqlite3 dnl vim:et:ts=2:sw=2 PHP_ARG_WITH(sqlite3, whether to enable the SQLite3 extension, -[ --without-sqlite3[=DIR] Do not include SQLite3 support. DIR is the prefix to +[ --without-sqlite3[=DIR] Do not include SQLite3 support. DIR is the prefix to SQLite3 installation directory.], yes) if test $PHP_SQLITE3 != "no"; then diff --git a/ext/sqlite3/libsqlite/sqlite3.c b/ext/sqlite3/libsqlite/sqlite3.c index 6d013b6751bff..784be51344b17 100644 --- a/ext/sqlite3/libsqlite/sqlite3.c +++ b/ext/sqlite3/libsqlite/sqlite3.c @@ -11864,7 +11864,7 @@ SQLITE_PRIVATE int sqlite3MemdebugNoType(void*,u8); ** ************************************************************************* ** -** This file contains definitions of global variables and constants. +** This file contains definitions of global variables and contants. */ /* An array to map all upper-case characters into their corresponding @@ -12731,7 +12731,7 @@ struct VdbeFunc { */ struct sqlite3_context { FuncDef *pFunc; /* Pointer to function information. MUST BE FIRST */ - VdbeFunc *pVdbeFunc; /* Auxiliary data, if created. */ + VdbeFunc *pVdbeFunc; /* Auxilary data, if created. */ Mem s; /* The return value is stored here */ Mem *pMem; /* Memory cell used to store aggregate context */ int isError; /* Error code returned by the function. */ @@ -16130,7 +16130,7 @@ SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void){ ** 1. All memory allocations sizes are rounded up to a power of 2. ** ** 2. If two adjacent free blocks are the halves of a larger block, -** then the two blocks are coalesced into the single larger block. +** then the two blocks are coalesed into the single larger block. ** ** 3. New memory is allocated from the first available free block. ** @@ -20926,7 +20926,7 @@ SQLITE_PRIVATE int sqlite3AtoF(const char *z, double *pResult, int length, u8 en /* store the result */ *pResult = result; - /* return true if number and no extra non-whitespace characters after */ + /* return true if number and no extra non-whitespace chracters after */ return z>=zEnd && nDigits>0 && eValid; #else return !sqlite3Atoi64(z, pResult, length, enc); @@ -30074,7 +30074,7 @@ static int unixGetLastError(sqlite3_vfs *NotUsed, int NotUsed2, char *NotUsed3){ ** setting the environment variable SQLITE_FORCE_PROXY_LOCKING to 1 will ** force proxy locking to be used for every database file opened, and 0 ** will force automatic proxy locking to be disabled for all database -** files (explicitly calling the SQLITE_SET_LOCKPROXYFILE pragma or +** files (explicity calling the SQLITE_SET_LOCKPROXYFILE pragma or ** sqlite_file_control API is not affected by SQLITE_FORCE_PROXY_LOCKING). */ @@ -44929,7 +44929,7 @@ SQLITE_PRIVATE int sqlite3WalOpen( } /* -** Change the size to which the WAL file is truncated on each reset. +** Change the size to which the WAL file is trucated on each reset. */ SQLITE_PRIVATE void sqlite3WalLimit(Wal *pWal, i64 iLimit){ if( pWal ) pWal->mxWalSize = iLimit; @@ -59355,7 +59355,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){ /* The complex case - There is a multi-file write-transaction active. ** This requires a master journal file to ensure the transaction is - ** committed atomically. + ** committed atomicly. */ #ifndef SQLITE_OMIT_DISKIO else{ @@ -61383,7 +61383,7 @@ SQLITE_API void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){ } /* -** Return the auxiliary data pointer, if any, for the iArg'th argument to +** Return the auxilary data pointer, if any, for the iArg'th argument to ** the user-function defined by pCtx. */ SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){ @@ -61398,7 +61398,7 @@ SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){ } /* -** Set the auxiliary data pointer and delete function, for the iArg'th +** Set the auxilary data pointer and delete function, for the iArg'th ** argument to the user-function defined by pCtx. Any previous value is ** deleted by calling the delete function specified when it was set. */ @@ -63408,7 +63408,7 @@ SQLITE_PRIVATE int sqlite3VdbeExec( } #endif - /* On any opcode with the "out2-prerelease" tag, free any + /* On any opcode with the "out2-prerelase" tag, free any ** external allocations out of mem[p2] and set mem[p2] to be ** an undefined integer. Opcodes will either fill in the integer ** value or convert mem[p2] to a different type. @@ -69899,7 +69899,7 @@ SQLITE_PRIVATE int sqlite3MemJournalSize(void){ /* ** Walk an expression tree. Invoke the callback once for each node -** of the expression, while descending. (In other words, the callback +** of the expression, while decending. (In other words, the callback ** is invoked before visiting children.) ** ** The return value from the callback should be one of the WRC_* @@ -70936,7 +70936,7 @@ static int resolveOrderGroupBy( } /* -** Resolve names in the SELECT statement p and all of its descendants. +** Resolve names in the SELECT statement p and all of its descendents. */ static int resolveSelectStep(Walker *pWalker, Select *p){ NameContext *pOuterNC; /* Context that contains this SELECT */ @@ -71244,7 +71244,7 @@ SQLITE_PRIVATE void sqlite3ResolveSelectNames( ** affinity of that column is returned. Otherwise, 0x00 is returned, ** indicating no affinity for the expression. ** -** i.e. the WHERE clause expressions in the following statements all +** i.e. the WHERE clause expresssions in the following statements all ** have an affinity: ** ** CREATE TABLE t1(a); @@ -74260,13 +74260,13 @@ static int evalConstExpr(Walker *pWalker, Expr *pExpr){ /* ** Preevaluate constant subexpressions within pExpr and store the -** results in registers. Modify pExpr so that the constant subexpressions +** results in registers. Modify pExpr so that the constant subexpresions ** are TK_REGISTER opcodes that refer to the precomputed values. ** ** This routine is a no-op if the jump to the cookie-check code has ** already occur. Since the cookie-check jump is generated prior to ** any other serious processing, this check ensures that there is no -** way to accidentally bypass the constant initializations. +** way to accidently bypass the constant initializations. ** ** This routine is also a no-op if the SQLITE_FactorOutConst optimization ** is disabled via the sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS) @@ -75132,7 +75132,7 @@ static void renameParentFunc( ** ALTER TABLE command. The first argument is the text of a CREATE TRIGGER ** statement. The second is a table name. The table name in the CREATE ** TRIGGER statement is replaced with the third argument and the result -** returned. This is analogous to renameTableFunc() above, except for CREATE +** returned. This is analagous to renameTableFunc() above, except for CREATE ** TRIGGER, not CREATE INDEX and CREATE TABLE. */ static void renameTriggerFunc( @@ -86752,7 +86752,7 @@ static int xferOptimization( } #endif #ifndef SQLITE_OMIT_FOREIGN_KEY - /* Disallow the transfer optimization if the destination table constrains + /* Disallow the transfer optimization if the destination table constains ** any foreign key constraints. This is more restrictive than necessary. ** But the main beneficiary of the transfer optimization is the VACUUM ** command, and the VACUUM command disables foreign key constraints. So @@ -93175,7 +93175,7 @@ static int flattenSubquery( pSubSrc = pSub->pSrc; assert( pSubSrc ); /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants, - ** not arbitrary expressions, we allowed some combining of LIMIT and OFFSET + ** not arbitrary expresssions, we allowed some combining of LIMIT and OFFSET ** because they could be computed at compile-time. But when LIMIT and OFFSET ** became arbitrary expressions, we were forced to add restrictions (13) ** and (14). */ @@ -94472,7 +94472,7 @@ SQLITE_PRIVATE int sqlite3Select( */ if( pGroupBy ){ KeyInfo *pKeyInfo; /* Keying information for the group by clause */ - int j1; /* A-vs-B comparison jump */ + int j1; /* A-vs-B comparision jump */ int addrOutputRow; /* Start of subroutine that outputs a result row */ int regOutputRow; /* Return address register for output subroutine */ int addrSetAbort; /* Set the abort flag and return */ @@ -118508,7 +118508,7 @@ static int star_oh(const char *z){ /* ** If the word ends with zFrom and xCond() is true for the stem -** of the word that precede the zFrom ending, then change the +** of the word that preceds the zFrom ending, then change the ** ending to zTo. ** ** The input word *pz and zFrom are both in reverse order. zTo @@ -127688,7 +127688,7 @@ SQLITE_API int sqlite3_extension_init( ** * Implementations of the SQL scalar upper() and lower() functions ** for case mapping. ** -** * Integration of ICU and SQLite collation sequences. +** * Integration of ICU and SQLite collation seqences. ** ** * An implementation of the LIKE operator that uses ICU to ** provide case-independent matching. diff --git a/ext/sqlite3/php_sqlite3_structs.h b/ext/sqlite3/php_sqlite3_structs.h index 6c65e02ee7f9b..0e813b6dfdc87 100644 --- a/ext/sqlite3/php_sqlite3_structs.h +++ b/ext/sqlite3/php_sqlite3_structs.h @@ -23,7 +23,7 @@ #include -/* for backwards compatibility reasons */ +/* for backwards compatability reasons */ #ifndef SQLITE_OPEN_READONLY #define SQLITE_OPEN_READONLY 0x00000001 #endif diff --git a/ext/standard/array.c b/ext/standard/array.c index f8e47a20997b2..9bfb0887ac231 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -187,7 +187,7 @@ static int php_array_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ } else { Z_TYPE(first) = IS_STRING; Z_STRVAL(first) = (char*)f->arKey; - Z_STRSIZE(first) = f->nKeyLength - 1; + Z_STRLEN(first) = f->nKeyLength - 1; } if (s->nKeyLength == 0) { @@ -196,7 +196,7 @@ static int php_array_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ } else { Z_TYPE(second) = IS_STRING; Z_STRVAL(second) = (char*)s->arKey; - Z_STRSIZE(second) = s->nKeyLength - 1; + Z_STRLEN(second) = s->nKeyLength - 1; } if (ARRAYG(compare_func)(&result, &first, &second TSRMLS_CC) == FAILURE) { @@ -352,7 +352,7 @@ PHP_FUNCTION(count) /* Numbers are always smaller than strings int this function as it * anyway doesn't make much sense to compare two different data types. - * This keeps it consistent and simple. + * This keeps it consistant and simple. * * This is not correct any more, depends on what compare_func is set to. */ @@ -427,7 +427,7 @@ static int php_array_natural_general_compare(const void *a, const void *b, int f convert_to_string(&second); } - result = strnatcmp_ex(Z_STRVAL(first), Z_STRSIZE(first), Z_STRVAL(second), Z_STRSIZE(second), fold_case); + result = strnatcmp_ex(Z_STRVAL(first), Z_STRLEN(first), Z_STRVAL(second), Z_STRLEN(second), fold_case); if (Z_TYPE_P(fval) != IS_STRING) { zval_dtor(&first); @@ -738,7 +738,7 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /* Z_TYPE_P(key1) = IS_LONG; } else { Z_STRVAL_P(key1) = estrndup(f->arKey, f->nKeyLength - 1); - Z_STRSIZE_P(key1) = f->nKeyLength - 1; + Z_STRLEN_P(key1) = f->nKeyLength - 1; Z_TYPE_P(key1) = IS_STRING; } if (s->nKeyLength == 0) { @@ -746,7 +746,7 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /* Z_TYPE_P(key2) = IS_LONG; } else { Z_STRVAL_P(key2) = estrndup(s->arKey, s->nKeyLength - 1); - Z_STRSIZE_P(key2) = s->nKeyLength - 1; + Z_STRLEN_P(key2) = s->nKeyLength - 1; Z_TYPE_P(key2) = IS_STRING; } @@ -1041,7 +1041,7 @@ PHP_FUNCTION(max) static int php_array_walk(HashTable *target_hash, zval *userdata, int recursive TSRMLS_DC) /* {{{ */ { zval **args[3], /* Arguments to userland function */ - *retval_ptr = NULL, /* Return value - unused */ + *retval_ptr, /* Return value - unused */ *key=NULL; /* Entry key */ /* Set up known arguments */ @@ -1224,10 +1224,9 @@ PHP_FUNCTION(array_search) } /* }}} */ -static int php_valid_var_name(char *var_name, zend_str_size_int var_name_len) /* {{{ */ +static int php_valid_var_name(char *var_name, int var_name_len) /* {{{ */ { - zend_str_size i; - int ch; + int i, ch; if (!var_name || !var_name_len) { return 0; @@ -1261,18 +1260,18 @@ static int php_valid_var_name(char *var_name, zend_str_size_int var_name_len) /* } /* }}} */ -PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, zend_str_size_int var_name_len, zend_bool add_underscore TSRMLS_DC) /* {{{ */ +PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC) /* {{{ */ { - Z_STRSIZE_P(result) = Z_STRSIZE_P(prefix) + (add_underscore ? 1 : 0) + var_name_len; + Z_STRLEN_P(result) = Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len; Z_TYPE_P(result) = IS_STRING; - Z_STRVAL_P(result) = emalloc(Z_STRSIZE_P(result) + 1); - memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRSIZE_P(prefix)); + Z_STRVAL_P(result) = emalloc(Z_STRLEN_P(result) + 1); + memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRLEN_P(prefix)); if (add_underscore) { - Z_STRVAL_P(result)[Z_STRSIZE_P(prefix)] = '_'; + Z_STRVAL_P(result)[Z_STRLEN_P(prefix)] = '_'; } - memcpy(Z_STRVAL_P(result) + Z_STRSIZE_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); + memcpy(Z_STRVAL_P(result) + Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); return SUCCESS; } @@ -1287,7 +1286,7 @@ PHP_FUNCTION(extract) zval **entry, *data; char *var_name; ulong num_key; - zend_str_size_uint var_name_len; + uint var_name_len; int var_exists, key_type, count = 0; int extract_refs = 0; HashPosition pos; @@ -1311,7 +1310,7 @@ PHP_FUNCTION(extract) if (prefix) { convert_to_string(prefix); - if (Z_STRSIZE_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRSIZE_P(prefix))) { + if (Z_STRLEN_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRLEN_P(prefix))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "prefix is not a valid identifier"); return; } @@ -1345,7 +1344,7 @@ PHP_FUNCTION(extract) ZVAL_LONG(&num, num_key); convert_to_string(&num); - php_prefix_varname(&final_name, prefix, Z_STRVAL(num), Z_STRSIZE(num), 1 TSRMLS_CC); + php_prefix_varname(&final_name, prefix, Z_STRVAL(num), Z_STRLEN(num), 1 TSRMLS_CC); zval_dtor(&num); } else { zend_hash_move_forward_ex(Z_ARRVAL_P(var_array), &pos); @@ -1403,25 +1402,25 @@ PHP_FUNCTION(extract) break; } - if (Z_TYPE(final_name) != IS_NULL && php_valid_var_name(Z_STRVAL(final_name), Z_STRSIZE(final_name))) { + if (Z_TYPE(final_name) != IS_NULL && php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) { if (extract_refs) { zval **orig_var; SEPARATE_ZVAL_TO_MAKE_IS_REF(entry); zval_add_ref(entry); - if (zend_hash_find(EG(active_symbol_table), Z_STRVAL(final_name), Z_STRSIZE(final_name) + 1, (void **) &orig_var) == SUCCESS) { + if (zend_hash_find(EG(active_symbol_table), Z_STRVAL(final_name), Z_STRLEN(final_name) + 1, (void **) &orig_var) == SUCCESS) { zval_ptr_dtor(orig_var); *orig_var = *entry; } else { - zend_hash_update(EG(active_symbol_table), Z_STRVAL(final_name), Z_STRSIZE(final_name) + 1, (void **) entry, sizeof(zval *), NULL); + zend_hash_update(EG(active_symbol_table), Z_STRVAL(final_name), Z_STRLEN(final_name) + 1, (void **) entry, sizeof(zval *), NULL); } } else { MAKE_STD_ZVAL(data); *data = **entry; zval_copy_ctor(data); - ZEND_SET_SYMBOL_WITH_LENGTH(EG(active_symbol_table), Z_STRVAL(final_name), Z_STRSIZE(final_name) + 1, data, 1, 0); + ZEND_SET_SYMBOL_WITH_LENGTH(EG(active_symbol_table), Z_STRVAL(final_name), Z_STRLEN(final_name) + 1, data, 1, 0); } count++; } @@ -1443,12 +1442,12 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu zval **value_ptr, *value, *data; if (Z_TYPE_P(entry) == IS_STRING) { - if (zend_hash_find(eg_active_symbol_table, Z_STRVAL_P(entry), Z_STRSIZE_P(entry) + 1, (void **)&value_ptr) != FAILURE) { + if (zend_hash_find(eg_active_symbol_table, Z_STRVAL_P(entry), Z_STRLEN_P(entry) + 1, (void **)&value_ptr) != FAILURE) { value = *value_ptr; ALLOC_ZVAL(data); MAKE_COPY_ZVAL(&value, data); - zend_hash_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(entry), Z_STRSIZE_P(entry) + 1, &data, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(entry), Z_STRLEN_P(entry) + 1, &data, sizeof(zval *), NULL); } } else if (Z_TYPE_P(entry) == IS_ARRAY) { @@ -1573,7 +1572,7 @@ PHP_FUNCTION(array_fill_keys) } zval_add_ref(&val); - zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(key_ptr), Z_STRSIZE_P(key_ptr) + 1, &val, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(key_ptr), Z_STRLEN_P(key_ptr) + 1, &val, sizeof(zval *), NULL); if (key_ptr != *entry) { zval_dtor(&key); @@ -1599,7 +1598,7 @@ PHP_FUNCTION(range) if (zstep) { if (Z_TYPE_P(zstep) == IS_DOUBLE || - (Z_TYPE_P(zstep) == IS_STRING && is_numeric_string(Z_STRVAL_P(zstep), Z_STRSIZE_P(zstep), NULL, NULL, 0) == IS_DOUBLE) + (Z_TYPE_P(zstep) == IS_STRING && is_numeric_string(Z_STRVAL_P(zstep), Z_STRLEN_P(zstep), NULL, NULL, 0) == IS_DOUBLE) ) { is_step_double = 1; } @@ -1617,13 +1616,13 @@ PHP_FUNCTION(range) array_init(return_value); /* If the range is given as strings, generate an array of characters. */ - if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING && Z_STRSIZE_P(zlow) >= 1 && Z_STRSIZE_P(zhigh) >= 1) { + if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING && Z_STRLEN_P(zlow) >= 1 && Z_STRLEN_P(zhigh) >= 1) { int type1, type2; unsigned char *low, *high; long lstep = (long) step; - type1 = is_numeric_string(Z_STRVAL_P(zlow), Z_STRSIZE_P(zlow), NULL, NULL, 0); - type2 = is_numeric_string(Z_STRVAL_P(zhigh), Z_STRSIZE_P(zhigh), NULL, NULL, 0); + type1 = is_numeric_string(Z_STRVAL_P(zlow), Z_STRLEN_P(zlow), NULL, NULL, 0); + type2 = is_numeric_string(Z_STRVAL_P(zhigh), Z_STRLEN_P(zhigh), NULL, NULL, 0); if (type1 == IS_DOUBLE || type2 == IS_DOUBLE || is_step_double) { goto double_str; @@ -1938,7 +1937,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end) zval *stack, /* Input stack */ **val; /* Value to be popped */ char *key = NULL; - zend_str_size key_len = 0; + uint key_len = 0; ulong index; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &stack) == FAILURE) { @@ -2136,7 +2135,7 @@ PHP_FUNCTION(array_slice) int num_in, /* Number of elements in the input array */ pos; /* Current position in the array */ char *string_key; - zend_str_size string_key_len; + uint string_key_len; ulong num_key; HashPosition hpos; @@ -2213,7 +2212,7 @@ PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS { zval **src_entry, **dest_entry; char *string_key; - zend_str_size string_key_len; + uint string_key_len; ulong num_key; HashPosition pos; @@ -2276,7 +2275,7 @@ PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src TSRMLS_DC { zval **src_entry, **dest_entry; char *string_key; - zend_str_size string_key_len; + uint string_key_len; ulong num_key; HashPosition pos; @@ -2508,11 +2507,11 @@ PHP_FUNCTION(array_count_values) Z_LVAL_PP(tmp)++; } } else if (Z_TYPE_PP(entry) == IS_STRING) { - if (zend_symtable_find(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRSIZE_PP(entry) + 1, (void**)&tmp) == FAILURE) { + if (zend_symtable_find(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, (void**)&tmp) == FAILURE) { zval *data; MAKE_STD_ZVAL(data); ZVAL_LONG(data, 1); - zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRSIZE_PP(entry) + 1, &data, sizeof(data), NULL); + zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &data, sizeof(data), NULL); } else { Z_LVAL_PP(tmp)++; } @@ -2587,7 +2586,7 @@ PHP_FUNCTION(array_column) /* Otherwise, skip if the value doesn't exist in our subarray */ } else if ((Z_TYPE_PP(zcolumn) == IS_STRING) && - (zend_hash_find(ht, Z_STRVAL_PP(zcolumn), Z_STRSIZE_PP(zcolumn) + 1, (void**)&zcolval) == FAILURE)) { + (zend_hash_find(ht, Z_STRVAL_PP(zcolumn), Z_STRLEN_PP(zcolumn) + 1, (void**)&zcolval) == FAILURE)) { continue; } else if ((Z_TYPE_PP(zcolumn) == IS_LONG) && (zend_hash_index_find(ht, Z_LVAL_PP(zcolumn), (void**)&zcolval) == FAILURE)) { @@ -2598,7 +2597,7 @@ PHP_FUNCTION(array_column) * which is to append the value as next_index */ if (zkey && (Z_TYPE_PP(zkey) == IS_STRING)) { - zend_hash_find(ht, Z_STRVAL_PP(zkey), Z_STRSIZE_PP(zkey) + 1, (void**)&zkeyval); + zend_hash_find(ht, Z_STRVAL_PP(zkey), Z_STRLEN_PP(zkey) + 1, (void**)&zkeyval); } else if (zkey && (Z_TYPE_PP(zkey) == IS_LONG)) { zend_hash_index_find(ht, Z_LVAL_PP(zkey), (void**)&zkeyval); } @@ -2626,7 +2625,7 @@ PHP_FUNCTION(array_reverse) zval *input, /* Input array */ **entry; /* An entry in the input array */ char *string_key; - zend_str_size string_key_len; + uint string_key_len; ulong num_key; zend_bool preserve_keys = 0; /* whether to preserve keys */ HashPosition pos; @@ -2753,7 +2752,7 @@ PHP_FUNCTION(array_flip) if (Z_TYPE_PP(entry) == IS_LONG) { zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_PP(entry), &data, sizeof(data), NULL); } else if (Z_TYPE_PP(entry) == IS_STRING) { - zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRSIZE_PP(entry) + 1, &data, sizeof(data), NULL); + zend_symtable_update(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &data, sizeof(data), NULL); } else { zval_ptr_dtor(&data); /* will free also zval structure */ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only flip STRING and INTEGER values!"); @@ -2771,7 +2770,7 @@ PHP_FUNCTION(array_change_key_case) zval *array, **entry; char *string_key; char *new_key; - zend_str_size str_key_len; + uint str_key_len; ulong num_key; long change_to_upper=0; HashPosition pos; @@ -2912,7 +2911,7 @@ static int zval_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */ static int zval_user_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */ { zval **args[2]; - zval *retval_ptr = NULL; + zval *retval_ptr; args[0] = (zval **) a; args[1] = (zval **) b; @@ -3994,7 +3993,7 @@ PHP_FUNCTION(array_rand) long randval, num_req = 1; int num_avail, key_type; char *string_key; - zend_str_size string_key_len; + uint string_key_len; ulong num_key; HashPosition pos; @@ -4018,7 +4017,7 @@ PHP_FUNCTION(array_rand) /* We can't use zend_hash_index_find() because the array may have string keys or gaps. */ zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos); - while (num_req && (key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(input), &string_key, &string_key_len, &num_key, 0, &pos)) != HASH_KEY_NON_EXISTENT) { + while (num_req && (key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(input), &string_key, &string_key_len, &num_key, 0, &pos)) != HASH_KEY_NON_EXISTANT) { randval = php_rand(TSRMLS_C); @@ -4072,7 +4071,17 @@ PHP_FUNCTION(array_sum) entry_n = **entry; zval_copy_ctor(&entry_n); convert_scalar_to_number(&entry_n TSRMLS_CC); - fast_add_function(return_value, return_value, &entry_n TSRMLS_CC); + + if (Z_TYPE(entry_n) == IS_LONG && Z_TYPE_P(return_value) == IS_LONG) { + dval = (double)Z_LVAL_P(return_value) + (double)Z_LVAL(entry_n); + if ( (double)LONG_MIN <= dval && dval <= (double)LONG_MAX ) { + Z_LVAL_P(return_value) += Z_LVAL(entry_n); + continue; + } + } + convert_to_double(return_value); + convert_to_double(&entry_n); + Z_DVAL_P(return_value) += Z_DVAL(entry_n); } } /* }}} */ @@ -4201,7 +4210,7 @@ PHP_FUNCTION(array_filter) char *string_key; zend_fcall_info fci = empty_fcall_info; zend_fcall_info_cache fci_cache = empty_fcall_info_cache; - zend_str_size string_key_len; + uint string_key_len; ulong num_key; HashPosition pos; @@ -4319,7 +4328,7 @@ PHP_FUNCTION(array_map) /* We iterate through all the arrays at once. */ for (k = 0; k < maxlen; k++) { - zend_str_size str_key_len; + uint str_key_len; ulong num_key; char *str_key; int key_type = 0; @@ -4403,7 +4412,7 @@ PHP_FUNCTION(array_key_exists) switch (Z_TYPE_P(key)) { case IS_STRING: - if (zend_symtable_exists(array, Z_STRVAL_P(key), Z_STRSIZE_P(key) + 1)) { + if (zend_symtable_exists(array, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1)) { RETURN_TRUE; } RETURN_FALSE; @@ -4432,7 +4441,7 @@ PHP_FUNCTION(array_chunk) int argc = ZEND_NUM_ARGS(), key_type, num_in; long size, current = 0; char *str_key; - zend_str_size str_key_len; + uint str_key_len; ulong num_key; zend_bool preserve_keys = 0; zval *input = NULL; @@ -4545,7 +4554,7 @@ PHP_FUNCTION(array_combine) } zval_add_ref(entry_values); - add_assoc_zval_ex(return_value, Z_STRVAL_P(key_ptr), Z_STRSIZE_P(key_ptr) + 1, *entry_values); + add_assoc_zval_ex(return_value, Z_STRVAL_P(key_ptr), Z_STRLEN_P(key_ptr) + 1, *entry_values); if (key_ptr != *entry_keys) { zval_dtor(&key); diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 669f9beff6cb7..631834c97c0f3 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -165,7 +165,7 @@ PHP_FUNCTION(assert) } compiled_string_description = zend_make_compiled_string_description("assert code" TSRMLS_CC); - if (zend_eval_stringl(myeval, Z_STRSIZE_PP(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) { + if (zend_eval_stringl(myeval, Z_STRLEN_PP(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) { efree(compiled_string_description); if (description_len == 0) { php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval); @@ -277,7 +277,7 @@ PHP_FUNCTION(assert_options) oldint = ASSERTG(active); if (ac == 2) { convert_to_string_ex(value); - zend_alter_ini_entry_ex("assert.active", sizeof("assert.active"), Z_STRVAL_PP(value), Z_STRSIZE_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); + zend_alter_ini_entry_ex("assert.active", sizeof("assert.active"), Z_STRVAL_PP(value), Z_STRLEN_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); } RETURN_LONG(oldint); break; @@ -286,7 +286,7 @@ PHP_FUNCTION(assert_options) oldint = ASSERTG(bail); if (ac == 2) { convert_to_string_ex(value); - zend_alter_ini_entry_ex("assert.bail", sizeof("assert.bail"), Z_STRVAL_PP(value), Z_STRSIZE_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); + zend_alter_ini_entry_ex("assert.bail", sizeof("assert.bail"), Z_STRVAL_PP(value), Z_STRLEN_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); } RETURN_LONG(oldint); break; @@ -295,7 +295,7 @@ PHP_FUNCTION(assert_options) oldint = ASSERTG(quiet_eval); if (ac == 2) { convert_to_string_ex(value); - zend_alter_ini_entry_ex("assert.quiet_eval", sizeof("assert.quiet_eval"), Z_STRVAL_PP(value), Z_STRSIZE_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); + zend_alter_ini_entry_ex("assert.quiet_eval", sizeof("assert.quiet_eval"), Z_STRVAL_PP(value), Z_STRLEN_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); } RETURN_LONG(oldint); break; @@ -304,7 +304,7 @@ PHP_FUNCTION(assert_options) oldint = ASSERTG(warning); if (ac == 2) { convert_to_string_ex(value); - zend_alter_ini_entry_ex("assert.warning", sizeof("assert.warning"), Z_STRVAL_PP(value), Z_STRSIZE_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); + zend_alter_ini_entry_ex("assert.warning", sizeof("assert.warning"), Z_STRVAL_PP(value), Z_STRLEN_PP(value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC); } RETURN_LONG(oldint); break; diff --git a/ext/standard/base64.c b/ext/standard/base64.c index 8e001c595a8d6..7534c8f8a4063 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -53,7 +53,7 @@ static const short base64_reverse_table[256] = { }; /* }}} */ -PHPAPI unsigned char *php_base64_encode(const unsigned char *str, zend_str_size_int length, zend_str_size_int *ret_length) /* {{{ */ +PHPAPI unsigned char *php_base64_encode(const unsigned char *str, int length, int *ret_length) /* {{{ */ { const unsigned char *current = str; unsigned char *p; @@ -134,13 +134,13 @@ void php_base64_init(void) */ /* }}} */ -PHPAPI unsigned char *php_base64_decode(const unsigned char *str, zend_str_size_int length, zend_str_size_int *ret_length) /* {{{ */ +PHPAPI unsigned char *php_base64_decode(const unsigned char *str, int length, int *ret_length) /* {{{ */ { return php_base64_decode_ex(str, length, ret_length, 0); } /* }}} */ -PHPAPI unsigned char *php_base64_decode_ex(const unsigned char *str, zend_str_size_int length, zend_str_size_int *ret_length, zend_bool strict) /* {{{ */ +PHPAPI unsigned char *php_base64_decode_ex(const unsigned char *str, int length, int *ret_length, zend_bool strict) /* {{{ */ { const unsigned char *current = str; int ch, i = 0, j = 0, k; @@ -221,9 +221,9 @@ PHP_FUNCTION(base64_encode) { char *str; unsigned char *result; - zend_str_size_int str_len, ret_length; + int str_len, ret_length; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { return; } result = php_base64_encode((unsigned char*)str, str_len, &ret_length); @@ -242,9 +242,9 @@ PHP_FUNCTION(base64_decode) char *str; unsigned char *result; zend_bool strict = 0; - zend_str_size_int str_len, ret_length; + int str_len, ret_length; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &str, &str_len, &strict) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &str, &str_len, &strict) == FAILURE) { return; } result = php_base64_decode_ex((unsigned char*)str, str_len, &ret_length, strict); diff --git a/ext/standard/base64.h b/ext/standard/base64.h index 6f25fb75de7d0..3f9d818baa210 100644 --- a/ext/standard/base64.h +++ b/ext/standard/base64.h @@ -24,9 +24,9 @@ PHP_FUNCTION(base64_decode); PHP_FUNCTION(base64_encode); -PHPAPI extern unsigned char *php_base64_encode(const unsigned char *, zend_str_size_int, zend_str_size_int *); -PHPAPI extern unsigned char *php_base64_decode_ex(const unsigned char *, zend_str_size_int, zend_str_size_int *, zend_bool); -PHPAPI extern unsigned char *php_base64_decode(const unsigned char *, zend_str_size_int, zend_str_size_int *); +PHPAPI extern unsigned char *php_base64_encode(const unsigned char *, int, int *); +PHPAPI extern unsigned char *php_base64_decode_ex(const unsigned char *, int, int *, zend_bool); +PHPAPI extern unsigned char *php_base64_decode(const unsigned char *, int, int *); #endif /* BASE64_H */ diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 44ee5f26bf75e..13791177457e8 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -3851,9 +3851,9 @@ PHP_MINFO_FUNCTION(basic) /* {{{ */ PHP_FUNCTION(constant) { char *const_name; - zend_str_size const_name_len; + int const_name_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &const_name, &const_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &const_name, &const_name_len) == FAILURE) { return; } @@ -3870,11 +3870,10 @@ PHP_FUNCTION(constant) PHP_NAMED_FUNCTION(php_inet_ntop) { char *address; - zend_str_size address_len; - int af = AF_INET; + int address_len, af = AF_INET; char buffer[40]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &address, &address_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &address, &address_len) == FAILURE) { RETURN_FALSE; } @@ -3905,10 +3904,10 @@ PHP_NAMED_FUNCTION(php_inet_pton) { int ret, af = AF_INET; char *address; - zend_str_size address_len; + int address_len; char buffer[17]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &address, &address_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &address, &address_len) == FAILURE) { RETURN_FALSE; } @@ -3941,14 +3940,14 @@ PHP_NAMED_FUNCTION(php_inet_pton) PHP_FUNCTION(ip2long) { char *addr; - zend_str_size addr_len; + int addr_len; #ifdef HAVE_INET_PTON struct in_addr ip; #else unsigned long int ip; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &addr, &addr_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &addr, &addr_len) == FAILURE) { return; } @@ -3980,14 +3979,14 @@ PHP_FUNCTION(long2ip) { /* "It's a long but it's not, PHP ints are signed */ char *ip; - zend_str_size ip_len; + int ip_len; unsigned long n; struct in_addr myaddr; #ifdef HAVE_INET_PTON char str[40]; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &ip, &ip_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &ip, &ip_len) == FAILURE) { return; } @@ -4015,9 +4014,9 @@ PHP_FUNCTION(long2ip) PHP_FUNCTION(getenv) { char *ptr, *str; - zend_str_size str_len; + int str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { RETURN_FALSE; } @@ -4029,7 +4028,7 @@ PHP_FUNCTION(getenv) #ifdef PHP_WIN32 { char dummybuf; - zend_str_size size; + int size; SetLastError(0); /*If the given bugger is not large enough to hold the data, the return value is @@ -4073,9 +4072,9 @@ PHP_FUNCTION(getenv) PHP_FUNCTION(putenv) { char *setting; - zend_str_size setting_len; + int setting_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &setting, &setting_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &setting, &setting_len) == FAILURE) { return; } @@ -4243,15 +4242,14 @@ PHP_FUNCTION(getopt) char *options = NULL, **argv = NULL; char opt[2] = { '\0' }; char *optname; - int argc = 0, o; - zend_str_size options_len = 0, len; + int argc = 0, options_len = 0, len, o; char *php_optarg = NULL; int php_optind = 1; zval *val, **args = NULL, *p_longopts = NULL; - zend_str_size optname_len = 0; + int optname_len = 0; opt_struct *opts, *orig_opts; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|a", &options, &options_len, &p_longopts) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|a", &options, &options_len, &p_longopts) == FAILURE) { RETURN_FALSE; } @@ -4579,9 +4577,9 @@ static int add_config_entry_cb(zval *entry TSRMLS_DC, int num_args, va_list args if (Z_TYPE_P(entry) == IS_STRING) { if (hash_key->nKeyLength > 0) { - add_assoc_stringl_ex(retval, hash_key->arKey, hash_key->nKeyLength, Z_STRVAL_P(entry), Z_STRSIZE_P(entry), 1); + add_assoc_stringl_ex(retval, hash_key->arKey, hash_key->nKeyLength, Z_STRVAL_P(entry), Z_STRLEN_P(entry), 1); } else { - add_index_stringl(retval, hash_key->h, Z_STRVAL_P(entry), Z_STRSIZE_P(entry), 1); + add_index_stringl(retval, hash_key->h, Z_STRVAL_P(entry), Z_STRLEN_P(entry), 1); } } else if (Z_TYPE_P(entry) == IS_ARRAY) { MAKE_STD_ZVAL(tmp); @@ -4598,10 +4596,10 @@ static int add_config_entry_cb(zval *entry TSRMLS_DC, int num_args, va_list args PHP_FUNCTION(get_cfg_var) { char *varname; - zend_str_size varname_len; + int varname_len; zval *retval; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &varname, &varname_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &varname, &varname_len) == FAILURE) { return; } @@ -4679,11 +4677,11 @@ error options: PHP_FUNCTION(error_log) { char *message, *opt = NULL, *headers = NULL; - zend_str_size message_len, opt_len = 0, headers_len = 0; + int message_len, opt_len = 0, headers_len = 0; int opt_err = 0, argc = ZEND_NUM_ARGS(); long erropt = 0; - if (zend_parse_parameters(argc TSRMLS_CC, "S|lPS", &message, &message_len, &erropt, &opt, &opt_len, &headers, &headers_len) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "s|lps", &message, &message_len, &erropt, &opt, &opt_len, &headers, &headers_len) == FAILURE) { return; } @@ -4706,7 +4704,7 @@ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers T } /* }}} */ -PHPAPI int _php_error_log_ex(int opt_err, char *message, zend_str_size_int message_len, char *opt, char *headers TSRMLS_DC) /* {{{ */ +PHPAPI int _php_error_log_ex(int opt_err, char *message, int message_len, char *opt, char *headers TSRMLS_DC) /* {{{ */ { php_stream *stream = NULL; @@ -5200,12 +5198,11 @@ ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highl PHP_FUNCTION(highlight_file) { char *filename; - zend_str_size filename_len; - int ret; + int filename_len, ret; zend_syntax_highlighter_ini syntax_highlighter_ini; zend_bool i = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|b", &filename, &filename_len, &i) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &filename, &filename_len, &i) == FAILURE) { RETURN_FALSE; } @@ -5242,11 +5239,11 @@ PHP_FUNCTION(highlight_file) PHP_FUNCTION(php_strip_whitespace) { char *filename; - zend_str_size filename_len; + int filename_len; zend_lex_state original_lex_state; zend_file_handle file_handle = {0}; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P", &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { RETURN_FALSE; } @@ -5324,9 +5321,9 @@ PHP_FUNCTION(highlight_string) PHP_FUNCTION(ini_get) { char *varname, *str; - zend_str_size varname_len; + int varname_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &varname, &varname_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &varname, &varname_len) == FAILURE) { return; } @@ -5392,12 +5389,11 @@ static int php_ini_get_option(zend_ini_entry *ini_entry TSRMLS_DC, int num_args, PHP_FUNCTION(ini_get_all) { char *extname = NULL; - zend_str_size extname_len = 0; - int extnumber = 0; + int extname_len = 0, extnumber = 0; zend_module_entry *module; zend_bool details = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S!b", &extname, &extname_len, &details) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!b", &extname, &extname_len, &details) == FAILURE) { return; } @@ -5416,7 +5412,7 @@ PHP_FUNCTION(ini_get_all) } /* }}} */ -static int php_ini_check_path(char *option_name, zend_str_size_int option_len, char *new_option_name, zend_str_size_int new_option_len) /* {{{ */ +static int php_ini_check_path(char *option_name, int option_len, char *new_option_name, int new_option_len) /* {{{ */ { if (option_len != (new_option_len - 1)) { return 0; @@ -5431,10 +5427,10 @@ static int php_ini_check_path(char *option_name, zend_str_size_int option_len, c PHP_FUNCTION(ini_set) { char *varname, *new_value; - zend_str_size varname_len, new_value_len; + int varname_len, new_value_len; char *old_value; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &varname, &varname_len, &new_value, &new_value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &varname, &varname_len, &new_value, &new_value_len) == FAILURE) { return; } @@ -5475,9 +5471,9 @@ PHP_FUNCTION(ini_set) PHP_FUNCTION(ini_restore) { char *varname; - zend_str_size varname_len; + int varname_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &varname, &varname_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &varname, &varname_len) == FAILURE) { return; } @@ -5490,10 +5486,10 @@ PHP_FUNCTION(ini_restore) PHP_FUNCTION(set_include_path) { char *new_value; - zend_str_size_int new_value_len; + int new_value_len; char *old_value; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &new_value, &new_value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &new_value, &new_value_len) == FAILURE) { return; } @@ -5590,10 +5586,10 @@ PHP_FUNCTION(connection_status) PHP_FUNCTION(ignore_user_abort) { char *arg = NULL; - zend_str_size arg_len = 0; + int arg_len = 0; int old_setting; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &arg, &arg_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &arg, &arg_len) == FAILURE) { return; } @@ -5613,10 +5609,10 @@ PHP_FUNCTION(ignore_user_abort) PHP_FUNCTION(getservbyname) { char *name, *proto; - zend_str_size name_len, proto_len; + int name_len, proto_len; struct servent *serv; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &name, &name_len, &proto, &proto_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &proto, &proto_len) == FAILURE) { return; } @@ -5646,11 +5642,11 @@ PHP_FUNCTION(getservbyname) PHP_FUNCTION(getservbyport) { char *proto; - zend_str_size proto_len; + int proto_len; long port; struct servent *serv; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lS", &port, &proto, &proto_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &port, &proto, &proto_len) == FAILURE) { return; } @@ -5671,10 +5667,10 @@ PHP_FUNCTION(getservbyport) PHP_FUNCTION(getprotobyname) { char *name; - zend_str_size name_len; + int name_len; struct protoent *ent; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; } @@ -5797,13 +5793,13 @@ PHP_FUNCTION(unregister_tick_function) PHP_FUNCTION(is_uploaded_file) { char *path; - zend_str_size path_len; + int path_len; if (!SG(rfc1867_uploaded_files)) { RETURN_FALSE; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &path, &path_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &path_len) == FAILURE) { return; } @@ -5820,7 +5816,7 @@ PHP_FUNCTION(is_uploaded_file) PHP_FUNCTION(move_uploaded_file) { char *path, *new_path; - zend_str_size path_len, new_path_len; + int path_len, new_path_len; zend_bool successful = 0; #ifndef PHP_WIN32 @@ -5831,7 +5827,7 @@ PHP_FUNCTION(move_uploaded_file) RETURN_FALSE; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &path, &path_len, &new_path, &new_path_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &path, &path_len, &new_path, &new_path_len) == FAILURE) { return; } @@ -5885,7 +5881,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal } ALLOC_ZVAL(element); MAKE_COPY_ZVAL(&arg2, element); - zend_symtable_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, &element, sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, &element, sizeof(zval *), NULL); break; case ZEND_INI_PARSER_POP_ENTRY: @@ -5897,8 +5893,8 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal break; } - if (!(Z_STRSIZE_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1), NULL, NULL, 0) == IS_LONG) { - ulong key = (ulong) zend_atol(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)); + if (!(Z_STRLEN_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) == IS_LONG) { + ulong key = (ulong) zend_atol(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)); if (zend_hash_index_find(Z_ARRVAL_P(arr), key, (void **) &find_hash) == FAILURE) { ALLOC_ZVAL(hash); INIT_PZVAL(hash); @@ -5909,12 +5905,12 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal hash = *find_hash; } } else { - if (zend_hash_find(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, (void **) &find_hash) == FAILURE) { + if (zend_hash_find(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, (void **) &find_hash) == FAILURE) { ALLOC_ZVAL(hash); INIT_PZVAL(hash); array_init(hash); - zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, &hash, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, &hash, sizeof(zval *), NULL); } else { hash = *find_hash; } @@ -5929,8 +5925,8 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal ALLOC_ZVAL(element); MAKE_COPY_ZVAL(&arg2, element); - if (arg3 && Z_STRSIZE_P(arg3) > 0) { - add_assoc_zval_ex(hash, Z_STRVAL_P(arg3), Z_STRSIZE_P(arg3) + 1, element); + if (arg3 && Z_STRLEN_P(arg3) > 0) { + add_assoc_zval_ex(hash, Z_STRVAL_P(arg3), Z_STRLEN_P(arg3) + 1, element); } else { add_next_index_zval(hash, element); } @@ -5950,7 +5946,7 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, zval *arg3, if (callback_type == ZEND_INI_PARSER_SECTION) { MAKE_STD_ZVAL(BG(active_ini_file_section)); array_init(BG(active_ini_file_section)); - zend_symtable_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, &BG(active_ini_file_section), sizeof(zval *), NULL); + zend_symtable_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, &BG(active_ini_file_section), sizeof(zval *), NULL); } else if (arg2) { zval *active_arr; @@ -5970,13 +5966,13 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, zval *arg3, PHP_FUNCTION(parse_ini_file) { char *filename = NULL; - zend_str_size filename_len = 0; + int filename_len = 0; zend_bool process_sections = 0; long scanner_mode = ZEND_INI_SCANNER_NORMAL; zend_file_handle fh; zend_ini_parser_cb_t ini_parser_cb; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|bl", &filename, &filename_len, &process_sections, &scanner_mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|bl", &filename, &filename_len, &process_sections, &scanner_mode) == FAILURE) { RETURN_FALSE; } @@ -6012,12 +6008,12 @@ PHP_FUNCTION(parse_ini_file) PHP_FUNCTION(parse_ini_string) { char *string = NULL, *str = NULL; - zend_str_size str_len = 0; + int str_len = 0; zend_bool process_sections = 0; long scanner_mode = ZEND_INI_SCANNER_NORMAL; zend_ini_parser_cb_t ini_parser_cb; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|bl", &str, &str_len, &process_sections, &scanner_mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &str, &str_len, &process_sections, &scanner_mode) == FAILURE) { RETURN_FALSE; } diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h index 29c83808b47d9..7327f7d2d2ecd 100644 --- a/ext/standard/basic_functions.h +++ b/ext/standard/basic_functions.h @@ -144,8 +144,8 @@ PHP_RSHUTDOWN_FUNCTION(browscap); /* Left for BC (not binary safe!) */ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers TSRMLS_DC); -PHPAPI int _php_error_log_ex(int opt_err, char *message, zend_str_size_int message_len, char *opt, char *headers TSRMLS_DC); -PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, zend_str_size_int var_name_len, zend_bool add_underscore TSRMLS_DC); +PHPAPI int _php_error_log_ex(int opt_err, char *message, int message_len, char *opt, char *headers TSRMLS_DC); +PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC); #if SIZEOF_INT == 4 /* Most 32-bit and 64-bit systems have 32-bit ints */ diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index c5d5bc4f53a6e..ed773b851c33e 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -87,14 +87,14 @@ static void convert_browscap_pattern(zval *pattern, int persistent) /* {{{ */ int i, j=0; char *t; - php_strtolower(Z_STRVAL_P(pattern), Z_STRSIZE_P(pattern)); + php_strtolower(Z_STRVAL_P(pattern), Z_STRLEN_P(pattern)); - t = (char *) safe_pemalloc(Z_STRSIZE_P(pattern), 2, 5, persistent); + t = (char *) safe_pemalloc(Z_STRLEN_P(pattern), 2, 5, persistent); t[j++] = '\xA7'; /* section sign */ t[j++] = '^'; - for (i=0; icurrent_section), new_key, Z_STRSIZE_P(arg1) + 1, &new_property, sizeof(zval *), NULL); + new_key = pestrndup(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), persistent); + zend_str_tolower(new_key, Z_STRLEN_P(arg1)); + zend_hash_update(Z_ARRVAL_P(bdata->current_section), new_key, Z_STRLEN_P(arg1) + 1, &new_property, sizeof(zval *), NULL); pefree(new_key, persistent); } break; @@ -218,17 +218,17 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb pefree(bdata->current_section_name, persistent); } bdata->current_section_name = pestrndup(Z_STRVAL_P(arg1), - Z_STRSIZE_P(arg1), persistent); + Z_STRLEN_P(arg1), persistent); - zend_hash_update(bdata->htab, Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, (void *) &bdata->current_section, sizeof(zval *), NULL); + zend_hash_update(bdata->htab, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, (void *) &bdata->current_section, sizeof(zval *), NULL); Z_STRVAL_P(processed) = Z_STRVAL_P(arg1); - Z_STRSIZE_P(processed) = Z_STRSIZE_P(arg1); + Z_STRLEN_P(processed) = Z_STRLEN_P(arg1); Z_TYPE_P(processed) = IS_STRING; Z_STRVAL_P(unprocessed) = Z_STRVAL_P(arg1); - Z_STRSIZE_P(unprocessed) = Z_STRSIZE_P(arg1); + Z_STRLEN_P(unprocessed) = Z_STRLEN_P(arg1); Z_TYPE_P(unprocessed) = IS_STRING; - Z_STRVAL_P(unprocessed) = pestrndup(Z_STRVAL_P(unprocessed), Z_STRSIZE_P(unprocessed), persistent); + Z_STRVAL_P(unprocessed) = pestrndup(Z_STRVAL_P(unprocessed), Z_STRLEN_P(unprocessed), persistent); convert_browscap_pattern(processed, persistent); zend_hash_update(section_properties, "browser_name_regex", sizeof("browser_name_regex"), (void *) &processed, sizeof(zval *), NULL); @@ -412,7 +412,7 @@ static int browser_reg_compare(zval **browser TSRMLS_DC, int num_args, va_list a ua_len = lookup_browser_length; - for (i = 0; i < Z_STRSIZE_PP(previous_match); i++) { + for (i = 0; i < Z_STRLEN_PP(previous_match); i++) { switch (Z_STRVAL_PP(previous_match)[i]) { case '?': case '*': @@ -424,7 +424,7 @@ static int browser_reg_compare(zval **browser TSRMLS_DC, int num_args, va_list a } } - for (i = 0; i < Z_STRSIZE_PP(current_match); i++) { + for (i = 0; i < Z_STRLEN_PP(current_match); i++) { switch (Z_STRVAL_PP(current_match)[i]) { case '?': case '*': @@ -469,7 +469,7 @@ static void browscap_zval_copy_ctor(zval **p) /* {{{ */ PHP_FUNCTION(get_browser) { char *agent_name = NULL; - zend_str_size agent_name_len = 0; + int agent_name_len = 0; zend_bool return_array = 0; zval **agent, **z_agent_name, **http_user_agent; zval *found_browser_entry, *tmp_copy; @@ -504,7 +504,7 @@ PHP_FUNCTION(get_browser) RETURN_FALSE; } agent_name = Z_STRVAL_PP(http_user_agent); - agent_name_len = Z_STRSIZE_PP(http_user_agent); + agent_name_len = Z_STRLEN_PP(http_user_agent); } lookup_browser_name = estrndup(agent_name, agent_name_len); @@ -532,7 +532,7 @@ PHP_FUNCTION(get_browser) } while (zend_hash_find(Z_ARRVAL_PP(agent), "parent", sizeof("parent"), (void **) &z_agent_name) == SUCCESS) { - if (zend_hash_find(bdata->htab, Z_STRVAL_PP(z_agent_name), Z_STRSIZE_PP(z_agent_name) + 1, (void **)&agent) == FAILURE) { + if (zend_hash_find(bdata->htab, Z_STRVAL_PP(z_agent_name), Z_STRLEN_PP(z_agent_name) + 1, (void **)&agent) == FAILURE) { break; } diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index 2af2209f2bb54..fba423b19195a 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -358,29 +358,7 @@ else AC_MSG_RESULT(no) fi -PHP_ENABLE_CHROOT_FUNC=no -case "$PHP_SAPI" in - embed) - PHP_ENABLE_CHROOT_FUNC=yes - ;; - - none) - for PROG in $PHP_BINARIES; do - case "$PROG" in - cgi|cli) - PHP_ENABLE_CHROOT_FUNC=yes - ;; - - *) - PHP_ENABLE_CHROOT_FUNC=no - break - ;; - esac - done - ;; -esac - -if test "$PHP_ENABLE_CHROOT_FUNC" = "yes"; then +if test "$PHP_SAPI" = "cgi" || test "$PHP_SAPI" = "cli" || test "$PHP_SAPI" = "embed"; then AC_DEFINE(ENABLE_CHROOT_FUNC, 1, [Whether to enable chroot() function]) fi diff --git a/ext/standard/crypt_freesec.h b/ext/standard/crypt_freesec.h index 860462a2dd622..a87663d4feaaf 100644 --- a/ext/standard/crypt_freesec.h +++ b/ext/standard/crypt_freesec.h @@ -4,13 +4,26 @@ #define _CRYPT_FREESEC_H #if PHP_WIN32 +# include "win32/php_stdint.h" # ifndef inline # define inline __inline # endif +#else +# include "php_config.h" +# if HAVE_INTTYPES_H +# include +# elif HAVE_STDINT_H +# include +# endif +# ifndef HAVE_UINT32_T +# if SIZEOF_INT == 4 +typedef unsigned int uint32_t; +# elif SIZEOF_LONG == 4 +typedef unsigned long int uint32_t; +# endif +# endif #endif -#include "php_stdint.h" - #define MD5_HASH_MAX_LEN 120 struct php_crypt_extended_data { diff --git a/ext/standard/crypt_sha256.c b/ext/standard/crypt_sha256.c index ccfa66bd60a8e..d334e3d477d89 100644 --- a/ext/standard/crypt_sha256.c +++ b/ext/standard/crypt_sha256.c @@ -9,9 +9,15 @@ #include #ifdef PHP_WIN32 +# include "win32/php_stdint.h" # define __alignof__ __alignof # define alloca _alloca #else +# if HAVE_INTTYPES_H +# include +# elif HAVE_STDINT_H +# include +# endif # ifndef HAVE_ALIGNOF # include # define __alignof__(type) offsetof (struct { char c; type member;}, member) diff --git a/ext/standard/crypt_sha512.c b/ext/standard/crypt_sha512.c index ebabed9d24f44..0955532131588 100644 --- a/ext/standard/crypt_sha512.c +++ b/ext/standard/crypt_sha512.c @@ -8,9 +8,15 @@ #include #include #ifdef PHP_WIN32 +# include "win32/php_stdint.h" # define __alignof__ __alignof # define alloca _alloca #else +# if HAVE_INTTYPES_H +# include +# elif HAVE_STDINT_H +# include +# endif # ifndef HAVE_ALIGNOF # include # define __alignof__(type) offsetof (struct { char c; type member;}, member) diff --git a/ext/standard/css.c b/ext/standard/css.c index 459a7bfc307cf..d76f9ee662676 100644 --- a/ext/standard/css.c +++ b/ext/standard/css.c @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ @@ -12,7 +12,7 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Colin Viebrock | + | Authors: Colin Viebrock | +----------------------------------------------------------------------+ */ @@ -23,24 +23,25 @@ PHPAPI void php_info_print_css(TSRMLS_D) /* {{{ */ { - PUTS("body {background-color: #fff; color: #222; font-family: sans-serif;}\n"); - PUTS("pre {margin: 0; font-family: monospace;}\n"); - PUTS("a:link {color: #009; text-decoration: none; background-color: #fff;}\n"); + PUTS("body {background-color: #ffffff; color: #000000;}\n"); + PUTS("body, td, th, h1, h2 {font-family: sans-serif;}\n"); + PUTS("pre {margin: 0px; font-family: monospace;}\n"); + PUTS("a:link {color: #000099; text-decoration: none; background-color: #ffffff;}\n"); PUTS("a:hover {text-decoration: underline;}\n"); - PUTS("table {border-collapse: collapse; border: 0; width: 934px; box-shadow: 1px 2px 3px #ccc;}\n"); + PUTS("table {border-collapse: collapse;}\n"); PUTS(".center {text-align: center;}\n"); - PUTS(".center table {margin: 1em auto; text-align: left;}\n"); - PUTS(".center th {text-align: center !important;}\n"); - PUTS("td, th {border: 1px solid #666; font-size: 75%; vertical-align: baseline; padding: 4px 5px;}\n"); + PUTS(".center table { margin-left: auto; margin-right: auto; text-align: left;}\n"); + PUTS(".center th { text-align: center !important; }\n"); + PUTS("td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}\n"); PUTS("h1 {font-size: 150%;}\n"); PUTS("h2 {font-size: 125%;}\n"); PUTS(".p {text-align: left;}\n"); - PUTS(".e {background-color: #ccf; width: 300px; font-weight: bold;}\n"); - PUTS(".h {background-color: #99c; font-weight: bold;}\n"); - PUTS(".v {background-color: #ddd; max-width: 300px; overflow-x: auto;}\n"); - PUTS(".v i {color: #999;}\n"); - PUTS("img {float: right; border: 0;}\n"); - PUTS("hr {width: 934px; background-color: #ccc; border: 0; height: 1px;}\n"); + PUTS(".e {background-color: #ccccff; font-weight: bold; color: #000000;}\n"); + PUTS(".h {background-color: #9999cc; font-weight: bold; color: #000000;}\n"); + PUTS(".v {background-color: #cccccc; color: #000000;}\n"); + PUTS(".vr {background-color: #cccccc; text-align: right; color: #000000;}\n"); + PUTS("img {float: right; border: 0px;}\n"); + PUTS("hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}\n"); } /* }}} */ diff --git a/ext/standard/css.h b/ext/standard/css.h index 0b3ae87cbd86c..d7275e08efd04 100644 --- a/ext/standard/css.h +++ b/ext/standard/css.h @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ @@ -12,7 +12,7 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Colin Viebrock | + | Authors: Colin Viebrock | +----------------------------------------------------------------------+ */ diff --git a/ext/standard/dir.c b/ext/standard/dir.c index de45adc3de3bb..55326dbdd3c33 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -214,12 +214,12 @@ PHP_MINIT_FUNCTION(dir) static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) { char *dirname; - zend_str_size dir_len; + int dir_len; zval *zcontext = NULL; php_stream_context *context = NULL; php_stream *dirp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|r", &dirname, &dir_len, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|r", &dirname, &dir_len, &zcontext) == FAILURE) { RETURN_NULL(); } @@ -292,10 +292,9 @@ PHP_FUNCTION(closedir) PHP_FUNCTION(chroot) { char *str; - int ret; - zend_str_size str_len; + int ret, str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { RETURN_FALSE; } @@ -324,10 +323,9 @@ PHP_FUNCTION(chroot) PHP_FUNCTION(chdir) { char *str; - int ret; - zend_str_size str_len; + int ret, str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &str, &str_len) == FAILURE) { RETURN_FALSE; } @@ -424,21 +422,21 @@ PHP_NAMED_FUNCTION(php_if_readdir) Find pathnames matching a pattern */ PHP_FUNCTION(glob) { - zend_str_size_int cwd_skip = 0; + int cwd_skip = 0; #ifdef ZTS char cwd[MAXPATHLEN]; char work_pattern[MAXPATHLEN]; char *result; #endif char *pattern = NULL; - zend_str_size pattern_len; + int pattern_len; long flags = 0; glob_t globbuf; int n; int ret; zend_bool basedir_limit = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|l", &pattern, &pattern_len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &pattern, &pattern_len, &flags) == FAILURE) { return; } @@ -547,14 +545,14 @@ PHP_FUNCTION(glob) PHP_FUNCTION(scandir) { char *dirn; - zend_str_size dirn_len; + int dirn_len; long flags = 0; char **namelist; int n, i; zval *zcontext = NULL; php_stream_context *context = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|lr", &dirn, &dirn_len, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lr", &dirn, &dirn_len, &flags, &zcontext) == FAILURE) { return; } diff --git a/ext/standard/dl.c b/ext/standard/dl.c index 0df54ebb2717b..ceb975e93bd79 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -129,7 +129,7 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now TSRMLS_DC) } libpath = estrdup(filename); } else if (extension_dir && extension_dir[0]) { - zend_str_size_int extension_dir_len = strlen(extension_dir); + int extension_dir_len = strlen(extension_dir); if (IS_SLASH(extension_dir[extension_dir_len-1])) { spprintf(&libpath, 0, "%s%s", extension_dir, filename); /* SAFE */ diff --git a/ext/standard/dns.c b/ext/standard/dns.c index 136ef0fd4d1ff..3584fc1bfe9ec 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -153,10 +153,10 @@ PHP_FUNCTION(gethostname) PHP_FUNCTION(gethostbyaddr) { char *addr; - zend_str_size_int addr_len; + int addr_len; char *hostname; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &addr, &addr_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &addr, &addr_len) == FAILURE) { return; } @@ -215,10 +215,10 @@ static char *php_gethostbyaddr(char *ip) PHP_FUNCTION(gethostbyname) { char *hostname; - zend_str_size_int hostname_len; + int hostname_len; char *addr; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &hostname, &hostname_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &hostname_len) == FAILURE) { return; } @@ -233,12 +233,12 @@ PHP_FUNCTION(gethostbyname) PHP_FUNCTION(gethostbynamel) { char *hostname; - zend_str_size_int hostname_len; + int hostname_len; struct hostent *hp; struct in_addr in; int i; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &hostname, &hostname_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &hostname_len) == FAILURE) { return; } @@ -346,7 +346,7 @@ PHP_FUNCTION(dns_check_record) #endif u_char ans[MAXPACKET]; char *hostname, *rectype = NULL; - zend_str_size_int hostname_len, rectype_len = 0; + int hostname_len, rectype_len = 0; int type = T_MX, i; #if defined(HAVE_DNS_SEARCH) struct sockaddr_storage from; @@ -357,7 +357,7 @@ PHP_FUNCTION(dns_check_record) struct __res_state *handle = &state; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &hostname, &hostname_len, &rectype, &rectype_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &hostname, &hostname_len, &rectype, &rectype_len) == FAILURE) { return; } @@ -714,7 +714,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int PHP_FUNCTION(dns_get_record) { char *hostname; - zend_str_size_int hostname_len; + int hostname_len; long type_param = PHP_DNS_ANY; zval *authns = NULL, *addtl = NULL; int type_to_fetch; @@ -733,7 +733,7 @@ PHP_FUNCTION(dns_get_record) int type, first_query = 1, store_results = 1; zend_bool raw = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lz!z!b", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz!z!b", &hostname, &hostname_len, &type_param, &authns, &addtl, &raw) == FAILURE) { return; } @@ -926,7 +926,7 @@ PHP_FUNCTION(dns_get_record) PHP_FUNCTION(dns_get_mx) { char *hostname; - zend_str_size_int hostname_len; + int hostname_len; zval *mx_list, *weight_list = NULL; int count, qdc; u_short type, weight; @@ -944,7 +944,7 @@ PHP_FUNCTION(dns_get_mx) struct __res_state *handle = &state; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|z", &hostname, &hostname_len, &mx_list, &weight_list) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|z", &hostname, &hostname_len, &mx_list, &weight_list) == FAILURE) { return; } diff --git a/ext/standard/exec.c b/ext/standard/exec.c index a5f702fa41e7c..7b783ca60f60f 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -61,11 +61,10 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_ { FILE *fp; char *buf; - zend_str_size l = 0; - int pclose_return; + int l = 0, pclose_return; char *b, *d=NULL; php_stream *stream; - zend_str_size buflen, bufl = 0; + size_t buflen, bufl = 0; #if PHP_SIGCHILD void (*sig_handler)() = NULL; #endif @@ -117,7 +116,7 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_ /* strip trailing whitespaces */ l = bufl; while (l-- && isspace(((unsigned char *)buf)[l])); - if (l != (bufl - 1)) { + if (l != (int)(bufl - 1)) { bufl = l + 1; buf[bufl] = '\0'; } @@ -130,7 +129,7 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_ if ((type == 2 && buf != b) || type != 2) { l = bufl; while (l-- && isspace(((unsigned char *)buf)[l])); - if (l != (bufl - 1)) { + if (l != (int)(bufl - 1)) { bufl = l + 1; buf[bufl] = '\0'; } @@ -172,16 +171,16 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ { char *cmd; - zend_str_size cmd_len; + int cmd_len; zval *ret_code=NULL, *ret_array=NULL; int ret; if (mode) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|z/", &cmd, &cmd_len, &ret_code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/", &cmd, &cmd_len, &ret_code) == FAILURE) { RETURN_FALSE; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|z/z/", &cmd, &cmd_len, &ret_array, &ret_code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/", &cmd, &cmd_len, &ret_array, &ret_code) == FAILURE) { RETURN_FALSE; } } @@ -241,10 +240,10 @@ PHP_FUNCTION(passthru) */ PHPAPI char *php_escape_shell_cmd(char *str) { - register zend_str_size x, y, l = strlen(str); + register int x, y, l = strlen(str); char *cmd; char *p = NULL; - zend_str_size estimate = (2 * l) + 1; + size_t estimate = (2 * l) + 1; TSRMLS_FETCH(); @@ -332,9 +331,9 @@ PHPAPI char *php_escape_shell_cmd(char *str) */ PHPAPI char *php_escape_shell_arg(char *str) { - zend_str_size x, y = 0, l = strlen(str); + int x, y = 0, l = strlen(str); char *cmd; - zend_str_size estimate = (4 * l) + 3; + size_t estimate = (4 * l) + 3; TSRMLS_FETCH(); @@ -347,7 +346,7 @@ PHPAPI char *php_escape_shell_arg(char *str) #endif for (x = 0; x < l; x++) { - zend_str_size mb_len = php_mblen(str + x, (l - x)); + int mb_len = php_mblen(str + x, (l - x)); /* skip non-valid multibyte characters */ if (mb_len < 0) { @@ -397,10 +396,10 @@ PHPAPI char *php_escape_shell_arg(char *str) PHP_FUNCTION(escapeshellcmd) { char *command; - zend_str_size command_len; + int command_len; char *cmd = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &command, &command_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &command, &command_len) == FAILURE) { return; } @@ -418,10 +417,10 @@ PHP_FUNCTION(escapeshellcmd) PHP_FUNCTION(escapeshellarg) { char *argument; - zend_str_size argument_len; + int argument_len; char *cmd = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &argument, &argument_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &argument, &argument_len) == FAILURE) { return; } @@ -439,11 +438,11 @@ PHP_FUNCTION(shell_exec) FILE *in; size_t total_readbytes; char *command; - zend_str_size command_len; + int command_len; char *ret; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &command, &command_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &command, &command_len) == FAILURE) { return; } diff --git a/ext/standard/file.c b/ext/standard/file.c index 8ddf5badf8022..106f5c1004ec9 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -372,7 +372,7 @@ PHP_FUNCTION(flock) PHP_FUNCTION(get_meta_tags) { char *filename; - zend_str_size filename_len; + int filename_len; zend_bool use_include_path = 0; int in_tag = 0, done = 0; int looking_for_val = 0, have_name = 0, have_content = 0; @@ -385,7 +385,7 @@ PHP_FUNCTION(get_meta_tags) memset(&md, 0, sizeof(md)); /* Parse arguments */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|b", &filename, &filename_len, &use_include_path) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &filename, &filename_len, &use_include_path) == FAILURE) { return; } @@ -515,18 +515,18 @@ PHP_FUNCTION(get_meta_tags) PHP_FUNCTION(file_get_contents) { char *filename; - zend_str_size filename_len; + int filename_len; char *contents; zend_bool use_include_path = 0; php_stream *stream; - zend_str_size len; + int len; long offset = -1; long maxlen = PHP_STREAM_COPY_ALL; zval *zcontext = NULL; php_stream_context *context = NULL; /* Parse arguments */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) { return; } @@ -568,16 +568,16 @@ PHP_FUNCTION(file_put_contents) { php_stream *stream; char *filename; - zend_str_size filename_len; + int filename_len; zval *data; - zend_str_size numbytes = 0; + int numbytes = 0; long flags = 0; zval *zcontext = NULL; php_stream_context *context = NULL; php_stream *srcstream = NULL; char mode[3] = "wb"; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Pz/|lr!", &filename, &filename_len, &data, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pz/|lr!", &filename, &filename_len, &data, &flags, &zcontext) == FAILURE) { return; } @@ -618,7 +618,7 @@ PHP_FUNCTION(file_put_contents) switch (Z_TYPE_P(data)) { case IS_RESOURCE: { - zend_str_size len; + size_t len; if (php_stream_copy_to_stream_ex(srcstream, stream, PHP_STREAM_COPY_ALL, &len) != SUCCESS) { numbytes = -1; } else { @@ -634,10 +634,10 @@ PHP_FUNCTION(file_put_contents) convert_to_string_ex(&data); case IS_STRING: - if (Z_STRSIZE_P(data)) { - numbytes = php_stream_write(stream, Z_STRVAL_P(data), Z_STRSIZE_P(data)); - if (numbytes != Z_STRSIZE_P(data)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", numbytes, Z_STRSIZE_P(data)); + if (Z_STRLEN_P(data)) { + numbytes = php_stream_write(stream, Z_STRVAL_P(data), Z_STRLEN_P(data)); + if (numbytes != Z_STRLEN_P(data)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", numbytes, Z_STRLEN_P(data)); numbytes = -1; } } @@ -645,7 +645,7 @@ PHP_FUNCTION(file_put_contents) case IS_ARRAY: if (zend_hash_num_elements(Z_ARRVAL_P(data))) { - zend_str_size bytes_written; + int bytes_written; zval **tmp; HashPosition pos; @@ -655,14 +655,14 @@ PHP_FUNCTION(file_put_contents) SEPARATE_ZVAL(tmp); convert_to_string(*tmp); } - if (Z_STRSIZE_PP(tmp)) { - numbytes += Z_STRSIZE_PP(tmp); - bytes_written = php_stream_write(stream, Z_STRVAL_PP(tmp), Z_STRSIZE_PP(tmp)); - if (bytes_written < 0 || bytes_written != Z_STRSIZE_PP(tmp)) { + if (Z_STRLEN_PP(tmp)) { + numbytes += Z_STRLEN_PP(tmp); + bytes_written = php_stream_write(stream, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); + if (bytes_written < 0 || bytes_written != Z_STRLEN_PP(tmp)) { if (bytes_written < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write %d bytes to %s", Z_STRSIZE_PP(tmp), filename); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write %d bytes to %s", Z_STRLEN_PP(tmp), filename); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", bytes_written, Z_STRSIZE_PP(tmp)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", bytes_written, Z_STRLEN_PP(tmp)); } numbytes = -1; break; @@ -678,9 +678,9 @@ PHP_FUNCTION(file_put_contents) zval out; if (zend_std_cast_object_tostring(data, &out, IS_STRING TSRMLS_CC) == SUCCESS) { - numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRSIZE(out)); - if (numbytes != Z_STRSIZE(out)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", numbytes, Z_STRSIZE(out)); + numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRLEN(out)); + if (numbytes != Z_STRLEN(out)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", numbytes, Z_STRLEN(out)); numbytes = -1; } zval_dtor(&out); @@ -697,7 +697,7 @@ PHP_FUNCTION(file_put_contents) RETURN_FALSE; } - RETURN_LONG((long) numbytes); + RETURN_LONG(numbytes); } /* }}} */ @@ -708,10 +708,10 @@ PHP_FUNCTION(file_put_contents) PHP_FUNCTION(file) { char *filename; - zend_str_size filename_len; + int filename_len; char *target_buf=NULL, *p, *s, *e; register int i = 0; - zend_str_size target_len; + int target_len; char eol_marker = '\n'; long flags = 0; zend_bool use_include_path; @@ -722,7 +722,7 @@ PHP_FUNCTION(file) php_stream_context *context = NULL; /* Parse arguments */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|lr!", &filename, &filename_len, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lr!", &filename, &filename_len, &flags, &zcontext) == FAILURE) { return; } if (flags < 0 || flags > (PHP_FILE_USE_INCLUDE_PATH | PHP_FILE_IGNORE_NEW_LINES | PHP_FILE_SKIP_EMPTY_LINES | PHP_FILE_NO_DEFAULT_CONTEXT)) { @@ -800,13 +800,13 @@ PHP_FUNCTION(file) PHP_FUNCTION(tempnam) { char *dir, *prefix; - zend_str_size dir_len, prefix_len; + int dir_len, prefix_len; size_t p_len; char *opened_path; char *p; int fd; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "PS", &dir, &dir_len, &prefix, &prefix_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps", &dir, &dir_len, &prefix, &prefix_len) == FAILURE) { return; } @@ -854,13 +854,13 @@ PHP_NAMED_FUNCTION(php_if_tmpfile) PHP_NAMED_FUNCTION(php_if_fopen) { char *filename, *mode; - zend_str_size filename_len, mode_len; + int filename_len, mode_len; zend_bool use_include_path = 0; zval *zcontext = NULL; php_stream *stream; php_stream_context *context = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "PS|br", &filename, &filename_len, &mode, &mode_len, &use_include_path, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps|br", &filename, &filename_len, &mode, &mode_len, &use_include_path, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -909,12 +909,12 @@ PHPAPI PHP_FUNCTION(fclose) PHP_FUNCTION(popen) { char *command, *mode; - zend_str_size command_len, mode_len; + int command_len, mode_len; FILE *fp; php_stream *stream; char *posix_mode; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "PS", &command, &command_len, &mode, &mode_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps", &command, &command_len, &mode, &mode_len) == FAILURE) { return; } @@ -1027,7 +1027,7 @@ PHPAPI PHP_FUNCTION(fgets) ZVAL_STRINGL(return_value, buf, line_len, 0); /* resize buffer if it's much larger than the result. * Only needed if the user requested a buffer size. */ - if (argc > 1 && Z_STRSIZE_P(return_value) < len / 2) { + if (argc > 1 && Z_STRLEN_P(return_value) < len / 2) { Z_STRVAL_P(return_value) = erealloc(buf, line_len + 1); } return; @@ -1074,14 +1074,14 @@ PHPAPI PHP_FUNCTION(fgetss) { zval *fd; long bytes = 0; - zend_str_size len = 0; - zend_str_size actual_len, retval_len; + size_t len = 0; + size_t actual_len, retval_len; char *buf = NULL, *retval; php_stream *stream; char *allowed_tags=NULL; - zend_str_size allowed_tags_len=0; + int allowed_tags_len=0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|lS", &fd, &bytes, &allowed_tags, &allowed_tags_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ls", &fd, &bytes, &allowed_tags, &allowed_tags_len) == FAILURE) { RETURN_FALSE; } @@ -1093,7 +1093,7 @@ PHPAPI PHP_FUNCTION(fgetss) RETURN_FALSE; } - len = (zend_str_size) bytes; + len = (size_t) bytes; buf = safe_emalloc(sizeof(char), (len + 1), 0); /*needed because recv doesnt set null char at end*/ memset(buf, 0, len + 1); @@ -1116,16 +1116,14 @@ PHPAPI PHP_FUNCTION(fgetss) Implements a mostly ANSI compatible fscanf() */ PHP_FUNCTION(fscanf) { - int result; - zend_str_size format_len; - int type, argc = 0; + int result, format_len, type, argc = 0; zval ***args = NULL; zval *file_handle; char *buf, *format; - zend_str_size len; + size_t len; void *what; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS*", &file_handle, &format, &format_len, &args, &argc) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs*", &file_handle, &format, &format_len, &args, &argc) == FAILURE) { return; } @@ -1168,21 +1166,21 @@ PHPAPI PHP_FUNCTION(fwrite) { zval *arg1; char *arg2; - zend_str_size arg2len; - zend_str_size_int ret; - zend_str_size num_bytes; + int arg2len; + int ret; + int num_bytes; long arg3 = 0; char *buffer = NULL; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS|l", &arg1, &arg2, &arg2len, &arg3) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &arg2, &arg2len, &arg3) == FAILURE) { RETURN_FALSE; } if (ZEND_NUM_ARGS() == 2) { num_bytes = arg2len; } else { - num_bytes = MAX(0, MIN((zend_str_size)arg3, arg2len)); + num_bytes = MAX(0, MIN((int)arg3, arg2len)); } if (!num_bytes) { @@ -1286,7 +1284,7 @@ PHPAPI PHP_FUNCTION(fseek) */ /* DEPRECATED APIs: Use php_stream_mkdir() instead */ -PHPAPI int php_mkdir_ex(const char *dir, long mode, int options TSRMLS_DC) +PHPAPI int php_mkdir_ex(char *dir, long mode, int options TSRMLS_DC) { int ret; @@ -1301,7 +1299,7 @@ PHPAPI int php_mkdir_ex(const char *dir, long mode, int options TSRMLS_DC) return ret; } -PHPAPI int php_mkdir(const char *dir, long mode TSRMLS_DC) +PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC) { return php_mkdir_ex(dir, mode, REPORT_ERRORS TSRMLS_CC); } @@ -1312,13 +1310,13 @@ PHPAPI int php_mkdir(const char *dir, long mode TSRMLS_DC) PHP_FUNCTION(mkdir) { char *dir; - zend_str_size dir_len; + int dir_len; zval *zcontext = NULL; long mode = 0777; zend_bool recursive = 0; php_stream_context *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|lbr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lbr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -1333,11 +1331,11 @@ PHP_FUNCTION(mkdir) PHP_FUNCTION(rmdir) { char *dir; - zend_str_size dir_len; + int dir_len; zval *zcontext = NULL; php_stream_context *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|r", &dir, &dir_len, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|r", &dir, &dir_len, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -1352,14 +1350,14 @@ PHP_FUNCTION(rmdir) PHP_FUNCTION(readfile) { char *filename; - zend_str_size filename_len; - zend_str_size size = 0; + int filename_len; + int size = 0; zend_bool use_include_path = 0; zval *zcontext = NULL; php_stream *stream; php_stream_context *context = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|br!", &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|br!", &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -1369,7 +1367,7 @@ PHP_FUNCTION(readfile) if (stream) { size = php_stream_passthru(stream); php_stream_close(stream); - RETURN_LONG((long) size); + RETURN_LONG(size); } RETURN_FALSE; @@ -1408,7 +1406,7 @@ PHP_FUNCTION(umask) PHPAPI PHP_FUNCTION(fpassthru) { zval *arg1; - zend_str_size size; + int size; php_stream *stream; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) { @@ -1418,7 +1416,7 @@ PHPAPI PHP_FUNCTION(fpassthru) PHP_STREAM_TO_ZVAL(stream, &arg1); size = php_stream_passthru(stream); - RETURN_LONG((long) size); + RETURN_LONG(size); } /* }}} */ @@ -1427,12 +1425,12 @@ PHPAPI PHP_FUNCTION(fpassthru) PHP_FUNCTION(rename) { char *old_name, *new_name; - zend_str_size old_name_len, new_name_len; + int old_name_len, new_name_len; zval *zcontext = NULL; php_stream_wrapper *wrapper; php_stream_context *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "PP|r", &old_name, &old_name_len, &new_name, &new_name_len, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|r", &old_name, &old_name_len, &new_name, &new_name_len, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -1464,12 +1462,12 @@ PHP_FUNCTION(rename) PHP_FUNCTION(unlink) { char *filename; - zend_str_size filename_len; + int filename_len; php_stream_wrapper *wrapper; zval *zcontext = NULL; php_stream_context *context = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|r", &filename, &filename_len, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|r", &filename, &filename_len, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -1601,11 +1599,11 @@ PHP_NAMED_FUNCTION(php_if_fstat) PHP_FUNCTION(copy) { char *source, *target; - zend_str_size source_len, target_len; + int source_len, target_len; zval *zcontext = NULL; php_stream_context *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "PP|r", &source, &source_len, &target, &target_len, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|r", &source, &source_len, &target, &target_len, &zcontext) == FAILURE) { return; } @@ -1625,7 +1623,7 @@ PHP_FUNCTION(copy) /* {{{ php_copy_file */ -PHPAPI int php_copy_file(const char *src, const char *dest TSRMLS_DC) +PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC) { return php_copy_file_ctx(src, dest, 0, NULL TSRMLS_CC); } @@ -1633,7 +1631,7 @@ PHPAPI int php_copy_file(const char *src, const char *dest TSRMLS_DC) /* {{{ php_copy_file_ex */ -PHPAPI int php_copy_file_ex(const char *src, const char *dest, int src_flg TSRMLS_DC) +PHPAPI int php_copy_file_ex(char *src, char *dest, int src_flg TSRMLS_DC) { return php_copy_file_ctx(src, dest, 0, NULL TSRMLS_CC); } @@ -1641,7 +1639,7 @@ PHPAPI int php_copy_file_ex(const char *src, const char *dest, int src_flg TSRML /* {{{ php_copy_file_ctx */ -PHPAPI int php_copy_file_ctx(const char *src, const char *dest, int src_flg, php_stream_context *ctx TSRMLS_DC) +PHPAPI int php_copy_file_ctx(char *src, char *dest, int src_flg, php_stream_context *ctx TSRMLS_DC) { php_stream *srcstream = NULL, *deststream = NULL; int ret = FAILURE; @@ -1753,17 +1751,17 @@ PHPAPI PHP_FUNCTION(fread) } Z_STRVAL_P(return_value) = emalloc(len + 1); - Z_STRSIZE_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len); + Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len); /* needed because recv/read/gzread doesnt put a null at the end*/ - Z_STRVAL_P(return_value)[Z_STRSIZE_P(return_value)] = 0; + Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0; Z_TYPE_P(return_value) = IS_STRING; } /* }}} */ -static const char *php_fgetcsv_lookup_trailing_spaces(const char *ptr, zend_str_size_size_t len, const char delimiter TSRMLS_DC) /* {{{ */ +static const char *php_fgetcsv_lookup_trailing_spaces(const char *ptr, size_t len, const char delimiter TSRMLS_DC) /* {{{ */ { - zend_str_size inc_len; + int inc_len; unsigned char last_chars[2] = { 0, 0 }; while (len > 0) { @@ -1799,7 +1797,7 @@ static const char *php_fgetcsv_lookup_trailing_spaces(const char *ptr, zend_str_ } /* }}} */ -#define FPUTCSV_FLD_CHK(c) memchr(Z_STRVAL(field), c, Z_STRSIZE(field)) +#define FPUTCSV_FLD_CHK(c) memchr(Z_STRVAL(field), c, Z_STRLEN(field)) /* {{{ proto int fputcsv(resource fp, array fields [, string delimiter [, string enclosure]]) Format line as CSV and write to file pointer */ @@ -1810,11 +1808,11 @@ PHP_FUNCTION(fputcsv) const char escape_char = '\\'; php_stream *stream; zval *fp = NULL, *fields = NULL; - zend_str_size_int ret; + int ret; char *delimiter_str = NULL, *enclosure_str = NULL; - zend_str_size delimiter_str_len = 0, enclosure_str_len = 0; + int delimiter_str_len = 0, enclosure_str_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra|SS", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra|ss", &fp, &fields, &delimiter_str, &delimiter_str_len, &enclosure_str, &enclosure_str_len) == FAILURE) { return; @@ -1852,10 +1850,9 @@ PHP_FUNCTION(fputcsv) /* }}} */ /* {{{ PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) */ -PHPAPI zend_str_size_int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) +PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) { - int count, i = 0; - zend_str_size_int ret; + int count, i = 0, ret; zval **field_tmp = NULL, field; smart_str csvline = {0}; HashPosition pos; @@ -1880,7 +1877,7 @@ PHPAPI zend_str_size_int php_fputcsv(php_stream *stream, zval *fields, char deli FPUTCSV_FLD_CHK(' ') ) { char *ch = Z_STRVAL(field); - char *end = ch + Z_STRSIZE(field); + char *end = ch + Z_STRLEN(field); int escaped = 0; smart_str_appendc(&csvline, enclosure); @@ -1897,7 +1894,7 @@ PHPAPI zend_str_size_int php_fputcsv(php_stream *stream, zval *fields, char deli } smart_str_appendc(&csvline, enclosure); } else { - smart_str_appendl(&csvline, Z_STRVAL(field), Z_STRSIZE(field)); + smart_str_appendl(&csvline, Z_STRVAL(field), Z_STRLEN(field)); } if (++i != count) { @@ -1939,13 +1936,13 @@ PHP_FUNCTION(fgetcsv) { zval *fd, **len_zv = NULL; char *delimiter_str = NULL; - zend_str_size delimiter_str_len = 0; + int delimiter_str_len = 0; char *enclosure_str = NULL; - zend_str_size enclosure_str_len = 0; + int enclosure_str_len = 0; char *escape_str = NULL; - zend_str_size escape_str_len = 0; + int escape_str_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ZSSS", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|Zsss", &fd, &len_zv, &delimiter_str, &delimiter_str_len, &enclosure_str, &enclosure_str_len, &escape_str, &escape_str_len) == FAILURE @@ -2021,11 +2018,11 @@ PHP_FUNCTION(fgetcsv) } /* }}} */ -PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, zend_str_size_size_t buf_len, char *buf, zval *return_value TSRMLS_DC) /* {{{ */ +PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, size_t buf_len, char *buf, zval *return_value TSRMLS_DC) /* {{{ */ { char *temp, *tptr, *bptr, *line_end, *limit; - zend_str_size temp_len, line_end_len; - zend_str_size inc_len; + size_t temp_len, line_end_len; + int inc_len; zend_bool first_field = 1; /* initialize internal state */ @@ -2285,10 +2282,10 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char PHP_FUNCTION(realpath) { char *filename; - zend_str_size filename_len; + int filename_len; char resolved_path_buff[MAXPATHLEN]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P", &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { return; } @@ -2423,10 +2420,10 @@ php_meta_tags_token php_next_meta_token(php_meta_tags_data *md TSRMLS_DC) PHP_FUNCTION(fnmatch) { char *pattern, *filename; - zend_str_size pattern_len, filename_len; + int pattern_len, filename_len; long flags = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "PP|l", &pattern, &pattern_len, &filename, &filename_len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|l", &pattern, &pattern_len, &filename, &filename_len, &flags) == FAILURE) { return; } diff --git a/ext/standard/file.h b/ext/standard/file.h index ab8bf4932fc5f..2bcdfd64bf5e6 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -74,13 +74,13 @@ PHP_MINIT_FUNCTION(user_streams); PHPAPI int php_le_stream_context(TSRMLS_D); PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC); -PHPAPI int php_copy_file(const char *src, const char *dest TSRMLS_DC); -PHPAPI int php_copy_file_ex(const char *src, const char *dest, int src_chk TSRMLS_DC); -PHPAPI int php_copy_file_ctx(const char *src, const char *dest, int src_chk, php_stream_context *ctx TSRMLS_DC); -PHPAPI int php_mkdir_ex(const char *dir, long mode, int options TSRMLS_DC); -PHPAPI int php_mkdir(const char *dir, long mode TSRMLS_DC); +PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC); +PHPAPI int php_copy_file_ex(char *src, char *dest, int src_chk TSRMLS_DC); +PHPAPI int php_copy_file_ctx(char *src, char *dest, int src_chk, php_stream_context *ctx TSRMLS_DC); +PHPAPI int php_mkdir_ex(char *dir, long mode, int options TSRMLS_DC); +PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC); PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, size_t buf_len, char *buf, zval *return_value TSRMLS_DC); -PHPAPI zend_str_size_int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC); +PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC); #define META_DEF_BUFSIZE 8192 @@ -121,7 +121,7 @@ typedef struct { long default_socket_timeout; char *user_agent; /* for the http wrapper */ char *from_address; /* for the ftp and http wrappers */ - const char *user_stream_current_filename; /* for simple recursion protection */ + char *user_stream_current_filename; /* for simple recursion protection */ php_stream_context *default_context; HashTable *stream_wrappers; /* per-request copy of url_stream_wrappers_hash */ HashTable *stream_filters; /* per-request copy of stream_filters_hash */ diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index df58607c855cf..2713d23f1d826 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -233,9 +233,9 @@ PHP_FUNCTION(disk_total_space) { double bytestotal; char *path; - zend_str_size path_len; + int path_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P", &path, &path_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &path, &path_len) == FAILURE) { return; } @@ -368,9 +368,9 @@ PHP_FUNCTION(disk_free_space) { double bytesfree; char *path; - zend_str_size path_len; + int path_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P", &path, &path_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &path, &path_len) == FAILURE) { return; } @@ -420,7 +420,7 @@ PHPAPI int php_get_gid_by_name(const char *name, gid_t *gid TSRMLS_DC) static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */ { char *filename; - zend_str_size filename_len; + int filename_len; zval *group; #if !defined(WINDOWS) gid_t gid; @@ -428,7 +428,7 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */ #endif php_stream_wrapper *wrapper; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Pz/", &filename, &filename_len, &group) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pz/", &filename, &filename_len, &group) == FAILURE) { RETURN_FALSE; } @@ -557,7 +557,7 @@ PHPAPI uid_t php_get_uid_by_name(const char *name, uid_t *uid TSRMLS_DC) static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */ { char *filename; - zend_str_size filename_len; + int filename_len; zval *user; #if !defined(WINDOWS) uid_t uid; @@ -565,7 +565,7 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */ #endif php_stream_wrapper *wrapper; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Pz/", &filename, &filename_len, &user) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pz/", &filename, &filename_len, &user) == FAILURE) { return; } @@ -667,13 +667,13 @@ PHP_FUNCTION(lchown) PHP_FUNCTION(chmod) { char *filename; - zend_str_size filename_len; + int filename_len; long mode; int ret; mode_t imode; php_stream_wrapper *wrapper; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Pl", &filename, &filename_len, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl", &filename, &filename_len, &mode) == FAILURE) { return; } @@ -713,7 +713,7 @@ PHP_FUNCTION(chmod) PHP_FUNCTION(touch) { char *filename; - zend_str_size filename_len; + int filename_len; long filetime = 0, fileatime = 0; int ret, argc = ZEND_NUM_ARGS(); FILE *file; @@ -721,7 +721,7 @@ PHP_FUNCTION(touch) struct utimbuf *newtime = &newtimebuf; php_stream_wrapper *wrapper; - if (zend_parse_parameters(argc TSRMLS_CC, "P|ll", &filename, &filename_len, &filetime, &fileatime) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "p|ll", &filename, &filename_len, &filetime, &fileatime) == FAILURE) { return; } @@ -800,7 +800,7 @@ PHP_FUNCTION(touch) /* {{{ php_clear_stat_cache() */ -PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, zend_str_size_int filename_len TSRMLS_DC) +PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, int filename_len TSRMLS_DC) { /* always clear CurrentStatFile and CurrentLStatFile even if filename is not NULL * as it may contain outdated data (e.g. "nlink" for a directory when deleting a file @@ -829,9 +829,9 @@ PHP_FUNCTION(clearstatcache) { zend_bool clear_realpath_cache = 0; char *filename = NULL; - zend_str_size filename_len = 0; + int filename_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|bP", &clear_realpath_cache, &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|bp", &clear_realpath_cache, &filename, &filename_len) == FAILURE) { return; } @@ -857,7 +857,7 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ "dev", "ino", "mode", "nlink", "uid", "gid", "rdev", "size", "atime", "mtime", "ctime", "blksize", "blocks" }; - const char *local; + char *local; php_stream_wrapper *wrapper; if (!filename_length) { @@ -1080,9 +1080,9 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ #define FileFunction(name, funcnum) \ void name(INTERNAL_FUNCTION_PARAMETERS) { \ char *filename; \ - zend_str_size filename_len; \ + int filename_len; \ \ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P", &filename, &filename_len) == FAILURE) { \ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { \ return; \ } \ \ diff --git a/ext/standard/filters.c b/ext/standard/filters.c index 0ceb37295b94a..0a59039635881 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -265,7 +265,7 @@ static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zv while (zend_hash_get_current_data_ex(Z_ARRVAL_P(filterparams), (void **) &tmp, &pos) == SUCCESS) { convert_to_string_ex(tmp); smart_str_appendc(&tags_ss, '<'); - smart_str_appendl(&tags_ss, Z_STRVAL_PP(tmp), Z_STRSIZE_PP(tmp)); + smart_str_appendl(&tags_ss, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); smart_str_appendc(&tags_ss, '>'); zend_hash_move_forward_ex(Z_ARRVAL_P(filterparams), &pos); } @@ -275,7 +275,7 @@ static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zv convert_to_string_ex(&filterparams); tags_ss.c = Z_STRVAL_P(filterparams); - tags_ss.len = Z_STRSIZE_P(filterparams); + tags_ss.len = Z_STRLEN_P(filterparams); tags_ss.a = 0; } } @@ -1229,19 +1229,19 @@ static php_conv_err_t php_conv_get_string_prop_ex(const HashTable *ht, char **pr convert_to_string(&zt); - if (NULL == (*pretval = pemalloc(Z_STRSIZE(zt) + 1, persistent))) { + if (NULL == (*pretval = pemalloc(Z_STRLEN(zt) + 1, persistent))) { return PHP_CONV_ERR_ALLOC; } - *pretval_len = Z_STRSIZE(zt); - memcpy(*pretval, Z_STRVAL(zt), Z_STRSIZE(zt) + 1); + *pretval_len = Z_STRLEN(zt); + memcpy(*pretval, Z_STRVAL(zt), Z_STRLEN(zt) + 1); zval_dtor(&zt); } else { - if (NULL == (*pretval = pemalloc(Z_STRSIZE_PP(tmpval) + 1, persistent))) { + if (NULL == (*pretval = pemalloc(Z_STRLEN_PP(tmpval) + 1, persistent))) { return PHP_CONV_ERR_ALLOC; } - *pretval_len = Z_STRSIZE_PP(tmpval); - memcpy(*pretval, Z_STRVAL_PP(tmpval), Z_STRSIZE_PP(tmpval) + 1); + *pretval_len = Z_STRLEN_PP(tmpval); + memcpy(*pretval, Z_STRVAL_PP(tmpval), Z_STRLEN_PP(tmpval) + 1); } } else { return PHP_CONV_ERR_NOT_FOUND; diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 5ed82ed7bca73..0035d204f6515 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -52,7 +52,7 @@ static char HEXCHARS[] = "0123456789ABCDEF"; /* php_spintf_appendchar() {{{ */ inline static void -php_sprintf_appendchar(char **buffer, zend_str_size_int *pos, zend_str_size_int *size, char add TSRMLS_DC) +php_sprintf_appendchar(char **buffer, int *pos, int *size, char add TSRMLS_DC) { if ((*pos + 1) >= *size) { *size <<= 1; @@ -66,18 +66,22 @@ php_sprintf_appendchar(char **buffer, zend_str_size_int *pos, zend_str_size_int /* php_spintf_appendstring() {{{ */ inline static void -php_sprintf_appendstring(char **buffer, zend_str_size_int *pos, zend_str_size_int *size, char *add, - zend_str_size_int min_width, zend_str_size_int max_width, char padding, - zend_str_size_int alignment, zend_str_size_int len, int neg, int expprec, int always_sign) +php_sprintf_appendstring(char **buffer, int *pos, int *size, char *add, + int min_width, int max_width, char padding, + int alignment, int len, int neg, int expprec, int always_sign) { - register zend_str_size_int npad; - zend_str_size_int req_size; - zend_str_size_int copy_len; - zend_str_size_int m_width; + register int npad; + int req_size; + int copy_len; + int m_width; copy_len = (expprec ? MIN(max_width, len) : len); - npad = (min_width >= copy_len) ? (min_width - copy_len) : 0; + npad = min_width - copy_len; + if (npad < 0) { + npad = 0; + } + PRINTF_DEBUG(("sprintf: appendstring(%x, %d, %d, \"%s\", %d, '%c', %d)\n", *buffer, *pos, *size, add, min_width, padding, alignment)); m_width = MAX(min_width, copy_len); @@ -122,8 +126,8 @@ php_sprintf_appendstring(char **buffer, zend_str_size_int *pos, zend_str_size_in /* php_spintf_appendint() {{{ */ inline static void -php_sprintf_appendint(char **buffer, zend_str_size_int *pos, zend_str_size_int *size, long number, - zend_str_size_int width, char padding, zend_str_size_int alignment, +php_sprintf_appendint(char **buffer, int *pos, int *size, long number, + int width, char padding, int alignment, int always_sign) { char numbuf[NUM_BUF_SIZE]; @@ -166,9 +170,9 @@ php_sprintf_appendint(char **buffer, zend_str_size_int *pos, zend_str_size_int * /* php_spintf_appenduint() {{{ */ inline static void -php_sprintf_appenduint(char **buffer, zend_str_size_int *pos, zend_str_size_int *size, +php_sprintf_appenduint(char **buffer, int *pos, int *size, unsigned long number, - zend_str_size_int width, char padding, zend_str_size_int alignment) + int width, char padding, int alignment) { char numbuf[NUM_BUF_SIZE]; register unsigned long magn, nmagn; @@ -198,18 +202,17 @@ php_sprintf_appenduint(char **buffer, zend_str_size_int *pos, zend_str_size_int /* php_spintf_appenddouble() {{{ */ inline static void -php_sprintf_appenddouble(char **buffer, zend_str_size_int *pos, - zend_str_size_int *size, double number, - zend_str_size_int width, char padding, - zend_str_size_int alignment, int precision, +php_sprintf_appenddouble(char **buffer, int *pos, + int *size, double number, + int width, char padding, + int alignment, int precision, int adjust, char fmt, int always_sign TSRMLS_DC) { char num_buf[NUM_BUF_SIZE]; char *s = NULL; - zend_str_size_int s_len = 0; - int is_negative = 0; + int s_len = 0, is_negative = 0; #ifdef HAVE_LOCALE_H struct lconv *lconv; #endif @@ -290,8 +293,8 @@ php_sprintf_appenddouble(char **buffer, zend_str_size_int *pos, /* php_spintf_appendd2n() {{{ */ inline static void -php_sprintf_append2n(char **buffer, zend_str_size_int *pos, zend_str_size_int *size, long number, - zend_str_size_int width, char padding, zend_str_size_int alignment, int n, +php_sprintf_append2n(char **buffer, int *pos, int *size, long number, + int width, char padding, int alignment, int n, char *chartable, int expprec) { char numbuf[NUM_BUF_SIZE]; @@ -321,11 +324,11 @@ php_sprintf_append2n(char **buffer, zend_str_size_int *pos, zend_str_size_int *s /* php_spintf_getnumber() {{{ */ inline static int -php_sprintf_getnumber(char *buffer, zend_str_size_int *pos) +php_sprintf_getnumber(char *buffer, int *pos) { char *endptr; register long num = strtol(&buffer[*pos], &endptr, 10); - register zend_str_size_int i = 0; + register int i = 0; if (endptr != NULL) { i = (endptr - &buffer[*pos]); @@ -366,11 +369,10 @@ php_sprintf_getnumber(char *buffer, zend_str_size_int *pos) * */ static char * -php_formatted_print(int ht, zend_str_size_int *len, int use_array, int format_offset TSRMLS_DC) +php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC) { zval ***args, **z_format; - int argc; - zend_str_size_int size = 240, inpos = 0, outpos = 0, temppos; + int argc, size = 240, inpos = 0, outpos = 0, temppos; int alignment, currarg, adjusting, argnum, width, precision; char *format, *result, padding; int always_sign; @@ -416,7 +418,7 @@ php_formatted_print(int ht, zend_str_size_int *len, int use_array, int format_of currarg = 1; - while (inpospath == NULL) { @@ -412,8 +410,7 @@ static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, size_t ip_ /* {{{ php_fopen_url_wrap_ftp */ -php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *path, const char *mode, - int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) +php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { php_stream *stream = NULL, *datastream = NULL; php_url *resource = NULL; @@ -428,7 +425,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa int allow_overwrite = 0; int read_write = 0; char *transport; - zend_str_size_int transport_len; + int transport_len; tmp_line[0] = '\0'; @@ -694,8 +691,7 @@ static php_stream_ops php_ftp_dirstream_ops = { /* {{{ php_stream_ftp_opendir */ -php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, - char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) +php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { php_stream *stream, *reuseid, *datastream = NULL; php_ftp_dirstream_data *dirsdata; @@ -784,7 +780,7 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *pat /* {{{ php_stream_ftp_url_stat */ -static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) +static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) { php_stream *stream = NULL; php_url *resource = NULL; @@ -907,7 +903,7 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url, /* {{{ php_stream_ftp_unlink */ -static int php_stream_ftp_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) +static int php_stream_ftp_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) { php_stream *stream = NULL; php_url *resource = NULL; @@ -957,7 +953,7 @@ static int php_stream_ftp_unlink(php_stream_wrapper *wrapper, const char *url, i /* {{{ php_stream_ftp_rename */ -static int php_stream_ftp_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC) +static int php_stream_ftp_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC) { php_stream *stream = NULL; php_url *resource_from = NULL, *resource_to = NULL; @@ -1036,7 +1032,7 @@ static int php_stream_ftp_rename(php_stream_wrapper *wrapper, const char *url_fr /* {{{ php_stream_ftp_mkdir */ -static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, const char *url, int mode, int options, php_stream_context *context TSRMLS_DC) +static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, char *url, int mode, int options, php_stream_context *context TSRMLS_DC) { php_stream *stream = NULL; php_url *resource = NULL; @@ -1130,7 +1126,7 @@ static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, const char *url, in /* {{{ php_stream_ftp_rmdir */ -static int php_stream_ftp_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) +static int php_stream_ftp_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) { php_stream *stream = NULL; php_url *resource = NULL; diff --git a/ext/standard/head.c b/ext/standard/head.c index ae8d5318d9beb..5310ff6c03b2f 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -73,10 +73,10 @@ PHPAPI int php_header(TSRMLS_D) } -PHPAPI int php_setcookie(char *name, zend_str_size_int name_len, char *value, zend_str_size_int value_len, time_t expires, char *path, zend_str_size_int path_len, char *domain, zend_str_size_int domain_len, int secure, int url_encode, int httponly TSRMLS_DC) +PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, time_t expires, char *path, int path_len, char *domain, int domain_len, int secure, int url_encode, int httponly TSRMLS_DC) { char *cookie, *encoded_value = NULL; - zend_str_size_int len=sizeof("Set-Cookie: "); + int len=sizeof("Set-Cookie: "); char *dt; sapi_header_line ctr = {0}; int result; @@ -93,7 +93,7 @@ PHPAPI int php_setcookie(char *name, zend_str_size_int name_len, char *value, ze len += name_len; if (value && url_encode) { - zend_str_size_int encoded_value_len; + int encoded_value_len; encoded_value = php_url_encode(value, value_len, &encoded_value_len); len += encoded_value_len; diff --git a/ext/standard/head.h b/ext/standard/head.h index 11306be6b7def..7d657ba445ef0 100644 --- a/ext/standard/head.h +++ b/ext/standard/head.h @@ -31,6 +31,6 @@ PHP_FUNCTION(headers_list); PHP_FUNCTION(http_response_code); PHPAPI int php_header(TSRMLS_D); -PHPAPI int php_setcookie(char *name, zend_str_size_int name_len, char *value, zend_str_size_int value_len, time_t expires, char *path, zend_str_size_int path_len, char *domain, zend_str_size_int domain_len, int secure, int url_encode, int httponly TSRMLS_DC); +PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, time_t expires, char *path, int path_len, char *domain, int domain_len, int secure, int url_encode, int httponly TSRMLS_DC); #endif diff --git a/ext/standard/html.c b/ext/standard/html.c index f24bde58fa013..414fa65c91d3b 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -89,11 +89,11 @@ static inline unsigned int get_next_char( enum entity_charset charset, const unsigned char *str, - zend_str_size_size_t str_len, - zend_str_size_size_t *cursor, + size_t str_len, + size_t *cursor, int *status) { - zend_str_size pos = *cursor; + size_t pos = *cursor; unsigned int this_char = 0; *status = SUCCESS; @@ -350,8 +350,8 @@ static inline unsigned int get_next_char( * Public interface for get_next_char used with UTF-8 */ PHPAPI unsigned int php_next_utf8_char( const unsigned char *str, - zend_str_size_size_t str_len, - zend_str_size_size_t *cursor, + size_t str_len, + size_t *cursor, int *status) { return get_next_char(cs_utf_8, str, str_len, cursor, status); @@ -365,7 +365,7 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC) { int i; enum entity_charset charset = cs_utf_8; - zend_str_size len = 0; + int len = 0; const zend_encoding *zenc; /* Default is now UTF-8 */ @@ -456,9 +456,9 @@ static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC) /* }}} */ /* {{{ php_utf32_utf8 */ -static inline zend_str_size_size_t php_utf32_utf8(unsigned char *buf, unsigned k) +static inline size_t php_utf32_utf8(unsigned char *buf, unsigned k) { - zend_str_size retval = 0; + size_t retval = 0; /* assert(0x0 <= k <= 0x10FFFF); */ @@ -533,7 +533,7 @@ static inline size_t php_mb3_int_to_char(unsigned char *buf, unsigned k) * Returns the code point in the target charset (whose mapping table was given) or 0 if * the unicode code point is not in the table. */ -static inline unsigned char unimap_bsearch(const uni_to_enc *table, unsigned code_key_a, zend_str_size_size_t num) +static inline unsigned char unimap_bsearch(const uni_to_enc *table, unsigned code_key_a, size_t num) { const uni_to_enc *l = table, *h = &table[num-1], @@ -812,7 +812,7 @@ static inline int process_numeric_entity(const char **buf, unsigned *code_point) /* }}} */ /* {{{ process_named_entity */ -static inline int process_named_entity_html(const char **buf, const char **start, zend_str_size_size_t *length) +static inline int process_named_entity_html(const char **buf, const char **start, size_t *length) { *start = *buf; @@ -841,7 +841,7 @@ static inline int process_named_entity_html(const char **buf, const char **start /* }}} */ /* {{{ resolve_named_entity_html */ -static inline int resolve_named_entity_html(const char *start, zend_str_size_size_t length, const entity_ht *ht, unsigned *uni_cp1, unsigned *uni_cp2) +static inline int resolve_named_entity_html(const char *start, size_t length, const entity_ht *ht, unsigned *uni_cp1, unsigned *uni_cp2) { const entity_cp_map *s; ulong hash = zend_inline_hash_func(start, length); @@ -923,9 +923,9 @@ static inline size_t write_octet_sequence(unsigned char *buf, enum entity_charse #define TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(oldlen) ((oldlen) + (oldlen) / 5 + 2) static void traverse_for_entities( const char *old, - zend_str_size_size_t oldlen, + size_t oldlen, char *ret, /* should have allocated TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(olden) */ - zend_str_size_size_t *retlen, + size_t *retlen, int all, int flags, const entity_ht *inv_map, @@ -977,7 +977,7 @@ static void traverse_for_entities( goto invalid_code; } else { const char *start; - zend_str_size ent_len; + size_t ent_len; next = &p[1]; start = next; @@ -1083,13 +1083,13 @@ static entity_table_opt determine_entity_table(int all, int doctype) * only the basic ones, i.e., those in basic_entities_ex + the numeric entities * that correspond to quotes. */ -PHPAPI char *php_unescape_html_entities(unsigned char *old, zend_str_size_size_t oldlen, zend_str_size_size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC) +PHPAPI char *php_unescape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC) { - zend_str_size retlen; + size_t retlen; char *ret; enum entity_charset charset; const entity_ht *inverse_map = NULL; - zend_str_size new_size = TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(oldlen); + size_t new_size = TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(oldlen); if (all) { charset = determine_charset(hint_charset TSRMLS_CC); @@ -1123,7 +1123,7 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, zend_str_size_size_t } /* }}} */ -PHPAPI char *php_escape_html_entities(unsigned char *old, zend_str_size_size_t oldlen, zend_str_size_size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC) +PHPAPI char *php_escape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC) { return php_escape_html_entities_ex(old, oldlen, newlen, all, flags, hint_charset, 1 TSRMLS_CC); } @@ -1134,10 +1134,10 @@ static inline void find_entity_for_char( enum entity_charset charset, const entity_stage1_row *table, const unsigned char **entity, - zend_str_size_size_t *entity_len, + size_t *entity_len, unsigned char *old, - zend_str_size_size_t oldlen, - zend_str_size_size_t *cursor) + size_t oldlen, + size_t *cursor) { unsigned stage1_idx = ENT_STAGE1_INDEX(k); const entity_stage3_row *c; @@ -1155,7 +1155,7 @@ static inline void find_entity_for_char( *entity_len = c->data.ent.entity_len; } else { /* peek at next char */ - zend_str_size cursor_before = *cursor; + size_t cursor_before = *cursor; int status = SUCCESS; unsigned next_char; @@ -1196,7 +1196,7 @@ static inline void find_entity_for_char_basic( unsigned int k, const entity_stage3_row *table, const unsigned char **entity, - zend_str_size_size_t *entity_len) + size_t *entity_len) { if (k >= 64U) { *entity = NULL; @@ -1211,9 +1211,9 @@ static inline void find_entity_for_char_basic( /* {{{ php_escape_html_entities */ -PHPAPI char *php_escape_html_entities_ex(unsigned char *old, zend_str_size_size_t oldlen, zend_str_size_size_t *newlen, int all, int flags, char *hint_charset, zend_bool double_encode TSRMLS_DC) +PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset, zend_bool double_encode TSRMLS_DC) { - zend_str_size cursor, maxlen, len; + size_t cursor, maxlen, len; char *replaced; enum entity_charset charset = determine_charset(hint_charset TSRMLS_CC); int doctype = flags & ENT_HTML_DOC_TYPE_MASK; @@ -1269,7 +1269,7 @@ PHPAPI char *php_escape_html_entities_ex(unsigned char *old, zend_str_size_size_ cursor = 0; while (cursor < oldlen) { const unsigned char *mbsequence = NULL; - zend_str_size mbseqlen = 0, + size_t mbseqlen = 0, cursor_before = cursor; int status = SUCCESS; unsigned int this_char = get_next_char(charset, old, oldlen, &cursor, &status); @@ -1374,7 +1374,7 @@ PHPAPI char *php_escape_html_entities_ex(unsigned char *old, zend_str_size_size_ len += sizeof("&") - 1; } else { /* no double encode */ /* check if entity is valid */ - zend_str_size ent_len; /* not counting & or ; */ + size_t ent_len; /* not counting & or ; */ /* peek at next char */ if (old[cursor] == '#') { /* numeric entity */ unsigned code_point; @@ -1433,13 +1433,13 @@ PHPAPI char *php_escape_html_entities_ex(unsigned char *old, zend_str_size_size_ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) { char *str, *hint_charset = NULL; - zend_str_size str_len, hint_charset_len = 0; + int str_len, hint_charset_len = 0; size_t new_len; long flags = ENT_COMPAT; char *replaced; zend_bool double_encode = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lS!b", &str, &str_len, &flags, &hint_charset, &hint_charset_len, &double_encode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!b", &str, &str_len, &flags, &hint_charset, &hint_charset_len, &double_encode) == FAILURE) { return; } @@ -1483,18 +1483,18 @@ PHP_FUNCTION(htmlspecialchars) PHP_FUNCTION(htmlspecialchars_decode) { char *str; - zend_str_size str_len; - zend_str_size new_len = 0; + int str_len; + size_t new_len = 0; long quote_style = ENT_COMPAT; char *replaced; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &str_len, "e_style) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, "e_style) == FAILURE) { return; } replaced = php_unescape_html_entities(str, str_len, &new_len, 0 /*!all*/, quote_style, NULL TSRMLS_CC); if (replaced) { - RETURN_STRINGL(replaced, new_len, 0); + RETURN_STRINGL(replaced, (int)new_len, 0); } RETURN_FALSE; } @@ -1505,19 +1505,19 @@ PHP_FUNCTION(htmlspecialchars_decode) PHP_FUNCTION(html_entity_decode) { char *str, *hint_charset = NULL; - zend_str_size str_len, hint_charset_len = 0; - zend_str_size new_len = 0; + int str_len, hint_charset_len = 0; + size_t new_len = 0; long quote_style = ENT_COMPAT; char *replaced; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lS", &str, &str_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len, "e_style, &hint_charset, &hint_charset_len) == FAILURE) { return; } replaced = php_unescape_html_entities(str, str_len, &new_len, 1 /*all*/, quote_style, hint_charset TSRMLS_CC); if (replaced) { - RETURN_STRINGL(replaced, new_len, 0); + RETURN_STRINGL(replaced, (int)new_len, 0); } RETURN_FALSE; } @@ -1541,12 +1541,12 @@ static inline void write_s3row_data( { char key[9] = ""; /* two unicode code points in UTF-8 */ char entity[LONGEST_ENTITY_LENGTH + 2] = {'&'}; - zend_str_size written_k1; + size_t written_k1; written_k1 = write_octet_sequence(key, charset, orig_cp); if (!r->ambiguous) { - zend_str_size l = r->data.ent.entity_len; + size_t l = r->data.ent.entity_len; memcpy(&entity[1], r->data.ent.entity, l); entity[l + 1] = ';'; add_assoc_stringl_ex(arr, key, written_k1 + 1, entity, l + 2, 1); @@ -1563,7 +1563,7 @@ static inline void write_s3row_data( } num_entries = mcpr[0].leading_entry.size; for (i = 1; i <= num_entries; i++) { - zend_str_size l, + size_t l, written_k2; unsigned uni_cp, spe_cp; @@ -1598,14 +1598,14 @@ PHP_FUNCTION(get_html_translation_table) entity_table_opt entity_table; const enc_to_uni *to_uni_table; char *charset_hint = NULL; - zend_str_size charset_hint_len; + int charset_hint_len; enum entity_charset charset; /* in this function we have to jump through some loops because we're * getting the translated table from data structures that are optimized for * random access, not traversal */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|llS", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lls", &all, &flags, &charset_hint, &charset_hint_len) == FAILURE) { return; } diff --git a/ext/standard/http.c b/ext/standard/http.c index 9bcd710ee69f9..547df52186959 100644 --- a/ext/standard/http.c +++ b/ext/standard/http.c @@ -26,16 +26,15 @@ /* {{{ php_url_encode_hash */ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, - const char *num_prefix, zend_str_size_int num_prefix_len, - const char *key_prefix, zend_str_size_int key_prefix_len, - const char *key_suffix, zend_str_size_int key_suffix_len, + const char *num_prefix, int num_prefix_len, + const char *key_prefix, int key_prefix_len, + const char *key_suffix, int key_suffix_len, zval *type, char *arg_sep, int enc_type TSRMLS_DC) { char *key = NULL; char *ekey, *newprefix, *p; - zend_str_size_int arg_sep_len, ekey_len, newprefix_len; - int key_type; - zend_str_size_uint key_len; + int arg_sep_len, ekey_len, key_type, newprefix_len; + uint key_len; ulong idx; zval **zdata = NULL, *copyzval; @@ -57,7 +56,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, arg_sep_len = strlen(arg_sep); for (zend_hash_internal_pointer_reset(ht); - (key_type = zend_hash_get_current_key_ex(ht, &key, &key_len, &idx, 0, NULL)) != HASH_KEY_NON_EXISTENT; + (key_type = zend_hash_get_current_key_ex(ht, &key, &key_len, &idx, 0, NULL)) != HASH_KEY_NON_EXISTANT; zend_hash_move_forward(ht) ) { if (key_type == HASH_KEY_IS_STRING && key_len && key[key_len-1] == '\0') { @@ -172,9 +171,9 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, switch (Z_TYPE_PP(zdata)) { case IS_STRING: if (enc_type == PHP_QUERY_RFC3986) { - ekey = php_raw_url_encode(Z_STRVAL_PP(zdata), Z_STRSIZE_PP(zdata), &ekey_len); + ekey = php_raw_url_encode(Z_STRVAL_PP(zdata), Z_STRLEN_PP(zdata), &ekey_len); } else { - ekey = php_url_encode(Z_STRVAL_PP(zdata), Z_STRSIZE_PP(zdata), &ekey_len); + ekey = php_url_encode(Z_STRVAL_PP(zdata), Z_STRLEN_PP(zdata), &ekey_len); } break; case IS_LONG: @@ -191,9 +190,9 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, zval_copy_ctor(copyzval); convert_to_string_ex(©zval); if (enc_type == PHP_QUERY_RFC3986) { - ekey = php_raw_url_encode(Z_STRVAL_P(copyzval), Z_STRSIZE_P(copyzval), &ekey_len); + ekey = php_raw_url_encode(Z_STRVAL_P(copyzval), Z_STRLEN_P(copyzval), &ekey_len); } else { - ekey = php_url_encode(Z_STRVAL_P(copyzval), Z_STRSIZE_P(copyzval), &ekey_len); + ekey = php_url_encode(Z_STRVAL_P(copyzval), Z_STRLEN_P(copyzval), &ekey_len); } zval_ptr_dtor(©zval); } diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index f396242dfff24..b8676bbba4df6 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -84,8 +84,7 @@ #define HTTP_WRAPPER_HEADER_INIT 1 #define HTTP_WRAPPER_REDIRECTED 2 -php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, - char **opened_path, php_stream_context *context, int redirect_max, int flags STREAMS_DC TSRMLS_DC) /* {{{ */ +php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context, int redirect_max, int flags STREAMS_DC TSRMLS_DC) /* {{{ */ { php_stream *stream = NULL; php_url *resource = NULL; @@ -95,7 +94,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char char *tmp = NULL; char *ua_str = NULL; zval **ua_zval = NULL, **tmpzval = NULL; - zend_str_size_int scratch_len = 0; + int scratch_len = 0; int body = 0; char location[HTTP_HEADER_BLOCK_SIZE]; zval *response_header = NULL; @@ -105,9 +104,9 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char size_t chunk_size = 0, file_size = 0; int eol_detect = 0; char *transport_string, *errstr = NULL; - zend_str_size_int transport_len, have_header = 0, request_fulluri = 0, ignore_errors = 0; + int transport_len, have_header = 0, request_fulluri = 0, ignore_errors = 0; char *protocol_version = NULL; - zend_str_size_int protocol_version_len = 3; /* Default: "1.0" */ + int protocol_version_len = 3; /* Default: "1.0" */ struct timeval timeout; char *user_headers = NULL; int header_init = ((flags & HTTP_WRAPPER_HEADER_INIT) != 0); @@ -132,7 +131,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char if (!context || php_stream_context_get_option(context, wrapper->wops->label, "proxy", &tmpzval) == FAILURE || Z_TYPE_PP(tmpzval) != IS_STRING || - Z_STRSIZE_PP(tmpzval) <= 0) { + Z_STRLEN_PP(tmpzval) <= 0) { php_url_free(resource); return php_stream_open_wrapper_ex(path, mode, REPORT_ERRORS, NULL, context); } @@ -141,8 +140,8 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char use_ssl = 0; use_proxy = 1; - transport_len = Z_STRSIZE_PP(tmpzval); - transport_string = estrndup(Z_STRVAL_PP(tmpzval), Z_STRSIZE_PP(tmpzval)); + transport_len = Z_STRLEN_PP(tmpzval); + transport_string = estrndup(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval)); } else { /* Normal http request (possibly with proxy) */ @@ -162,10 +161,10 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char if (context && php_stream_context_get_option(context, wrapper->wops->label, "proxy", &tmpzval) == SUCCESS && Z_TYPE_PP(tmpzval) == IS_STRING && - Z_STRSIZE_PP(tmpzval) > 0) { + Z_STRLEN_PP(tmpzval) > 0) { use_proxy = 1; - transport_len = Z_STRSIZE_PP(tmpzval); - transport_string = estrndup(Z_STRVAL_PP(tmpzval), Z_STRSIZE_PP(tmpzval)); + transport_len = Z_STRLEN_PP(tmpzval); + transport_string = estrndup(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval)); } else { transport_len = spprintf(&transport_string, 0, "%s://%s:%d", use_ssl ? "ssl" : "tcp", resource->host, resource->port); } @@ -241,7 +240,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char } while (*s != 0); } } - } else if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRSIZE_PP(tmpzval)) { + } else if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval)) { s = Z_STRVAL_PP(tmpzval); do { while (*s == ' ' || *s == '\t') s++; @@ -322,16 +321,16 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char } if (context && php_stream_context_get_option(context, "http", "method", &tmpzval) == SUCCESS) { - if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRSIZE_PP(tmpzval) > 0) { + if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval) > 0) { /* As per the RFC, automatically redirected requests MUST NOT use other methods than * GET and HEAD unless it can be confirmed by the user */ if (!redirected - || (Z_STRSIZE_PP(tmpzval) == 3 && memcmp("GET", Z_STRVAL_PP(tmpzval), 3) == 0) - || (Z_STRSIZE_PP(tmpzval) == 4 && memcmp("HEAD",Z_STRVAL_PP(tmpzval), 4) == 0) + || (Z_STRLEN_PP(tmpzval) == 3 && memcmp("GET", Z_STRVAL_PP(tmpzval), 3) == 0) + || (Z_STRLEN_PP(tmpzval) == 4 && memcmp("HEAD",Z_STRVAL_PP(tmpzval), 4) == 0) ) { - scratch_len = strlen(path) + 29 + Z_STRSIZE_PP(tmpzval); + scratch_len = strlen(path) + 29 + Z_STRLEN_PP(tmpzval); scratch = emalloc(scratch_len); - strlcpy(scratch, Z_STRVAL_PP(tmpzval), Z_STRSIZE_PP(tmpzval) + 1); + strlcpy(scratch, Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval) + 1); strncat(scratch, " ", 1); } } @@ -408,7 +407,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char zend_hash_move_forward_ex(Z_ARRVAL_PP(tmpzval), &pos) ) { if (Z_TYPE_PP(tmpheader) == IS_STRING) { - smart_str_appendl(&tmpstr, Z_STRVAL_PP(tmpheader), Z_STRSIZE_PP(tmpheader)); + smart_str_appendl(&tmpstr, Z_STRVAL_PP(tmpheader), Z_STRLEN_PP(tmpheader)); smart_str_appendl(&tmpstr, "\r\n", sizeof("\r\n") - 1); } } @@ -419,21 +418,21 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char smart_str_free(&tmpstr); } } - if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRSIZE_PP(tmpzval)) { + if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval)) { /* Remove newlines and spaces from start and end php_trim will estrndup() */ - tmp = php_trim(Z_STRVAL_PP(tmpzval), Z_STRSIZE_PP(tmpzval), NULL, 0, NULL, 3 TSRMLS_CC); + tmp = php_trim(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval), NULL, 0, NULL, 3 TSRMLS_CC); } if (tmp && strlen(tmp) > 0) { char *s; if (!header_init) { /* Remove post headers for redirects */ - zend_str_size_int l = strlen(tmp); + int l = strlen(tmp); char *s2, *tmp_c = estrdup(tmp); php_strtolower(tmp_c, l); if ((s = strstr(tmp_c, "content-length:"))) { if ((s2 = memchr(s, '\n', tmp_c + l - s))) { - zend_str_size_int b = tmp_c + l - 1 - s2; + int b = tmp_c + l - 1 - s2; memmove(tmp, tmp + (s2 + 1 - tmp_c), b); memmove(tmp_c, s2 + 1, b); @@ -603,9 +602,9 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char context && !(have_header & HTTP_HEADER_CONTENT_LENGTH) && php_stream_context_get_option(context, "http", "content", &tmpzval) == SUCCESS && - Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRSIZE_PP(tmpzval) > 0 + Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval) > 0 ) { - scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRSIZE_PP(tmpzval)); + scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_PP(tmpzval)); php_stream_write(stream, scratch, scratch_len); have_header |= HTTP_HEADER_CONTENT_LENGTH; } @@ -618,9 +617,9 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char /* Request content, such as for POST requests */ if (header_init && context && php_stream_context_get_option(context, "http", "content", &tmpzval) == SUCCESS && - Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRSIZE_PP(tmpzval) > 0) { + Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval) > 0) { if (!(have_header & HTTP_HEADER_CONTENT_LENGTH)) { - scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRSIZE_PP(tmpzval)); + scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_PP(tmpzval)); php_stream_write(stream, scratch, scratch_len); } if (!(have_header & HTTP_HEADER_TYPE)) { @@ -629,7 +628,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Content-type not specified assuming application/x-www-form-urlencoded"); } php_stream_write(stream, "\r\n", sizeof("\r\n")-1); - php_stream_write(stream, Z_STRVAL_PP(tmpzval), Z_STRSIZE_PP(tmpzval)); + php_stream_write(stream, Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval)); } else { php_stream_write(stream, "\r\n", sizeof("\r\n")-1); } @@ -922,7 +921,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char } /* }}} */ -php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ +php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ { return php_stream_url_wrap_http_ex(wrapper, path, mode, options, opened_path, context, PHP_URL_REDIRECT_MAX, HTTP_WRAPPER_HEADER_INIT STREAMS_CC TSRMLS_CC); } diff --git a/ext/standard/image.c b/ext/standard/image.c index bd80f11dec974..b3dade4a75609 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -112,7 +112,7 @@ static struct gfxinfo *php_handle_gif (php_stream * stream TSRMLS_DC) result->width = (unsigned int)dim[0] | (((unsigned int)dim[1])<<8); result->height = (unsigned int)dim[2] | (((unsigned int)dim[3])<<8); result->bits = dim[4]&0x80 ? ((((unsigned int)dim[4])&0x07) + 1) : 0; - result->channels = 3; /* always */ + result->channels = 3; /* allways */ return result; } diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c index 35764d880110a..f854fddf49b0a 100644 --- a/ext/standard/incomplete_class.c +++ b/ext/standard/incomplete_class.c @@ -92,7 +92,7 @@ static int incomplete_class_has_property(zval *object, zval *member, int check_e } /* }}} */ -static union _zend_function *incomplete_class_get_method(zval **object, char *method, zend_str_size_int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */ +static union _zend_function *incomplete_class_get_method(zval **object, char *method, int method_len, const zend_literal *key TSRMLS_DC) /* {{{ */ { incomplete_class_message(*object, E_ERROR TSRMLS_CC); return NULL; @@ -135,7 +135,7 @@ PHPAPI zend_class_entry *php_create_incomplete_class(TSRMLS_D) /* {{{ php_lookup_class_name */ -PHPAPI char *php_lookup_class_name(zval *object, zend_str_size_uint *nlen) +PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen) { zval **val; char *retval = NULL; @@ -145,10 +145,10 @@ PHPAPI char *php_lookup_class_name(zval *object, zend_str_size_uint *nlen) object_properties = Z_OBJPROP_P(object); if (zend_hash_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER), (void **) &val) == SUCCESS) { - retval = estrndup(Z_STRVAL_PP(val), Z_STRSIZE_PP(val)); + retval = estrndup(Z_STRVAL_PP(val), Z_STRLEN_PP(val)); if (nlen) { - *nlen = Z_STRSIZE_PP(val); + *nlen = Z_STRLEN_PP(val); } } @@ -158,7 +158,7 @@ PHPAPI char *php_lookup_class_name(zval *object, zend_str_size_uint *nlen) /* {{{ php_store_class_name */ -PHPAPI void php_store_class_name(zval *object, const char *name, zend_str_size_uint len) +PHPAPI void php_store_class_name(zval *object, const char *name, zend_uint len) { zval *val; TSRMLS_FETCH(); @@ -167,7 +167,7 @@ PHPAPI void php_store_class_name(zval *object, const char *name, zend_str_size_u Z_TYPE_P(val) = IS_STRING; Z_STRVAL_P(val) = estrndup(name, len); - Z_STRSIZE_P(val) = len; + Z_STRLEN_P(val) = len; zend_hash_update(Z_OBJPROP_P(object), MAGIC_MEMBER, sizeof(MAGIC_MEMBER), &val, sizeof(val), NULL); } diff --git a/ext/standard/info.c b/ext/standard/info.c index 6eb050467e875..32ef94e599fa3 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ @@ -14,7 +14,7 @@ +----------------------------------------------------------------------+ | Authors: Rasmus Lerdorf | | Zeev Suraski | - | Colin Viebrock | + | Colin Viebrock | +----------------------------------------------------------------------+ */ @@ -61,13 +61,13 @@ PHPAPI extern char *php_ini_opened_path; PHPAPI extern char *php_ini_scanned_path; PHPAPI extern char *php_ini_scanned_files; -static zend_str_size_int php_info_print_html_esc(const char *str, zend_str_size_int len) /* {{{ */ +static int php_info_print_html_esc(const char *str, int len) /* {{{ */ { size_t new_len; - zend_str_size_int written; + int written; char *new_str; TSRMLS_FETCH(); - + new_str = php_escape_html_entities((unsigned char *) str, len, &new_len, 0, ENT_QUOTES, "utf-8" TSRMLS_CC); written = php_output_write(new_str, new_len TSRMLS_CC); efree(new_str); @@ -75,24 +75,24 @@ static zend_str_size_int php_info_print_html_esc(const char *str, zend_str_size_ } /* }}} */ -static zend_str_size_int php_info_printf(const char *fmt, ...) /* {{{ */ +static int php_info_printf(const char *fmt, ...) /* {{{ */ { char *buf; - zend_str_size_int len, written; + int len, written; va_list argv; TSRMLS_FETCH(); - + va_start(argv, fmt); len = vspprintf(&buf, 0, fmt, argv); va_end(argv); - + written = php_output_write(buf, len TSRMLS_CC); efree(buf); return written; } /* }}} */ -static zend_str_size_int php_info_print(const char *str) /* {{{ */ +static int php_info_print(const char *str) /* {{{ */ { TSRMLS_FETCH(); return php_output_write(str, strlen(str) TSRMLS_CC); @@ -102,8 +102,8 @@ static zend_str_size_int php_info_print(const char *str) /* {{{ */ static void php_info_print_stream_hash(const char *name, HashTable *ht TSRMLS_DC) /* {{{ */ { char *key; - zend_str_size_uint len; - + uint len; + if (ht) { if (zend_hash_num_elements(ht)) { HashPosition pos; @@ -113,7 +113,7 @@ static void php_info_print_stream_hash(const char *name, HashTable *ht TSRMLS_DC } else { php_info_printf("\nRegistered %s => ", name); } - + zend_hash_internal_pointer_reset_ex(ht, &pos); while (zend_hash_get_current_key_ex(ht, &key, &len, NULL, 0, &pos) == HASH_KEY_IS_STRING) { @@ -129,7 +129,7 @@ static void php_info_print_stream_hash(const char *name, HashTable *ht TSRMLS_DC break; } } - + if (!sapi_module.phpinfo_as_text) { php_info_print("\n"); } @@ -164,10 +164,10 @@ PHPAPI void php_info_print_module(zend_module_entry *zend_module TSRMLS_DC) /* { } } else { if (!sapi_module.phpinfo_as_text) { - php_info_printf("%s\n", zend_module->name); + php_info_printf("%s\n", zend_module->name); } else { php_info_printf("%s\n", zend_module->name); - } + } } } /* }}} */ @@ -196,7 +196,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) { zval **data, **tmp, tmp2; char *string_key; - zend_str_size_uint string_len; + uint string_len; ulong num_key; zend_is_auto_global(name, name_length TSRMLS_CC); @@ -212,7 +212,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) php_info_print(name); php_info_print("[\""); - + switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL)) { case HASH_KEY_IS_STRING: if (!sapi_module.phpinfo_as_text) { @@ -248,10 +248,10 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) } if (!sapi_module.phpinfo_as_text) { - if (Z_STRSIZE(tmp2) == 0) { + if (Z_STRLEN(tmp2) == 0) { php_info_print("no value"); } else { - php_info_print_html_esc(Z_STRVAL(tmp2), Z_STRSIZE(tmp2)); + php_info_print_html_esc(Z_STRVAL(tmp2), Z_STRLEN(tmp2)); } } else { php_info_print(Z_STRVAL(tmp2)); @@ -442,7 +442,7 @@ char* php_get_windows_name() sub = "Web Edition"; else sub = "Standard Edition"; } - } + } } if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 ) { @@ -535,7 +535,7 @@ PHPAPI char *php_get_uname(char mode) DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; char ComputerName[MAX_COMPUTERNAME_LENGTH + 1]; - + GetComputerName(ComputerName, &dwSize); if (mode == 's') { @@ -584,7 +584,7 @@ PHPAPI char *php_get_uname(char mode) if (mode == 's') { php_uname = buf.sysname; } else if (mode == 'r') { - snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d.%d", + snprintf(tmp_uname, sizeof(tmp_uname), "%d.%d.%d", buf.netware_major, buf.netware_minor, buf.netware_revision); php_uname = tmp_uname; } else if (mode == 'n') { @@ -674,7 +674,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) char temp_api[10]; php_uname = php_get_uname('a'); - + if (!sapi_module.phpinfo_as_text) { php_info_print_box_start(1); } @@ -698,7 +698,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) php_info_printf("

PHP Version %s

\n", PHP_VERSION); } else { php_info_print_table_row(2, "PHP Version", PHP_VERSION); - } + } php_info_print_box_end(); php_info_print_table_start(); php_info_print_table_row(2, "System", php_uname ); @@ -783,7 +783,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) #else php_info_print_table_row(2, "DTrace Support", "disabled" ); #endif - + php_info_print_stream_hash("PHP Streams", php_stream_get_url_stream_wrappers_hash() TSRMLS_CC); php_info_print_stream_hash("Stream Socket Transports", php_stream_xport_get_hash() TSRMLS_CC); php_info_print_stream_hash("Stream Filters", php_get_stream_filters_hash() TSRMLS_CC); @@ -815,7 +815,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) php_info_print("

Configuration

\n"); } else { SECTION("Configuration"); - } + } if (!(flag & PHP_INFO_MODULES)) { SECTION("PHP Core"); display_ini_entries(NULL); @@ -889,7 +889,7 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) } - if ((flag & PHP_INFO_CREDITS) && !sapi_module.phpinfo_as_text) { + if ((flag & PHP_INFO_CREDITS) && !sapi_module.phpinfo_as_text) { php_info_print_hr(); php_print_credits(PHP_CREDITS_ALL & ~PHP_CREDITS_FULLPAGE TSRMLS_CC); } @@ -930,24 +930,24 @@ PHPAPI void php_print_info(int flag TSRMLS_DC) if (!sapi_module.phpinfo_as_text) { php_info_print(""); - } + } } /* }}} */ PHPAPI void php_info_print_table_start(void) /* {{{ */ { if (!sapi_module.phpinfo_as_text) { - php_info_print("\n"); + php_info_print("
\n"); } else { php_info_print("\n"); - } + } } /* }}} */ PHPAPI void php_info_print_table_end(void) /* {{{ */ { if (!sapi_module.phpinfo_as_text) { - php_info_print("
\n"); + php_info_print("
\n"); } } @@ -965,7 +965,7 @@ PHPAPI void php_info_print_box_start(int flag) /* {{{ */ php_info_print("\n"); } else { php_info_print("\n"); - } + } } } /* }}} */ @@ -991,14 +991,14 @@ PHPAPI void php_info_print_hr(void) /* {{{ */ PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header) /* {{{ */ { - zend_str_size_int spaces; + int spaces; if (!sapi_module.phpinfo_as_text) { php_info_printf("%s\n", num_cols, header ); } else { spaces = (74 - strlen(header)); php_info_printf("%*s%s%*s\n", (int)(spaces/2), " ", header, (int)(spaces/2), " "); - } + } } /* }}} */ @@ -1013,7 +1013,7 @@ PHPAPI void php_info_print_table_header(int num_cols, ...) va_start(row_elements, num_cols); if (!sapi_module.phpinfo_as_text) { php_info_print(""); - } + } for (i=0; i"); - } + } for (i=0; i", (i==0 ? "e" : value_class ) ); - } + } row_element = va_arg(row_elements, char *); if (!row_element || !*row_element) { if (!sapi_module.phpinfo_as_text) { @@ -1071,7 +1071,7 @@ static void php_info_print_table_row_internal(int num_cols, php_info_print(row_element); if (i < num_cols-1) { php_info_print(" => "); - } + } } } if (!sapi_module.phpinfo_as_text) { @@ -1091,7 +1091,7 @@ static void php_info_print_table_row_internal(int num_cols, PHPAPI void php_info_print_table_row(int num_cols, ...) { va_list row_elements; - + va_start(row_elements, num_cols); php_info_print_table_row_internal(num_cols, "v", row_elements); va_end(row_elements); @@ -1100,11 +1100,11 @@ PHPAPI void php_info_print_table_row(int num_cols, ...) /* {{{ php_info_print_table_row_ex */ -PHPAPI void php_info_print_table_row_ex(int num_cols, const char *value_class, +PHPAPI void php_info_print_table_row_ex(int num_cols, const char *value_class, ...) { va_list row_elements; - + va_start(row_elements, value_class); php_info_print_table_row_internal(num_cols, value_class, row_elements); va_end(row_elements); @@ -1232,7 +1232,7 @@ PHP_FUNCTION(php_ini_scanned_files) if (zend_parse_parameters_none() == FAILURE) { return; } - + if (strlen(PHP_CONFIG_FILE_SCAN_DIR) && php_ini_scanned_files) { RETURN_STRING(php_ini_scanned_files, 1); } else { @@ -1248,7 +1248,7 @@ PHP_FUNCTION(php_ini_loaded_file) if (zend_parse_parameters_none() == FAILURE) { return; } - + if (php_ini_opened_path) { RETURN_STRING(php_ini_opened_path, 1); } else { diff --git a/ext/standard/info.h b/ext/standard/info.h index b616204b30f29..46a0dfc24080d 100644 --- a/ext/standard/info.h +++ b/ext/standard/info.h @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ @@ -14,7 +14,6 @@ +----------------------------------------------------------------------+ | Authors: Rasmus Lerdorf | | Zeev Suraski | - | Colin Viebrock | +----------------------------------------------------------------------+ */ @@ -23,9 +22,9 @@ #ifndef INFO_H #define INFO_H -#define PHP_ENTRY_NAME_COLOR "#ccf" -#define PHP_CONTENTS_COLOR "#ccc" -#define PHP_HEADER_COLOR "#99c" +#define PHP_ENTRY_NAME_COLOR "#ccccff" +#define PHP_CONTENTS_COLOR "#cccccc" +#define PHP_HEADER_COLOR "#9999cc" #define PHP_INFO_GENERAL (1<<0) #define PHP_INFO_CREDITS (1<<1) @@ -51,9 +50,9 @@ #endif /* HAVE_CREDITS_DEFS */ -#define PHP_LOGO_DATA_URI "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHkAAABACAYAAAA+j9gsAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAD4BJREFUeNrsnXtwXFUdx8/dBGihmE21QCrQDY6oZZykon/gY5qizjgM2KQMfzFAOioOA5KEh+j4R9oZH7zT6MAMKrNphZFSQreKHRgZmspLHSCJ2Co6tBtJk7Zps7tJs5t95F5/33PvWU4293F29ybdlPzaM3df2XPv+Zzf4/zOuWc1tkjl+T0HQ3SQC6SBSlD6WKN4rusGm9F1ps/o5mPriOf8dd0YoNfi0nt4ntB1PT4zYwzQkf3kR9/sW4xtpS0CmE0SyPUFUJXFMIxZcM0jAZ4xrKMudQT7963HBF0n6EaUjkP0vI9K9OEHWqJLkNW1s8mC2WgVTwGAqWTafJzTWTKZmQuZ/k1MpAi2+eys6mpWfVaAPzcILu8EVKoCAaYFtPxrAXo8qyNwzZc7gSgzgN9Hx0Ecn3j8xr4lyHOhNrlpaJIgptM5DjCdzrJ0Jmce6bWFkOpqs0MErA4gXIBuAmY53gFmOPCcdaTXCbq+n16PPLXjewMfGcgEttECeouTpk5MplhyKsPBTiXNYyULtwIW7Cx1vlwuJyDLR9L0mQiVPb27fhA54yBbGttMpc1OWwF1cmKaH2FSF7vAjGezOZZJZ9j0dIZlMhnuRiToMO0c+N4X7oksasgEt9XS2KZCHzoem2Ixq5zpAuDTqTR14FMslZyepeEI4Ogj26n0vLj33uiigExgMWRpt+CGCsEePZqoePM738BPTaJzT7CpU0nu1yXpAXCC3VeRkCW4bfJYFZo6dmJyQTW2tvZc1nb719iyZWc5fmZ6Osu6H3uVzit52oBnMll2YizGxk8muFZLAshb/YKtzQdcaO3Y2CQ7eiy+YNGvLN+4+nJetm3bxhKJxJz316xZw1pbW9kLew+w1944XBEaPj6eYCeOx1gqNe07bK1MwIDbKcOFOR49GuePT5fcfOMX2drPXcQ0zf7y2tvbWVdXF/v1k2+yQ4dPVpQ5P0Um/NjoCX6UBMFZR6k+u7qMYVBYDIEqBW7eXAfPZX19zp2/oaGBHysNMGTFinPZik9fWggbI5Omb13zUDeB3lLsdwaK/YPeyAFU0i8Aw9/2Dwyx4SPjFQEYUlf3MTYw4Jx7CIVCbHR0oqIDNMD+FMG+ZE0dO/tsHlvAWnYS6H4qjfMC+Zld/wg92/tuv2WeeYT87j+H2aFDxysGLuSy+o/z49DQkONnmpqa2MjRyoYsZOXKGnb5Z+vZqlUrxUsAvI9At/oK+elnBpoNw+Dai9TekSMxDrgSh0KrSYshTprc2NhoRf1JtlikqirAVl98AddsSavDBDrsC+QdT7/TSoB344tzOZ39+70RbporVerqasyw1MEnC8iV6I9VTDi0uqbmfPFSq2W+gyUHXuEdb3WR5rab5jnD3i/BNMN8ChNaqsTiKa55KmBWX+Tuj0XQdQVF307nhTH0CPls+O0UPbaT5TQG/8qX68u6LpV67LQ6dNknaYgaYyPDx2TzvYGCsnhRkH8b/rsF2GDj1MCInkvxvRjOuCUlipWD/zrKx7ZOwBF0vfSSM2ShyaqAAOC1Nw+zt9/5YNbrN1zfwIdpfgnqebv/A6pnWAn4qlW1HPgHQ6OeoG3N9RO/+StMdDtmV2LxJPfBpQCGfwTgrVu38jFrKaW2tpZt2LCBdXR0sEgkwhv21u9cxQsyW3ZB1+DgoOM54btU6tu8eTPr6elhy5fr7IZNDey+e76e9/fCLcAllHpdKKinpaUlX8+111xB9VzNrYxqUAY/XVVVJYMOekLu2fFGM8VWYQRYiYkU9bD4vPlHFYnH4/zvkb1CgwACHgMoUpdyw3sFXcXUh4YHaNSHDqaxdL5jwVTXBpeXVY9oF3RcUQ+O09NT7Cayfld+4RJlP42gTIq8w66Qf/X4a6FTSSMMDcaE/NhYecMM+MdyG90OAhodWoAGkTUaSZByO5WdiA4GqwStrrM6k5vFKEXQserr63l7oR5V0NBojKctaSZtbneErOtGmFxwkGewjk0UzpCUlJSIRqMcjN8CkHLDqyRByq0PEGBBhDmdj7rQVujAaLfrrlk7xyW5gUaxpEtOmOQDr0e799NYmDVBi0+OT7FcbsaXxEQk8qprEBQMBm0vVKUBRcNjskFE8W71lSt79uzhda1d6w4ZGTUUp3NWAQ3TvW/fPvbVq+rZH/ceULOcF1/I06CY3QJohCCzNJnYdgEwwvpUKuNbUsLNpO3evZtfSGHp7+/nS2pw3LLFPVWLoA5yHQUtXvXFYjH+vU4F5yOibzsRUL38MTqC3XWh8GCWziMcDjt2BNEZUIfoUOpJkwvziT3S5ua8Jj/4yD5E0yERbPkhKv4RF4mhkN1wCMHN2rWfYZ2dnWz9+vXchNkJzBoaQ8Bxqg91wWo41YdO2dzczD+3bt06Rw0rBG4nOF8oi9M0Jsw9OgLqQ124BifLgeuHyVbN0NXUrODBmDWxgRR0pNrUYqMNgDOZGZbNzvgCuc4j0kX+GPJ2//CcMagQmKkbrm/knwVEp++SIXulM1+nhj9AY207QRDnpsnye24WA59DkuPlV/5j+z5eB2hE0W1tbTyQdNJmDpksRzFp2E9csFJAboRvDvz8gZdJgw2ek55KZphfAv+Inu8UdKnmkEUHQK93EjEZ4Rbkifq8JiactEpYAy9Nli2Gm6CjIZPn1qlKFWizleOG3BIwdKNZ+KRMxr9VHKvr1NKLXo2BhlAVFRPq1qlWW6MBr3NWyY2rTGXO5ySJlN9uDuiGsV7XTVPtl8CHYGizf/9+V5Om0hAwVV4ahuU8qia03HP26kyqFkMOTudDzjs/P/QKBUiBYa5ZNucfZJUkCG/0IhpCxYyqBF3lnLOII8q1GKqdStQ3rTh5MStwXX5O/nE1metGQzPHUH6JatA1OppQ8u1eUbpX44tO4GY5vM5Z9sduFgOfG1GwUOK6VFzaSAmrWCSfzGCuuT/O+bi6QwRdTtqXN2keJ4/ejgkJ5HedRARkbkGe6ARulgMWQ+Wc3cDAWohhoZdcue7ifJ7crfP6Me8dELd0Mv8U2begC2k9SHd3t+NnNm7cqKwRbiYUkykqvlZlmOYVLIq5bHRep46JzotOc9BhuFc0ZHGLph+CJIaXr1FZSIfxsdBiN1+LpALEK2By61Aqs0rwtV7DNBU3BMCYixYTLU6C8bM5hBwum0k1mesBpmPtlj+qXFenFsAgCVLon9DYeIxUnmh05HCdBIkCVRP6ussiepVZJZXIutCHwt2I0YGY2Kiz3AIyeG5aLNooVULQBbHy1/nAK2oEtEanheil+GO3aFg0FnwSilNC4q6OrXzywc0XCy1WMaFu/tgrCBLRuWpHuP+n1zqmRXFN0GAnwKgHeW1E1C/86UDJHFKptATZMPZTafbLXHtN3OPixKRC4ev4GwB2Gy6JxhQNEYul+KoKp79RMaGqKzy9ovzt27c7pidVZtYAGJMYOP7u6bdK1mLI1GQ+/ogSZBahwKuLO2jSZt0odw65xrUhAMNrZskLsGiIXz72F3bTjV+ixvtbWcMQr3NWCbog5VyXAIy63PLrqpJITIqHkcD9P7suSiYbG53wvTLKDbr8WBbjZqIF4F3PD3ItRn1eQd5CBF3lCM5RAIYfVp0/dgZ8SvbJ2/l8MmlvNw+8qJTjm+drWQwaAXO9KMuWncc1GBMXKkGeV/pU5ZxFIsTvzovOCu3HvDnOE7NTu3rLr+PE8fy6+IEX9947YM4n/+LbPT/88R8QqoYAuVSDrZLFKcYso2AcLBIeGDPu6h3M+yqvIE/4Y6w4LdUfi+jcr86L75KvC9+PcbVfd1hCi6U7Innwk1/+Q5rcoetsdyBg3s9aCmivBsNFifGfG9zCJUFiztmpEXAbqhMgr6SLWBPu9R1enRfm1ktrC6cVYWH+/Mqg43x6sYK1edaCex7vkRZHZkF+6P6NkXvvi/TpLNBUaqTtdcsoLtIrVTcem2EHDh7m2uq0ikMINBvafOmazzt+BkGMW9CF70DndPsOaJqb38Y1oXjdCYHOiqwbPofrKid6thMAlnxxPtMy6w4K0ubNhq73U5wd5PtVleCTd+50D2CEafLloqixyv0ufMcOGq64CVaMYN2119gfAdPpuscKOxWgCMDwxfm0pvzBhx9siRLoFt3ca7Ikf+x2yygaYzHdTSi7IT9y8fMJ2Lpdhg+ZCPA2+f05d1A88mBLHzQaoA1dL6ohVLJGi+1uQj8XQMyHIMgaGT6eDxuozMkD294LRaB7CPI27DLHQSskSFRvGa30O/zndF4fF0DMhwa//9//iZ2DcILqN7xBHn1oUweNn7eJ3WO9QHvdMlrMsphKEj8XQPgpuHVVMtGOgF0hC9CGTqbb2kHOzXx73aKiuiymEv2x22ICMYYeWSALBQ7RQ0fkoZIr4DnRtS3ohzf1dNzTG9d0PcwMLahZO8UyKTMm38wteratSVtkplq4oWj0PcfrEinPhYg14H+hvdIwCVs1bvb6O+UBMYFGl90d0LRGLRDgoHEUwYnXDniQStocTVUwfPLaKQGA/RoWOmkvtnsaG8unK+PWMKlH5e+Lznp03N27RdO0TkxmYNZKszYBlyfI3RpjsQkmMOo8ls4Wsx1EKcEVAEvayyNoeRzsO2RI+93PNRLesGYtNpBhL4l/prlgZz5ob0mbtZVFhWC301d0EuQgAHPgS7D9hssTHKyMbRfLptF213NBDRuoaqxNA2yh2VUBDnxJ1M1yRW6gOgt2x64gqXK7ht1yOWyW1+wl7bYXvhUygQXgit4KuVDuBGzSbA2bmmtayNzpRgJOGu7XosHFChZzvrGTiUKt5UMiVsmbmtsCb3+2lZmwm3hFNsA/CiYdKyfhYx3Aws8urp8nsJM72naGCG8zYwZMecjk/WHVVRbsMwU6tBVQsWJS2sNDlrgVTO0RE/vzKQtuN2+/85k5PxlUaL75D3BZwKss+JUqSFRAO/F7Eqlkmj+2gbrgYE8rZFluu+P3pOGsyWCG/Y9/GR8exC+vYfc5flxgzRdDGsDEz/8AJsxwQcBUKPCtmKOMFJO8OKMgF8r3b3sKkAm69TN+2OZCAm5ID/g9XPypwX29ufWgudq0urrKes/8nPkxgy1bdg6z/or/SFc2mzV/xs+6HwySTmdYJp2dpaWKEregYrVfn9/B0xkD2U6+e+sOaHqImTfLrycUOIZM1hJwC3oemPXbi/y5PnsrJ136bUa8pxu69BklmANWwDRkgR1wmwVaglyi3Nz6JLQ+ZG5NxQsgNdAhmIfJN7wxgoWg9fxzPQ+c/g9YAIXgeUKCyipJO4uR/wswAOIwB/5IgxvbAAAAAElFTkSuQmCC" -#define PHP_EGG_LOGO_DATA_URI "data:image/gif;base64,R0lGODlheQBAAOZ/AB0BAHB0r0xPkMmMdtjXu9CYh2sxAquv1pJsTmUCAKyQaaVnA6lwVYOGvJM1ANvbwYlPMJubzVYCAGgRAJhqLm9BCq99aLetkqpMAKJCAJdvYqtzHZZWAnNsmIUjAHdKNW8bALqST3ABAJpjEVYnA08xU5JLBG1FU8fKtIhcS4d0kYJFBLiQgkABAIQwAd3h0eDm2sXCpdXYxIiKwG05M7CtuH4UAVNGdNPWwJ5dAcB+ZOjv6NrdxqRMAN7ZuH1qeXZYYszQunp9toxRBJ2dz5yHaa6ANoVYHrWgebK54M28jdfbxpGTxpWWyY8tAJqFl6hHANzUr5J+UqOm0Z47AI9eG9LKolo1IEASAkNIjJSczVkUAYyPw1NNTqSdrYNgZ3hMGK9XAa5KAJNKGaGdv3k6BVgZE6BTGmVopNrezIJhNGgeFpJCKFogM9DTvpiQrm1afpiYxZxQClZZmKJSBaNGAWsnItLQscC8p7NaEI47BpdhQGwVFy0bH18LAJmZzCH5BAEAAH8ALAAAAAB5AEAAAAf/gH+Cg4SFhoeIiYIRRERTj48HkgeQU40Rf3FNm5yLEZ+YhnFeTYqmp6ipioyOU5OSSbGys0mTkERaTUxcM729XExMpaCYTTU+NaWqy8yoo3Gtk7SxlGRvT08qPz9f3UBAX0A/KuQNXOfnMw0NQu3t5n+YNQ9RXs33+IOfeFE1B7MHyGTjdoLGGjN+JChcyLChHz981tixQ+MEEDhwOgRoFyAAmo1C3rh5gEdZvpOnHB2Y56ZGkilvfpyws6WFzRYMH+rcOaGnz58+/UwQ2lPiiYxokqLpgIKHlSeXUEolpPLfgRgv8KQw6CdBAoU3cUp4OHanWbNA06aleOIGGjw8/x4gQSOkCZFQU+9FcPWv1hsvBF4g6fpwKNiwDRMvPMu4sdk1F+IqgZNFABoujPDmTemK2pOZWyKnKVK4Z8KwYhXnHLvYsWudSNLQ+5KltoA5Qv7c3axIZSwyKuwstBMkLgKipv2gVpjw9Vm1yNWajv3gAYUtbW7UzoLbLm9DRGAleUIjYQKyCNLwwKEG6OmbzBlLTwtiPlAQ+CdQ5xGiPog1JWwngBCMfKdbZweoUF5ZO8XGwx0QIEcWYqVF9xMILtyHX349bejhh/ghERcPSHjgIYDacdfAJ5t1Np5w551lRwxpLGEFGNG9J5aFaq2wAYge+gQkkBfI9oASZXw4VP+AtaHhHUrhxfIGDa2ZJcEHbvBgI44/6cicWkFWYcSQHE5ApodlxLBEdVasoGRXZjA54G74IPiFYlYisISWN+YoAXxjgbnhBBT0ZyaQQx16JghgBFHdA3dU8eZXEmTX5JPMdPbEGsw15NWnEmjAQ1wQJpCcjjgVxhNQRoRggIb1NafokBMggMMDa95BwZtfgsDkHDMQscxektzZqQSfeoWsskUYecceySrbAgA2MRhtshO0WoYEIng1galDyXpmTwrI8AAPBBBAQYemLXRoAm3Y1oCwqBBLBg2pqdYQC6M+QAAD0f5J4bXRghBCCCssS3CgIPbUrVcX4IruvwG7G6v/QiUIkIUQ9JriSBxt5JvQQoAudMGe/iqQ2HJdUaqYAQeboNBXyi503qz1PfzVGjFInC4CoDaUn8tMzmvKXm/wIYIIEzDdU9AuM3dyXAQM1tByyJJc7UJlGLEBByNrXa1QSlJqEwIEnLsEAVEgIHa1Zo58U8Ybd3wIEW+wYYMHfPftgQ2ABy444HigTIASeizddIw6PV1z1BKUscACOYBwNXxEefjVTWZckLaWBDx7GLXUtlDf6DYFKAAXdg8ShxZxsOGEA7TX7sTtuOeOux6F93uHER444ffwfA8uOAhl5LBB5QnYIILzDzO9oYlDK5uCGwTsuQQOpb5NFKo2aTdH/xOa/bGJFinMXvv66jvQvu28S+wvEnrYjrv77Ot++wqFhrCBCSAI3u36pjsXuGCAfkNC2s4lAxzEYAzG6xDfQGCDpz0kAXzQDhpaxwQtaOB96wuhCGmnh5OtyV9WoID6bjfCEbqgAmBQgxQUoIYKkAALIGwh+xhwh8+thwB4GIP+cHdA3fmNBrUxmiCCMYO/8c2AUDQg3+7nAD1Y8YoXkIHhohAC/OVOh7SjggGwcAUjrIAEN7yhC6gARhGeQQnpekCNcIAD+rURjOIjn/m4oIUTLG1pftjCFu4zqydKEQky0GJ1CJDCvf3NkQSkogNWYAADgEEKBiiDCVZgAgNgqP+NbGSjHhT4uTm6QQE5vGPtylAbjkVgFypQWAKmBYDSoQZrCtFAIlHmgygowQM6+9QfB5dJTnLABENYAAdykIMVlMGTASTeFIXnBAX0sDppSIMM3BAECghQdyS84gipQIUTZGGDfwDGCa5Wy1rS0p3tbOdNUoADLcall1ycwJ/2abMELC0BWzCACUzAzMkpcwQcoMMxDbCFlkXrYR6wQA8/94LtuSEGegPch55oABd0NIDRdEEVkbi6JsyAC21gpzzjyVKWXgEFu6wOPkNwy5IF1Jg5MKgyc8CBZXLgjDWpaQs+cIEoxPEBL3hBA4OABH1m7ZZYiKpUWyBVQYKABNr/CQAvhOBQf4pAJ6wRGE5ustIWZNGe94xCFJCAr5pKIKBlOMIQlpnTyXFgBENg5k9dQIKatNMMNEAAEqxg1AWmAQZL2GYQ9gCod7b0se0MEBp6oQLBCXB4FOxJBSvYpYQgwA27vCc+rRCCD5hBrG8lQRlWMIS5Us6gd6XrT58pyCsUAQlKIGwvCeCD6vAABtrEgRsusIZbQva4tezDbRowgy+Q87nQfa77vjhCJ4whBvVcAsoe4IPu9tIKSkACEsZw1UyWYa50hS1e9brJZ5YBCdxVa3cXeC4YKFW4QUBATZF7XOUKYB3OzYCAB0xgAUe3wASmAhLckN1+ydS7vVXC/wIqUIFiznUIIzBCMimHUMod05mrDQF3e/soXB0Wsfi9QBlq9jaBwROyfagMgKmA4BrbuMBUoAAKGIzWuDy4u0agwAoqvNqecqAKajDA5HiazGNucgWsNcKtSoyrF+xgB4nFQRBQsAf9+S2a1PMQ4CZQwYfE678NCPCN12zjBdezxz5GqhKMgAAwEBkMHEjmCI4wgg0sYAQddjKUh3CEDVghLtrdEwyuHFxu0i/BNM5AdKVbO3LSDnckXccPqFCHTnu6DgMGNZsLfIYY8BjOcYEBEqRAATBU0gAryPMCNkBrP+N1BMoc6KCrQIEi7SkNL1g0lhvIzQuMIdI2FnUGQP/d6Rt/gDszEEIH9NCDalv72tX+tLa3DWoG7PjN2h0VD9QjBSkcwYYGqEAVWjvrWucA0Lh28mqHUIUqKGAJSRU2YokdBDzswQFrbnaoPW1jc86BCe2ggR4GynCGy8EEcpADtieO7TooIAinTvQSYBCDctuQBOmWKwfaTWtAVyGnFAYxvdWAABRc+cr7xq+/HaDsAn9awNyucVb/IIQGlEBRJuooFMtQBhdcUQ9QbnjDHy4HJGCcx4lWtRTUcIU+AMCS6+ZArUsO6MlVGOQkgKEMLwDzRgeh3/+GArc9rfZtt13tOK8DFNhQmxlEINpw8OofFee0n1Rwo5W8KsgreXH/jGd3CaMpQpLRmO5193kDXtvACCjA668N4eNhl2ERkppI/AbhAhAAOIHrQPHSX5vtUDD4JxAuhDbofe+wj33sN1c6P7TcDbiXQRpQUO4roLECZahAax9vBK8hNAdVQOgQKPn7GEoBBdrk5pYVYIdDmcgDRh9oxOVAh+7TYfveD3/45aAdjgmiHR1owetlz/7Zw6cFKbjA2d2QBjyUGwxXgOERKECBIVCA1sW3AYVCAUbQZ3jlTBQGBmBAVGlwdp+HAEFFISBQSURXBkd3gWNgAhmYgQxnTgLABJjwSu1QAgDALe13grH3fmZQBDEQBDJwAWpQQxUGQzBUBZLHa17D/2uUdwRHAAaU9GowpIB4cFFFYAaP9X5YECiD8zyD4zc2YAcaY36L0AAdYXUmmCwoyH4lcyVFgAJFgEaMl3IrMAL1FgL8t3WS11o/CIZYgEZqUAQf4Fjy9H7IkoWyJz6agQntgAbU4k8EQzB/tH4SQC0MgRMfAAFt2IbpBgaERnlqQEMh0CqRRwE5sHzPBIYkcAWl8ydHmC92KHt0wzqFEAFN0A5zgBN/mIrC9EeDaEtjFTljBHL6t39HQGeCFV5IEIn8VwVQdolYAAZGYAC21IoshRjr94nxkgVKNIpcsBFwsCzBpIoPNUvFeBMhcASKGENqoIBgcARqQAEIgAD8h/8AVcCDdvZ1NwQGFIAF7mQTR0g66vdPWPh6WNgGGhMArUMIEdCMQgAHLuCExrNZ7ceJLTVUaOR7QdiNPMhy4RiOu1iOllhJNxRVAIAFQdWJ7uRVgBiNCcAkAcAiiXB3G6ECxyZpk8ZG04VAxIMfVlUfE7AFUZV5e7AHDMAAFnCTLJCTOWkBNbkHEPCTdiaR7EhVQ+mO03JLsiSNXkE3aACSq9CMGwEBUDCVVAkFGHCVVZmVU3lzBQYCZJQCNqkDOjAAZEmWBXCWaHmWAyCWOsCTDIAAKQAGE7kYp0IWwqSUXuEHKYKP5ROSCNcRKQAFYmCVV1mYhjmVhpmYislXYGn/AWwplmWZlgVQlo8pljX5llcQVSAgSbkDkIHzPLJnKXPCDKQoBCMplYqZmqqpmCZwBY3pmGUZmWpplmSpAwzAlpe5B5qIBVQgBoO5lYSZlaJ2kuSkB+YEbflYLxFAhR3xBWcgBqsZnalpAGAZjrc5AJKZnWt5mbfJkzO5m78JnNKplWJQBx+QIk6SnKpQmh0RACmAAdApnfK5AofIcimQAjSJnZJpmxqwBw2JADTplhBgdSQQnlQpn4Q5mBCQIv9FJyeBCdHWER2QAnIQn/KZmnnwAR9wnxrQoRoKlpFpARqQAh9AAynQoXAJljWpiR/AABmglYIZnb6JAQtqGwGA/ylTgQnMCZjPaaEXepUZ+gEacJMpEA5AwKFrWQA8eZ9F2qE3qQE2iYgAcJts8KJZuZq+CQU12iRM4KC8QYo7GgA/sAcx+qMYEAZlkAIsYAE0IA5X0AVF0KFoKaL3+QNv2gU0wAAswAA0AAEf0Ad7oANsQAVZ6aNX6ZtiMAZtYRuX4aUG8glNEKYTegY9YKiqGQYGIKQIoKFf0AU/0KEpYAGTeZ/hqAKe+gUfgAAaYKIWgIhUSqhVGZ+IigFjsKWV0ah9aSCekE6m2Z4d8AUQQAfwGZ1jQKIMsAcc2qEasKEDwABCKqKqOqIpgACOaZt+OpmDGp6I6puKmiK10R2Oqv+rh7B67NCeAfCrM3kGYbCu7LquNokANnmT8moBV8AAa+ma88qTN1kAlgkBGjCZepAB21oHtbqo2zEHaLAi4SquIUmuHfERH9EB3CCOW2cEPXmbY0mWzmqvOnCiZKmTFoAAYymWezAGgcoAhFoHbPABBnuwAWB3jcCw+MAiTBChSqEUErsNnzqvbbmWPmmZNJmxssmvx/oB4AAEbeGt30oXDaAb6imzpEmz5XqzVNsBHUAOKoAN3XCZRWoB2PC124ARAqAx2yEglvGydhEVUPsdoPAHuxChHoEGczC3dFu3c3sbY0u2Zbu3t/ERQnBSaeuUayuzoLAbTcALU6sUdnsSt2Nrt0mxETPABE57Cbmqq4EAADs=" -#define ZEND_LOGO_DATA_URI "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAAvCAYAAADKH9ehAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAEWJJREFUeNrsXQl0VNUZvjNJSAgEAxHCGsNitSBFxB1l0boUW1pp3VAUrKLWKgUPUlEB13K0Yq1alaXWuh5EadWK1F0s1gJaoaCgQDRKBBJDVhKSzPR+zPfg5vLevCUzmZnwvnP+k8ybN3fevfff73/vBAJTHxc+khL5kr6T1ODk5nAgTRTWloghFVtEg/zfh2PkSvq9pJGSKiX9SdKittbJoD/PSYkrJD0vKeB4IsNNotfuUtHk/CM+IvijpF9KGiDpGEkLJZ3lC7qPeKKTpD9IWiDpUOfWPCi61ZeLvD2VIhTwp9QlTjK5NsIXdB/xxHmSpvD/OucWPSAyQw2+LfeG1SbXVra1Tqb785xUaNdMel0g7Iu5V1zPv6dJqpD0kKR/+ILuI55o8oeg1bFT0kWSOkraQxK+oPvw0TZR3ZY758foyQXf//ZxUFh0Q/GEfNf9gHkaJ6m7pHJJSyTt9tnXhxtBR2EGlnHCMbZMaHuHzX19JZ0u6VRJh0k6hM+BpMjnklZIelPSNhff3V5StkNlEWBMFm+3LcC+BW3GuZP2GvfmiEiCCMUzxZIKRGSt9zeML/fdGAW9JB3O8c6SlMZ+b5f0qaQiF7EpnieXY1auvZfG7zhSUk8RSS428F7M5xfsh1eAV/vxOzoq16sklZBqbdpo5H2qDPRQXoP3Ki0+20FSFyrZUgt+Rt/7KH2vZb8/t/iMG2Sy/0dI6sbvgHGoV8a3xErQb5Q0iTfHCplkzlkW7w+VNF3ST7QJUzFK0pVkDFiw+yV95uC7r5Z0k3CW2ApwIkrJ9B9IelfSh2SIlqC/pDFUZAVk0rQoMhk2GYswx+AtWvMKPtcyEckW37pPwsIHNAuBniDpYhEpBMmJwvibJL0gIlVh39r0C8UlczkXQ/mM6OtEzuf3RfPVAxUY47f5PStcGKPxpOMldbbxiBptPMavJX1PuQ/P/olyz12S7rD4PLyqBTQ8gyXVSOot6VK+dxR53wyl7POjkv7pkpcwpleJSCHP4eQjM0BB/ZuG4Hl9EO8mQx4ZQ0FfL+k+k+t4wNlULpkO24IGnSzpQklzKPDRAMvZ1eXz9uXfH/Pvx5Ie44C5zYQXUgDPj6LEnMCQ3AFkjjupjGF9/kJmxPw1oiquz+6dalXcCRSmYxwK0kDSRI71azb3Y+6GiMi6P/5ey3F3YpExjxdQoG61uX8gBetkh2OWFkUIVGUT1pS9yosZNu1nkl8uZH+mikhxkx1wz7mkB0WkXsKJFw1ZuSWKotY9wjNJS6mUy41JK5P0c2qCnBgIeQWZvEK7Dnf6WUljTT5TS7d0KwezkJShdWIeGeuKKJo7FktUQylcl0i6RtL/HH4OjP+wB0UTLTGHfubRDWyi1g7SaoZQ495z9w7RpaHKqHEfLeklEyWzk+7dl3TTu1KQCpV7+pBB4IWstFFAgvOpJnTL6DoW0xPbw3k/nIYkW+kbmHeXhUEABklazrBDBdzTDfyuBo5DPq1eoUk7ZbSk70l6n3MZjUdCDpQvMF/rezn7/hX7Xs8wsj/7rsrWdQxnZtrwwENUosJkDDZxTjOUkEH1ds6lzJyDZzGScRsonGNcMCIG+WgRKTRQ8Su2p7uRi/mlKjZKekREChS2KIOcTvfqp3RZDlM+cxnfv8Thc75Pt8kqo92VzNTbxBqcQlceivAdByHDIxbvFTMOLovyHAGGK3qc/jJDoDc4hpjABzBm4UAglBFqEAOqt8mB29ss4uJnNCHfSK/tVZMYEfMykt7Bcco1eDLDHCT8gmzzRdLHZL6wRSgzg6GIgVl8Xj2uhPA+oQn53yTdK2mVMC8NzuJ8zaSyM/ApxyzWCFJRvUQ3eQ29BTNFcRgt+FTl2g30zDZZtD/ZRMifE5ES6Y9MxqAHQ7XZikI9nd97j5p1f83GZTPr6Crt2sOcOB1zTYT8HrqjVRZx4wbSAt47SXn/YsZV9zp4zuvJgNGQRaszmoN1rBY6IH4dHiVHcA5dZd2zeIbPv8ZBkghYTQFTx/h1WvSz6c3kM5ewGG8Prvxc5DZWS2u+dypnM5Y3sIJMXmbxfXW0misZN56oxITnWsyl2fg+6+C+zWTefMWr68RwaYF271htHBZqCsKqL28wB/ACjYShrE9nUjfWmEU33A7woqbR4k5UlNk4yoYOzOHvtGs30KO1QgnlZC2VohGOIGn7WEvW0ZdoMeCHfBgdo8X++m3V+s2wEHKzJMblJom92+ne2SHDwT1gknUispPpJLrrVZqwLxTmy5F5jOdVS72F/b6UwlbrcEytrD00+a8l/ZUM82jEZd8peu8uNYS8JxNWqis5IYqQCy1rPUULh8Y7fOYal3zzmPb6aJN7zlf+32bBV9ESclNE85WUX4j4oNbl/fM1b2eoxX3jyXNqiDTP4Xe8Rm9ItfSjvAr6DM0d+o5MXW/CuHO0a7eZTLYT3KF9LktYZ/WdCI+IkoV+lFZ6l3J9OF14HdM0F3MrhXxFjJmqhh5FBera24XqxaCqL0UosK97Z2ku+yJaEqf4D62ByoROcjZuN78Xaa9zTBSzKvxvC+vlrmgWVPU2h4j4FCO5lZ+vNBnpYHHfOOX/PfR83eApTaGM8CLop5l88WSLWAOu4AiNme5owcBO1xhlLGO/eGAFkyYqrtFe5zKzqU7KBE5o/BAIiv7VJSK7qV4GhEF1XtSk0YseWl6lWYI+cXj6pigJLkH3Vk0qfebxe4q0JGOGSDxCWn/Nchk9qJgMfGKS87LDes1IHeVW0LszgaC6sPMYE5lBt4CzRcuy4lVMLKlWfWwcJ+YpxtcGjtOYfzRjTgNIlv0rnpyCveeHNFSJ/jUlonH/3nNYqyOU28qYhHOLbzVPqFc81JQDKxnQ5twLdmjfmQzlxU6eoZ/mma3y8D3VonlhUr6bElhMwJ81RseSxW+jfOYULdYGAw5s4WBtpeU0ijKwxnp/HCfn70piCNlMFEUU8/WpmnZe1Bq80r96m5yMkIwx9nnNHTWFs114q0ArM1HsiUY7j5/rKFIThdrrzR7agHyoy9vd3Ag64uEfKa+xjIKlLqtTUBB7FWgJrQ9joFl1d2cQ2wzHaeDXa6/ztO9Wx+OT+FrzSAKuV12ptOZp+ljnaVawk8uxDpnMZXYCGB3PXqe5sl7QQ5ubhhQR9B4mQpvjIR+gJgrbOxV0rK/rVUyXmyRWdI2a2YLEhVP3BwmN9sJ9BtQpKkxiSDOrUeUhaeQaPevKzKQ3oIVTSGatcynoRl29sIkh440a8pURNoz00Ab4Ts1obxCps1FKl8k5IpKbcmsgu6nz6ETQC+iSqoKKOPmVJBmYnDjHX4EozB9s7TgwykkyYS13URAHpmstYIloOP/HEi6Wx5a4+DwSpH2V18tTyHUPm3iQeS1s09ai4/0ntVgNRQmzHTRulGwaQNnei3FgHqPcMBEJlXrNioAaE8AcupKBd7ElBu1uTxCzg+dmKB4TahiQNX/OxssAb00Uzdeci4S3FYhEQdfkWCrc1cI2K+2EDhsP1OUxZGUnOWTmcgphV0UgZ4jUR1hLlBiuJfqJpb61CXimOrq8RqiEeu6TU3iMwdzYgWhUnWHDDKr0ptLar6USqmOfYYiGMMTUN/KgziGVTo+pNJHBBfF0zVAQc6N2DUL+tcO2Yc1Rk2ss+yBmOko43yCSCljJXAWA7PD4eAt6MBy2yiNACRvVVN05t40pPLYPsT+zlRDpOLG/Jt8OSGKhmnBpivV7q/Y6JkucVgkyWKb52rVZwl0tvNDi+AzRvKjfK1Dnjvpd1FhPEc1LBVsbqENXN35cFaPY2BIVGdlWYZKqgPPj/RythNtpcNycpoOxwAae0bGwhAkAQg01cfiDWDRqZtHhCqFQ5FAtOXKXh/Yh6Ci2N5YMUDW2SHg/N3scn02N++cnMIZCBdwS9gtApRxqDc6OlzWtSrdc8cJGlzP5fzZDri1tQNixISWL/5fSQvcVzfe/wzXfSG8Kuw03pHB/t5KMik+EYJ1EC1d0zCw6fofqRI2ZJwpvyxN4uPs0q/6UR2szyESobxatf3aa7jvfrT0DGPNpYV3H3CI0BYLGllQdy7TX14rUP/zzDHpuRp0EPLnJvH68Qij/RXnyIyku5Ea+5S3NO7s01q77eMY1qqY8T7Qs+4qtq+o2UWhjZO6HuWhjJBlZXWbAHvbFSTAxqMW+RbuG3VfviAP36tshujINh6Tr3kE0BNMl5x8Qq6+mVTdwrMlzpRrGaGPzVpw9NDNFngjoFZZzRCS/FRPXHRZT31X2MgfYTQYX1WE1moaaQJfKEFTs/camkXnUwt9YtNWPiuc67VmRlb0yiRgS/cAe7is0QXuTAm9kikM2DNc5OkeGRaMU8tq0TJHbUCOtezMeRfITiSv1PLLbGE5gb/NOB/1AuR1KlLETDltidyR4XIPasyEnc6eIbRa9kfNifFeXJOAnVJBiKfFCvobcLKccLHWojHJpIPH3iXQlpoNLrdcH44sucvmQOHHjZ9rDrGdbixVmbk/XGy4mtiKuoQDjmQpFJLs6wuSZvqKmL0ky6zOZLry+420UKUaue5ooyeqy9+iopgM989cp1Dcp16bSU1tOJbyFyjedTID5wOk6OAUFFXUDKFRLkmBM3xH7fzIJwPLsxexDMWP2b8g38DqN45ywCuH0VNuv+XmjwOYCjtUakbg6AkGlNoQGBMB5A9g8hh2g7zFE2U4F35FxfHfmwwbxcz3Yl32C/oAwPwDAS6UXdpOhXPZ27Trc9R/SLTla0zzGoXl2QAexnLVZJB/CZMpV7HthfL4lJIrb54u+tdv3/rCiSbw+k88yM9ZxXgKwlHmZycq13iSr0KeMHmUZw6r1VICrLT4D5fy4wq/5DAvfjaWC9oAd9KxwTNUJynUjL+EqpwSTME1zOWMBuIxmZ7p9RCsNq+NmdxW09I1MdNkJeYZNHsIt0qKEO2Z4kvmHadS+Xqv2cqzc93rpuhdl54tg2DISuJljBW3uZjMHrAPqHOYK6zPIM23G2+14Rts4cyLbdxo3Y667UskOo/W/m/PwRhQBwZFkT2vXzDbTtLMZCyfP1155bbfDrpjKZoYH41bO+d97jmEgMPVxFMF0iHESIkiNtDhKuwV058cw0dBZNP+lFsSU/6VWf0E4P/x+IF2eJnokr4uW/2jAKPYjjRb7Cxef70c3qsCl0im1Gj/Uu2eF6sWo0rUiTQq7zS+pYjywnXYwcyOZfI4mKgHj9N2ttHqbRfSlQXhjw5XXy4S7ZbzOovkxVRsphHp8ia3HlyleZS1zHcvoVrdjuNFdEe7edGHzSbpSria/WZ3+cxYV5DCx/4w7FUfyfTW0WO+i7x2YrzKUXZFw/sut+OxJDGkHUxEZPwgCquQcIgxZR9oXekDQk8FF60bqwocupaIoEz6EmaC3C+0Ro6Wgp4eb2tpPJqN+4xXFXQ3TfUfCc5PDNnLZDpLIV1NADKyjZa87mHgmWX57bYdIfIY3pdCGf43xQUXI62kBn3fZxi4SPC8crIjDQ4yzFAaz/XcPJn7xf03VRzIB5Z7qCbBzPQi5jga2E9bCD+ELug8ficEZCk/Cmj8Ro3aLtLxDR1/QffhIHNRTUZCf+S5G7SJBp2b7G31B9+EjcVAFEInZQ2LU7jiN1zf4gu7DR+KwTvkfO9bGx6BNnEQ8XXmN5cT3fEH34SNxwN4A9dgknIEwyWNbeRTwV7WYHBVwFQfbwKb7vOUjiYAiKVT1PczXqCLD/n5UbuLcNxTKoCgExSFNmsFCHI6iJBQFnUbqqbWPHyFceDAOrC/oPpIN+FVaVLrNUa6dLPbvoEQdO4pd1OUylBVkCutsOkqosbNvwcE6qL6g+0hG3MY4ejots1pT3kE4P9QDdfuLKeDfHswD6gu6j2TF2yQcLoqEGurre9EdP1QTfmxJRdn0NlrvD+jmY69Egz+UQvxfgAEALJ4EcRDa/toAAAAASUVORK5CYII=" +#define PHP_LOGO_DATA_URI "data:image/gif;base64,R0lGODlheABDAOZqAH+CuDk3RyglKszN4qGky9PV57K01ENCWIOGuYKDs1JScpCSwsLE3qqs0ExLY1tcg93e7Ds4PG5xpWptnWFjjXV5sXt+teXm8JmcxoyNwbm62Wtrkk5Oa3F0qXp6o4iLvXJ0o3RzmI6QwVpbfuLj73t9raSl0G1wonJ2rJWWyLu92XR4roWIu5KVw9jZ6pKSxGRmkmtun6WozpSWxS4rL1NRaLO012xqjFxbdoqNv2ZolmhqmpyfyDEuOa6w05yczVVWeJ6hypaZxYGCr2dplz89ULy+2l5giZiZyIyOv4mKuldYfLa319XX6CIeIGxvns7Q5L/A3Hd7tHZ4p19efZmZzG5vmHN3riIeH////5COj1lWV8fGx+7u9dXU1fb2+oKAgayqq3Ryc/Hw8Z6cnePi40tISbm4uWdkZYmJtgD/AEdGX9/g7ZuczGlrnG9zp4yMuri52bi615qbzKeqz9vc65qcyWZkhGhniaeo0m5woIuLucbH4MfJ4WlsnJeYyyH5BAEAAGoALAAAAAB4AEMAAAf/gGqCg4SFhoeIiYqLjI2Oj5CRkpOUlZaXlm0/bXOYnp+gP3l5Nj4acUwaGkwGPj4NMgRBPBhCLQtJIjkfGTkiLymgwqENGgx9TQVQUAN9fAxRUSpyrK90sbNCMy26HwgAFhYVVyglFgkZwcPrjCZxfC5sbBAQdS7JA9QysyIf/iwAEQgEQLDgN4LhpKxA8UbCCT87nkwZkoSdRTVBbAxgQ+KCRxIk8jUQskCKyZMoU6pceXJcBwkTduiAQeEIBStDRFzEFIQJFI4eL7gwQqcFy6NIk6K88iYGjCNHHoxYcsSDzp2Qfmh0AYEjBCMEWCgdSzbplRM6HiwBokDBiCkz/7AuMqGhQBMXdQoYSFK2r1+kHWAsUcCBgwM8CeQayhNlAJQCA3zk+LtyAYbLmDF8oJz0DQUFDtasUeBBsZo8Rvj0GcBkBueVH7JwmU2bS5fXSt0sWXPggIMQO91FYcCgAQLcKzFwwcK8uZnbyJN22F2kyJrSw374kGNEBQ8L0VeqINO8uZgC4ZVeeXAgQAAOcECZMMBEDgEA6VcWEFOeORkV+Sn1hgLu9XAHJnPQ4YMBMhwXoEpdmNEfFlwQ8KBSMazRQw8H7FHJDzI00EBJF6YEQBYTYpHFZiUm9UAAGwInSRsE7ONgiycpN6EZX+ColB9F0EADFZHYEQQBM4CH1P8HmTXZJItHqRDGhGJc0CSJLDHp5Jb4jYWCAzQIUMMjSGAQBJRHffBFFmy26eabWXRRQANdolQAGBOSAWebFwxg4UkL7Ckom10M0IBSQAgggAONzCAEBmIpRcByKVZqBhhcfAEgSl1sUWmKNGyhRRldkGjAlJ9OuAUYXnRxKFIjCOAEo4psI8SNSY2X6qdbeAFBlyfu+ikYY2AgxQB4CqtqGQMkNYITTuCQSAoitIBmUhDwp2yKYUBgEgZebJsiGrdd4Km45dHgRbNIrQEtdoX84ctkZX0hIbr9eQGglPjm2wCK/TZHQxl/HhWAEwIsYEg/9JIVW8DlbdHjnRAzp8X/BeFWjIUY0B3VgaxjEpICAh/UOdakO8I5xhnaTugFAZ1OyMWbY3CBRopaZIFqxHCWcca5E5aBJUsKQJsGId7gOpau/YnhLUoLNNAFeRNqwQDA/a2IEgYNfBFB1VloUTW7gBrwRbL9hWGAUjTMOsgfACCgZFnZ5rmpiVl83XQWGZfH40oQAN1czoIzd8baKn0wBs53H7UEtAqrIYIFJpNlr8wFpxS4qjpT+XRKMfd3RhY0BG3sSqGXp0XjLHUA7Q2CsJBQXw9POMa1J23eHxpZoN3cfyoFG3QZE9KQxVGpD846S0W4rUY4c5OFcn8R9MjS5f0RjrlK4BafxRmqXnAU/9blAa8UB070IEgFlDFdHhqfp1R72uQ3d7tK/Pa3Rdhjs4QB8dtTCgWgJYgVUKZu2VueSQwAvqD1rTnV04/vmAOGLBQOC4djCQOo1p/7CZCAKbgC+/yCvfJUiCXJY04EOre7+J0khVgIA+lMtxIAeG1C5CLLAJ0gCBQYsC/C6yDujkWp7PWuassLYnm8AMB0HU8/HCxPGBS4kh0KogMoGCFZdES9J6LkAwXwQun6Q4MxfOGCJ0xJ9yb0vfBxDwJinFD1KncUK6phIVpcWhSZQy4V+FEFEOjCGLQwRtENoH7M8SBK8sczsWWvC38EZBfK4EiZUXEl6FPf8zpwhb7sR/9VWghlKMVwrxSJ4QsEeKAKvWinCWKhghcUlSi1QMphia8szaPVB97Qgb5ESGNo+MICToVDF5rEXBOSYSEDdsqhSed1gkiBBN7wQ6UosV/NPJYrrbYSRGKBiRoDgzD78jgnRO55EujlWNbYLxqcYZxSQGZ/uPCqramSOW0MWATOcAFnss15gnjBCSTQSaUwUlxmIMMYBlCnGXbQn8TUH//wZQYZMoCOSSmaE45GiCGc4A1joZj+ZjlLMnBhDIVCU6BIGkpWnkQFXGDp6C4oBpaG0qQoZcAQpQMyQ6TgBCdQJ1JgyIUL0IMeBfgjAfxpEkAe9aiZA9QAnkqPQy6TOV7/MOpRk+pHAux0LAdL2CGSEIMToAAp10wkU30khQU0sTxZwChy3OUEeBkiAWUtaHLuuUK2sqQBDYxYx/JTTmkpogR5ZclB+WhMv0qBAZVsDhjQE6By0moRiDWrBKvGAMeqRHdSvCRlNHpZRpRgAjHoQB6lQNR6etYkeXPZ6aLTgQNAq7SNSABqJaDFtGJhDGv10QIWx0a5+oUIPYCWYSOhhCdMQLNS+N8Wpktd3r3WntSlLhgG+xoFyEoAMprEC0DghxjwFgAFoCo9EHddKaBXvRBwLWWIcDAnRICjlkiAG1D7htW2168nsK1yQfGCKfgBtar9r19RwAFZOaEI+AWF/xL04IYD91fBJTrBGhzcg/CygwUUPrAEzorh8BzhAIoSQA9gpxgWgGAHbnBDDKhZYsr4gQMBCJMAAsBi0wgiCSUgwg5gPAEa1zgpEyBQD4QkJrv6eBApSIAedEAEIbshqP7F8BuOgOMNLbkIeHjBkxfxAinr4Mxn3sFHSXzdHRxBAe2B0YYOcAMPjfkRL0DAFIgAgz77mQh++KhQ8zMBIjwANNVxj6JxEAI735kSIhjCnilA6UpT+gh9rnCg38BpTkvg058GKlCJcGm2iKY3B6hOEQJwABxsIDGPFkYKPlACEFgBKlB5gK53PZUlrAUIbGkLYQpjmNCcujdFUAAVbjgwBDHHWjEpUAICPOCBDWwgLb4GdrDbQmzDcIAKIxiBFaxQgmY/+9yLEEEaEHAVdLv73fCOd7wDAQA7AA==" +#define PHP_EGG_LOGO_DATA_URI "data:image/gif;base64,R0lGODlheABDAOf/ABIZISAeIhwhLA8jRwYlVSUoLyIpNSkoKwkvbR4tRBUwVDMuNysxOx87Yg89gDo3RTI5SgBCkDg6PDY7RyBCcTxBQz9BVD9ETxxPkQ9SoktIYkROVkpNWDJSeilVhkxObEZTZQVevgBfxVZQZRxcn1BUYFNTc1FXWRZht1ZYVQBm0ghlzBhksVVafyNlqSpkn1hcZwBr2EVfhABs0lRdcF5adRJpyWBcaVlgYl5dh15efh5q0gdw3iFsxhBy2Rtxxhhx0Ttsn2BkigB45SxwtDFwq0dslGNoc1pqfRtz6GRmkypzwFZuiQl772psaWlpiiF25Ax94zB10BB+3iV44BR96yN71TJ5vit7zih73GluoDt6tk53nix66QOG+nBwl0l7r3F2cjOAzSKB9guI9SKC8HF1lW90pm93jTCC3SaE6zWC12F8knR6fHV5gzaC5SmH6ESC3y6H9kGGyiqJ8UuDzXx5oWV9v1aA0nl6qWmAnXl6tHJ8tV6AyVGGuS6K/EyHwyKO/D6J5T+K2SGQ9zqL3ziN9jaP6jmP8WaHwYGCsHqIkC6U/C2V9naFv0GS50mS2IGFuYeHnEWU4iyZ/16P2ISIr1iSz4mLiF2SxV+TvImLlmiSsnqPrIeLvzmc/kOa9Uaa74aNtHWRyXiSvk+a6YyNvIGQwo6OsImTnFib3lKd5l2d2kKi/WSd0k2h9zeo/1Gi8ZSUw5GVyn+czE2m/46bsY2ZyHugwUmr/12n8GCn6pieoGWn5Hekzpueq26n25yby1ms/ICk25ejrlGy/56iymav+V2y+2yv7Wex9KaopWG2/1e5/5Wu2H216265/HW3/qus0aavxWe+/66wvYy33YC4+Hi7+bO0uHPB/aq3wa6112vF/4e/9pfA27u31YDF/XnK/5PG77y/25TI/MDBxYbN/qvH7LfH2qPP+47V/57T/cPN2abT9c3M5Jna/77S7LrU57HV+KLg/7zd+tbb3dbb6a7l/sbh99Hi+Lrp++Pm7+Hx/P3//P///yH5BAEKAP8ALAAAAAB4AEMAAAj+AP8JHEiwoMGDCBMqXMiwocOHECNKnEixosWLFoNpDIaxo8ePwaRJ4yaNHDhw5EySFCnNmEtjt2TJMmXKk01PpmbN+sgTZEly7+7de0eUaMqj4FaKfBlzps1IkfZI3cMnzx5Fnnb23MrQGLig/PgJHTvUZEtjNZ9CXcu2bVSpfPicOaOlrpY8ikxx3fvPGLd3YQOHfUdOWkw+jkaNEjVtquPHkCNLnVtXieUcSr7k5YvRK2DB9wrLctSnUi9dxYpRo6atEy/JsGM7pqskh+0WLXLY0csZYrC/QsOGNubplrNkxWq1Wp6rObNu53y5kU2dupbaLUxob5FHVu+Fxsj+kb3HzdTUc/TonWtWrLnqXMWaiQvnC031+7LPKMn+4YOGJ4p8Z1BJRA0ljSeQ1XMOPOt00wx7xYhDjWrinDNOEFzQwgd+HEamnwkahGiCHQL+QyBR4MgSWzjw0CNOM+4xKN868FhjhB/PqIMON844c8spp6zlSSSexIXYUx06pkULGlhggQZfcObVUdK8FRs70NCzDnvNUeNgN+vQ4w4XfvSizDHIQAMNM8LooosyaWqDDTbhhOPNnc9g88www/RIHH5nMOmkBiT2FNJRxuBXjzAMTghLK/IVAyY843TgAhaHIKIpIXDQgUgjhwjySCijllLKKrqssssuqaqaTDL+e57CYQ4WPPDAB7x15BdKxlgp2zi9JBPLOetQkwsssBTTYDPwwMMOBSRYgQghdMhRxrVl0AHHG9xuO0UWghRSyCOlTCJuIZNAoq4qwMh63xkm2LrAExiFNFKV96GzyyOICPNIOfRQs9wnucCjTTf07OMOBREAQQcZZXhRxcTYUmExFVFEkUUWaXTscRqhlDuIGGJA0ssoHGqhwQILWJCrRPZKo+J9z5xpCBnUNtrKJwTjc4426bHTQQQzVHFtFU00AUUXEw8BxRBUDBHFtnAIksYUVpOLzDGpTjLIIJA40mEOD7AcJczGtORrbJ48E8orn8jhhRyv4AMPMrBQAkv+M14ijI/QRHeBLdJdMA3F0jzwAIUPb2iKCBwbTwHHI6PqEoub6c6xYcoWHHCADhEF49LM1UWyCyigEMIIIYY0EY56xeycCzO5NAP0PoDPEDG2XSR9eBeHQ8GDD3CUk4862AgD+cZZwAHHIY/EEssqkGjeIR8aeD7CQ6L/eZ8jlWg6hxVkQFxFi8bunOze4tCDzzgNOFB0E9c2UcUYSRd++BA++JCFPm5wwjLKcQjnZcEHQJjcuB6BKl2oQmwdMoHnNNAQWdyiV/iJRB2yoAY1vOEFVbBWFegBD3HkYjmtaI+X4PG++PmgfnKIobXKEDWnDWF4abgHBwzgBG/AQXL+kANCGg6RBitYAQtrgMQqVgFBDrXgAAGgoEJkcou1xeYWdZjCFKKghiqQQAr4o0N61hG7T+gtF+IQBz7wYQ0FEG0M12IEz0DBM001QlNU8EEa2nEBA7QBG5ATxLeAgMRChGINP0jkD7AghkQ08T4tCEAAapCQWZhCFgi6zyjWIAhr2MIFQ5DaD4bQBUS4Dx7NeJQZYQGdfdDjGQOIQAzo14h5yCMf+ahHPfIhj3ZsQx7QgMMg2jEBAbQBecd4xSOIuIZmkguJWFDkJWiRJA1IslAFmQVOMkmdSFxiDYfQhz/8gYQodMFpwAsFPlzZjJ0xohVoPMc+4OEKAkSACnL+IMQxsnGBC3DgnyXgwAYusIFslGMV1SjmAU6AAzfwIh3YCMUkelEKcj0CXWuI5hzmYA0ryuYBATiAdwqSlvvwQRVYyMI8xumPVKTBaEgrwzHWCI/YMeKdxdBG+9jBBQJkoAqBQAQ2NlECGJSABjCgwVEDygBzeGMTEyiAAUrQTwYUIAzeCIUtiPGNZ+jCVI9Iww/EcAlX+OIWHDoDFLdHkFkQyaORuURKB5GCaoxTD4gog7WaMAZvjJE9rUjWg9JTKQKggAyMaEQ53FDUauAyl/r4RQkY0AZ+HOECASBGNX7BWAEAYBGlYAJBcRAGTGBiG8oQK1kzwQpSbK46JpD+5MuGBFfI3AELQKBCEAxQgHbYwwWNKB+22JEeF7WHldQIEzy8kQAEZOETO5sHDU5Qgm08QxiNgEMhzFGCAlTgHiWYgATycad52KKYJ3gGCATAgA1woJ8GwEQpevCDQQACEHMwqzPuA0Up/sOttX0MH3oAhBn4wAPTOAANNpEFMuyVfuxoETy6cSxJSXgdroglHGbXCnnQwA1HSIcyJhaFQqSjuwzYBgcYcIRywCENkPhFAQBwAmJ+Nh7TIAYaeAsMIPRADHPwwxKuAAhXkOIUpJNMJAMwUvMEeCoDtsEKVjADEhQgAAIggRrIUIXCNYEM7KARPNIHC3Gs48zhkIH+YUEhDIGlgwM3cIMtjlEFKrzhEe1Y8QIka4BFxEINgngGGjy7iGp4Fhe64Fo8DAAATkyhB1iYQxBcsAQiXGELW8iENcwjmTNIkl7/ePJUPLEEKatABTsAAgUSgAE43OxavVMDO85h5mZANxfJPbM3GoCANLyiGMyAxDQ4AINNWEMYhEDEIdTxiwsU4AhouIAAqoEINWTBGRAAAAC2MWgGJEOZj7hEAgDAhTSgAAtXeIELWMBuEpCACJl2RqIiY4EoCsSkgOjBCmIQgx34GwiF4CAhhHutRqwjjetABnRhQawzZ2IAGXiFMNqjilT8MxvooAYzoMGObBxhAgywBxL++oiODmahE4xmQDuyvQFtvCIUhfCDZzlxiB8sYQ5bIAG7WeBuF5CgCGDwAy6SLJUPBGAB967OKbBggx3wIAYq4PcOfBAFOljdwVXwAjPCcY5uSCgXyulGs8rRAQLUgRlsyoU30MCBEpjjHubYBjGcQGwIpOIeMJjABp5BBzVYAQmePcI0ZkwMbQgjFpDoxKHhIIYrXKEIL3gBEdTtbgz8HNOcgIwSJCmQ18LGE3MAwgpUwIMh8LvfPqBCsgcOMTLQ6WDnmBB75lOODDsgFhpnRivmAYK2X4AGE7hA8IvqhnhUY8Vt8IYa6FAHC2h7G0gAwAbkMQ49pYMGAJAAKwT+MYgrECEIHog8vOHt7hcUYQuZf8zmA/Df6owCC1OOOg/KUIWnx2AIjYCbIT5BBkNwHRoVcg7MkFPUcA7eUHZigAy0Iwy5IA8QAGdHAGJHAAMw4AbbMA+PIAkcMAG8UA5UoAaJwGgXkA7ZJgG8cIK8AAOYlQrmMgiWFgQyAAZbQAQu4AKRB35BEARbgAvqx3n/EBeyUQdSIAKoFgM+MARkoAZPFwWH8AqtMC37Bw3noCZmdg51Uid+AHG6gAwMWAu5sA0TcAMlwA+5VA/zEA/qcAyIUArtQAzEcA/XQAVwgAsW0Ge2IAEAwADvBVAX0AbPUAhgA29GgAZ2wARgAHn+JPACYLAhlsAFXOAr6ycQZ+B5kDEKPzADoxcDw/OBZaAGqfcKyAAKzNEKwhAOycMiB5cM4QAMCuAAk6ANtOOF0PALxOYG/XAMn9B3VmcI1vYK0VAO0QAKQwAH4xAP98APSMBb9rANqbAIbpAK1gU9I+MCWyADViEVXAAGL+ABMiAKsBGJP0iJjnEKYtB0UcdvPEAFj1MGQ6AGsRAO0KANasIMyKAM2nAMUpgMu6AKl0ABCPADCrgzlNAKi1UCJbAJ/SAMhlAG+1M+VJAtjUAIVMADnggEVkAKHCAAOOANwrAL3lAOyhAKhyAujQdvLeAYkZAJWwAGRgAGcGV0SPf+D3twBrBBCz+wbzvQb5rYjocACogQCsKgDcmgDXUiDtCADLrQC7twCYDgARRAAAhgA8sBC59wU69QDzTQdsSQD7kgQkNQBWRAB1FTOFUwAxTpAzbQA53AAABADNAACj8EB8o2koUwB5dABGBwkpDhB2DABeIoFfUmRZ4wF5FhCnNgAyIweudYenCgBqUQC6FwDMpwCZcQDuIgj/QoBhjgAAiAABGAAoeAQq1ACYxACbnQD8SQCr/AD+wACnJgOF0gB0l4Q1BABTuAhFQABGswaAXwDcIACm8ABEAgOWmALqswB98nBJEBhJ32aQIxC3MhjqfwAzbgA5mYOFDzBnD+AIqxIAzQoApqgg0AGA7FgJRr0ANWIIrKwTNVeVOtcA7lwA7qUA6toFdlADwhlIRwIDw8MAO46QOq4EvtgA1PSAVU9i1TAIjdRwQyQJMdsmQjJZOE+RiJgJgr4G85eYRcBAehoAxvogtzIJnHsHU/U570CAqUMJDtGQgsGghyEAipwQgLKTiFwwP0Y3VUUAVQwG/0wz9AEAq6IAwF6gMxMAPDmQZYMDLw9gFJsgf91VZa4KCOIQYhMGX+dkOpJwiv0ITSswu9sAXKoAxrwnVT2Aq0U5Us6gVj4AV/4AVuOgayWQZKMzFQwJD2Uwaf0nemN0sMOQPVyYSgoAZRMAT+MzADWWBESep9QWACSRJbAfAy/6AIUeoYjrAEISACiTkDVAAFHVQ1QJoqqpAJXHAJpRCPxGKFDLgzaKqmY7Cmc+OirZo099llWVcGhNAIPlkFQ5CTE8MDK2ADUfAKjaAGX9mffmoDRyQGRFAEMpAkahUAbAWlkyoVpmCpU9ZviVMFzgMKoTA9quAHIAABMgAJukAnVmh4yqGqjOCmavoHbeqmMeQFhuAFSUM/clAFt5o6N6QCsUkGUGCkbNYKXMY/MxACBktfiiql+AFSInUQplAXm3MLV2ChM8BvnKpsoCA9q8AKIBB8MNAJvYCU0BAOsEg7N0WagcCmf7CmcqP+pl4AMU3AA0nQBHNDBqCAq4SgBjwKMTxgA3Bws2QQCOwIBDZgsCGAAijAAkSgBNV0TQkhqVowFXOgb5m4A3KIOofQravgCv2EBlFxCqzwJtigDfIopGj6B4HgroHACHLQpoaAPxGTOE0gm4QgiohQBToLBS/bBf0JBy5KCOzoA/SFAkeLtCwQBEmyZJSkEHlQF1LhCjeZiUaoBoggCC9WCKWgCRNgBo7BB6OwC8rAdfLoTmzrru46BmjLqknjBUkws0GLq69QbVRQNLLZBLs6BNlSBVNjBT2AtL7LAi7AtE4kSf7FuHWRB7TAdIrJb4VKdVlwCLqgCRcQGZ+rU/D+eEJoOgaBsKauCqdkUK/1ijOgkAtwmUcvVD4xW3p0ADxRAASYerRLkAEZcLgRRLwP0bhaUK02UKinJzwW8wbQK72SMQracK4Tdyw8Q7ot6qJyUK9dVgafAAqxCwdRcIQvS69OYzQ8oAJWWqg2sAQukAFXcI3VcQb1Zm8QIamKMLGYuJMTmXocmgycML2S8QxXCA0a1x7tWQvIgAyyA13r6gVlkITQlSkV/JDcGzx1+nSh5KOEdAUukAj4oQQLIEmLGxGm8AWQ0AP7u2+lJ4eI8AqSKcCScQrnYIXUIAxww6JoGwitADe31go3VZVPyK2QY2CqI1zAMwR0QH+h9IH+U1CckxBk3ghbUHQAZzMRwcAKkXuhBna1r/AmmUDDNUyy2oAMuVCVbfsHhCAHhvAHMbS2awu7W3oIUmADWYAIrdAImlwGjdAIgWAIA2d1zyNRG8uD1KEEIBUAEgCpEjEOa4CJ+5Z6VysM9QgMG/CXUvEM2kANOCwMtcAIaXtT0iw3oMyilEAwuRAKoVBEaTC+ckzNN5VPrEctcNAIo7IKyYDLsKEFJzxJHjEIUubFX6nKbaIMwEADlgAbySMMbCIM0tyiN+WibhrL7vnGsaAMkDAIsXAMwgCUzQE30izN5UMHyQYqDJQMvgAbfPABUBQALvMRqmAFhXqbH6jKDo3+DL2ABJIgGXygDasskC1qCIbwogu8ttCVQuWpDZegCvdYCkRZtlXpYMJl0VGgbJfTC8DwGKjAByrz0QuQyB6RDGlQqM2rBuf8CpezC5xwBPy8xmRwzS4a0HLzou7phWhXjy/ACspQCshAlOGgxmgaCLOJt3J4CKai1L5CK55zAPPCFX/opzPgb1RXy6WwC5oAA9z0GL0Qzg7WtgtsCGlr0+8kDJYdJx6wBazQCw7NDNpQC+tJCSwqm4aAMbU8CaowCuahBR/wAH39AKC2F5NAtBc6dVQXBYJwKq4AA5bwl6uQOgHNrnJQzaBs1gMZ0bmgDcrQAAPgAZcgppg5MIb+cFMQcy1yuAZ9cAd7oAXxsgB9PQLYxBeQUGAVW7H9EwVTcNjAUAJfYBdS6gmlgAhBG7RuSgij3bY2nc21wIC58ArQoAsNoAAYAAbQIJ7Q0B7qKt9VkAXYLRc50Nos490W8ARa8R2qQJ3XqpPEk9DJgARmYBkgXheTeAd9sAZxoAbWPDdqet9yBE8nlAv/TQEUcAWqMLbNDM2fQDl4kN3bnQMmUCtlwzIT7su9AbnzvLw+MAXKgA3JwAZu4FZ5AOJSrgQifgYk3gd4YOLc4jgRLJqX45R2yQp8MgqOsCHX4eNNAuS28gA18AVEXiLleKmJqQIGlgXlus4wQBCmoAjAUT7lII4ZVO7eczHohG4X13EZ2hEiTrLotWIBbR4gJaIQl0C4mBp/SV4KSQkMOIAQ2pQHefAFthHqop4DuIEb2nHq2tEf/REirM7oJqADAFLhkc4QlI6pdH6kupAMu+0QlhQJdmAHX/AF2JEdqJ7qqq4BH6ADuBHseCHrs/4QkEu4iJlqFrkGk8AKrrABPEETkfDmz94RgEC4IWCkVpAG4eKlmiAB377uFeEKS4ACNvADQpQG5LILwMAE7J7vAhEQADs=" +#define ZEND_LOGO_DATA_URI "data:image/gif;base64,R0lGODlhcQBIANUAAA0NDgEDBgIFCS5EXhUdJwUPGgQKER0rOgABAgkZKiZpqxhDbQ0kOwobLQkZKSNgnSBXjh1PghpGchQ2Vx1NfAoaKiJYjQoYJgsaKQECAzdQaS0/UTE1OQUPGAkaKh5ViiFclRpJdQocLSBZjh5UhhpIcw8qQxc+YwwgMwcVIQkaKQgXIwcZJTM6PwIEBRkaGjEyMv9mAP///8zMzMfHx7+/v6urq5KSknNzc1VVVTw8PDc3NyYmJgcHBwMDAwAAACwAAAAAcQBIAAAG/8CZcEgsGo/IpHJ5/DGf0KiU+Ks6p9Kr0KrFer9GbReM7IrJ6O95Zt262durUy5uD8/rtL58h7vlf3+AcHlsdoR7iU12eIhzbXVVfpOTgGOKiWNrkpKUhZ99iJijl4d5kFSdXKmdb6OvsFOXsbS1oba4ubq7vL1DNjg6ODW+xVg3OTw/AisCOMbQSsA6AD8FDAsjIwwv0d5DNcnLIhMU2uclPzbf3jwC2Ofx585MwTfssD8n8vwjKDpLcggo8OMZPkw8GPSTN6HKCxg5hhHJ8WOCv4IHFeEwsDAeiQULJjBYUQXGM4oWtTU0mDGNjR/mOi48gcJKynMrW+oBcFNmP/8SJnri/JFDJ5kaL0T4XLqwYVGjWGy8MFCCqVWGRKFKsQGgAImrYIc+1bqEq9ewaEc0vEc2CdKzacOmY9vWxjoiMAx81Sajr9+/MhaE2Iu2hAAexPraJUbGxo3HkB/f/XKjCgBhwH5kOwcYsAoU5dKSMIBYSN8cOSZvxRGjtevXOnREZDwFhogSE1AYqKIwXl8VBlKoUNHXgAEUJwhfJVGgtGkZsek+Afa6uvUY0bFUjEdhgnJtIUwwmLDAb4cU3tM2pz2jb/YnN67Lr/4eSuWYPkmEGDyiL4MODITgm1+CkdBZgSh00xkMOkiHRHzWxSahDvNJyN4SG6HV1wSfJcf/GWAMdObfCQv8IOILDUoj34QTrhgbS0zAgEJYfqGgQnp8yXACA8N9NkFfHQRX4wl+6cADDH2h6KBdz7jIYosRShjFdmD5B6CAH/JIHkgh9JUCeuXJAOBpPDTYF4MO4mDCAU5KmMMNxNDAWpSx2QdTlTJwiNxeIhbYnwzDZeMlcTLAAAOc7qVIxAsVsrjkdRNCkeFVNd5ImIgqmCDgbyoICiihZd5gQ189KDoDDTcYcN1lE+JAgxE2QCrlEzLi+V+Af+4XpnHCafpnoL8SWugNOwD5gqg4oMbDCtahkAGD9RUBIX2xjbUElUyJ6BcDJoQJ2AldfuppoCJe0IEOB5hw/wIEKFRQnQgesJrDhUTI+iJ8d2arbXGdjhDub6BxOm6nJvzVwMEMSCDBAw+AwIAHr3kgQgdl5vAqEjXYq4NqSeAgAFjd2djjyL7qJ9JwDCQXnq/+mqBpCQXsWIEHKVPwQcMgOOyAaw4k0EAKGCmhsbVKVLbCBFUtte+GC+ylH5df6cffCFIbKAMJJ5A4GARcdz2BA2CH3YAIDABA7y8aO1g0NeOEttDSgLJMowwuh9D13VwDFTbYCZjQMEBIDO3FNACY0NFvwY3M72ZoLWCACRTgLfnXYTPwAQgKmFAUDjjQ1SbHtfXWz29gggSSSHKHRcIKJkAAguR4R/C1CJFD8P+AAiykABoCQrQJoxc4FHC4uPLod+DUfxI4mF8O/AhYgXj/JdjNEUSgwAMY1ECDxjpcDEZl330IrDzapvyViCn7FUD5yXXdWcqXg3D7CdPCNqHaWNSA7YDPIw+kkH1BTo3OA6QA9UUAIvhfCoZEAgj0ZUdhA03tRvAAEvhuDzpQCj8wJTcvgamAVgqYDIQTpgIkcIQfFFOAHCgDBjTPdFvj2gPaRDQy4CBf5JMBr4bTQeINinTe+U0BCiYDBzSgL2BbAAtT4IA+xbBrIODe2cDwghltEIVb8p8PPyWwPxlAAERsgAeQ6AAlklFEDtAUFKNIp9iADlXJQs2bbuA9Jdz/ED/i69eHwgUsTvkFPVb7QQUk0BcPNLGIZWRhEsPFqzTazXUzbKOphBCrNnaujkUwS/jgFqItkqszCKDdGRFpRlJa7VuDiaQliVBJ7t0LVl0JX/K0ZYAuCuyUfrEGBUaZREUmEgL/KiJoIqBKagljCPUz5pN+N4MaxLIj4RmZNINSN/BUE2s86gsADBABEJSgbit7ZDjzFgKRgC1lEJgPdiw2g2Ta70lvOkINeACXhTzNdPgUDAX24zR+asN4MjiSAS73AX5WjZxPhMA9Q/ABdbYGVY1aJuiGsBFZxqUjhhFGDlwgP4aN4HWwC2nXLOjQiLJIInbUy0Wt4pQa2IUH/ydQwARmKr8RiDSkJW3T/TCJMXpadKX/ZEBWKEqAFgDgBjCYgAJAetO75VSZjuKpEuYpgKQBlR8lYqZdhsCBhTG1qSR96pMkREcvUNWq/CBPXOixBA5QIGdN5dpTsTPWBkk1CmftR0N+YACkhUUEgJOGD0jwVa7l7LCvy2ld33TXKeQ1HiuxQQ5eUIUVoEBdS5kAAJ7gghM84G45Y9jtSgCCCHjAA2PzwGHqOqF4KuKxagkaJTmngxcIzycU+AH+iFADFCwVtCAgTwRQEIALQEAEIlBBB15QJtbKZrdpqAEMqhrbGiIThx0pgHWJgAMJ/NawDxhADzj3DBioSwQGAIfADpyLUloIpCbbHQJPlsIAGCxhBxa4HcM6at865qCcRFlsWXORA5MwIYMyWQADBBBfIdzgBRpAwVtvpzkjhCM1lHQMZKb4DY/xozsiEMAPeNDeJNDAMT/YwAkkwICJcpgsL9mMgglyGRxMlAmiAoCN2zIFeoZ4xK6NLo+nYIMX3XjISNZKEAAAOw==" BEGIN_EXTERN_C() PHP_FUNCTION(phpversion); @@ -85,4 +84,3 @@ void register_phpinfo_constants(INIT_FUNC_ARGS); END_EXTERN_C() #endif /* INFO_H */ - diff --git a/ext/standard/link.c b/ext/standard/link.c index 80ca52b7fa7b2..8da63958a7ba2 100644 --- a/ext/standard/link.c +++ b/ext/standard/link.c @@ -55,11 +55,11 @@ PHP_FUNCTION(readlink) { char *link; - zend_str_size link_len; + int link_len; char buff[MAXPATHLEN]; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &link, &link_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &link, &link_len) == FAILURE) { return; } @@ -86,11 +86,11 @@ PHP_FUNCTION(linkinfo) { char *link; char *dirname; - zend_str_size link_len, dir_len; + int link_len, dir_len; struct stat sb; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P", &link, &link_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &link, &link_len) == FAILURE) { return; } @@ -119,14 +119,14 @@ PHP_FUNCTION(linkinfo) PHP_FUNCTION(symlink) { char *topath, *frompath; - zend_str_size topath_len, frompath_len; + int topath_len, frompath_len; int ret; char source_p[MAXPATHLEN]; char dest_p[MAXPATHLEN]; char dirname[MAXPATHLEN]; - zend_str_size len; + size_t len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "PP", &topath, &topath_len, &frompath, &frompath_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &topath, &topath_len, &frompath, &frompath_len) == FAILURE) { return; } @@ -177,12 +177,12 @@ PHP_FUNCTION(symlink) PHP_FUNCTION(link) { char *topath, *frompath; - zend_str_size topath_len, frompath_len; + int topath_len, frompath_len; int ret; char source_p[MAXPATHLEN]; char dest_p[MAXPATHLEN]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "PP", &topath, &topath_len, &frompath, &frompath_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &topath, &topath_len, &frompath, &frompath_len) == FAILURE) { return; } diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 2b19a309feb6d..4c243f778f17f 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -250,7 +250,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char if (mail_log && *mail_log) { char *tmp, *date_str; time_t curtime; - zend_str_size_int l; + int l; time(&curtime); date_str = php_format_date("d-M-Y H:i:s e", 13, curtime, 1 TSRMLS_CC); @@ -328,7 +328,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char sendmail = popen_ex(sendmail_cmd, "wb", NULL, NULL TSRMLS_CC); #else /* Since popen() doesn't indicate if the internal fork() doesn't work - * (e.g. the shell can't be executed) we explicitly set it to 0 to be + * (e.g. the shell can't be executed) we explicitely set it to 0 to be * sure we don't catch any older errno value. */ errno = 0; sendmail = popen(sendmail_cmd, "w"); diff --git a/ext/standard/math.c b/ext/standard/math.c index c0a8edd9628eb..be2d655263f13 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -794,7 +794,7 @@ PHP_FUNCTION(rad2deg) PHPAPI long _php_math_basetolong(zval *arg, int base) { long num = 0, digit, onum; - zend_str_size_int i; + int i; char c, *s; if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) { @@ -803,7 +803,7 @@ PHPAPI long _php_math_basetolong(zval *arg, int base) s = Z_STRVAL_P(arg); - for (i = Z_STRSIZE_P(arg); i > 0; i--) { + for (i = Z_STRLEN_P(arg); i > 0; i--) { c = *s++; digit = (c >= '0' && c <= '9') ? c - '0' @@ -840,7 +840,7 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) { long num = 0; double fnum = 0; - zend_str_size_int i; + int i; int mode = 0; char c, *s; long cutoff; @@ -855,7 +855,7 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) cutoff = LONG_MAX / base; cutlim = LONG_MAX % base; - for (i = Z_STRSIZE_P(arg); i > 0; i--) { + for (i = Z_STRLEN_P(arg); i > 0; i--) { c = *s++; /* might not work for EBCDIC */ @@ -1098,14 +1098,14 @@ PHPAPI char *_php_math_number_format(double d, int dec, char dec_point, char tho } static char *_php_math_number_format_ex_len(double d, int dec, char *dec_point, - zend_str_size_size_t dec_point_len, char *thousand_sep, zend_str_size_size_t thousand_sep_len, - zend_str_size_int *result_len) + size_t dec_point_len, char *thousand_sep, size_t thousand_sep_len, + int *result_len) { char *tmpbuf = NULL, *resbuf; char *s, *t; /* source, target */ char *dp; - zend_str_size_int integral; - zend_str_size_int tmplen, reslen=0; + int integral; + int tmplen, reslen=0; int count=0; int is_negative=0; @@ -1171,8 +1171,8 @@ static char *_php_math_number_format_ex_len(double d, int dec, char *dec_point, * Take care, as the sprintf implementation may return less places than * we requested due to internal buffer limitations */ if (dec) { - zend_str_size_int declen = dp ? s - dp : 0; - zend_str_size_int topad = dec > declen ? dec - declen : 0; + int declen = dp ? s - dp : 0; + int topad = dec > declen ? dec - declen : 0; /* pad with '0's */ while (topad--) { @@ -1219,7 +1219,7 @@ static char *_php_math_number_format_ex_len(double d, int dec, char *dec_point, } PHPAPI char *_php_math_number_format_ex(double d, int dec, char *dec_point, - zend_str_size_size_t dec_point_len, char *thousand_sep, zend_str_size_size_t thousand_sep_len) + size_t dec_point_len, char *thousand_sep, size_t thousand_sep_len) { return _php_math_number_format_ex_len(d, dec, dec_point, dec_point_len, thousand_sep, thousand_sep_len, NULL); @@ -1234,9 +1234,9 @@ PHP_FUNCTION(number_format) long dec = 0; char *thousand_sep = NULL, *dec_point = NULL; char thousand_sep_chr = ',', dec_point_chr = '.'; - zend_str_size thousand_sep_len = 0, dec_point_len = 0; + int thousand_sep_len = 0, dec_point_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|lS!S!", &num, &dec, &dec_point, &dec_point_len, &thousand_sep, &thousand_sep_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|ls!s!", &num, &dec, &dec_point, &dec_point_len, &thousand_sep, &thousand_sep_len) == FAILURE) { return; } @@ -1261,7 +1261,7 @@ PHP_FUNCTION(number_format) Z_TYPE_P(return_value) = IS_STRING; Z_STRVAL_P(return_value) = _php_math_number_format_ex_len(num, dec, dec_point, dec_point_len, thousand_sep, thousand_sep_len, - &Z_STRSIZE_P(return_value)); + &Z_STRLEN_P(return_value)); break; default: WRONG_PARAM_COUNT; diff --git a/ext/standard/md5.c b/ext/standard/md5.c index bee01ba778c97..7fea069dbb350 100644 --- a/ext/standard/md5.c +++ b/ext/standard/md5.c @@ -47,13 +47,13 @@ PHPAPI void make_digest_ex(char *md5str, const unsigned char *digest, int len) / PHP_NAMED_FUNCTION(php_if_md5) { char *arg; - zend_str_size arg_len; + int arg_len; zend_bool raw_output = 0; char md5str[33]; PHP_MD5_CTX context; unsigned char digest[16]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &arg, &arg_len, &raw_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) { return; } @@ -76,16 +76,16 @@ PHP_NAMED_FUNCTION(php_if_md5) PHP_NAMED_FUNCTION(php_if_md5_file) { char *arg; - zend_str_size arg_len; + int arg_len; zend_bool raw_output = 0; char md5str[33]; unsigned char buf[1024]; unsigned char digest[16]; PHP_MD5_CTX context; - zend_str_size_int n; + int n; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|b", &arg, &arg_len, &raw_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &arg, &arg_len, &raw_output) == FAILURE) { return; } diff --git a/ext/standard/pack.c b/ext/standard/pack.c index 9f6a9e5cf43ea..672c0652219b0 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -69,7 +69,7 @@ char machine_little_endian; /* Mapping of byte from char (8bit) to long for machine endian */ static int byte_map[1]; -/* Mappings of bytes from int (machine dependent) to int for machine endian */ +/* Mappings of bytes from int (machine dependant) to int for machine endian */ static int int_map[sizeof(int)]; /* Mappings of bytes from shorts (16bit) for all endian environments */ @@ -84,7 +84,7 @@ static int little_endian_long_map[4]; /* {{{ php_pack */ -static void php_pack(zval **val, zend_str_size_int size, int *map, char *output) +static void php_pack(zval **val, int size, int *map, char *output) { int i; char *v; @@ -109,7 +109,7 @@ PHP_FUNCTION(pack) int num_args, i; int currentarg; char *format; - zend_str_size_int formatlen; + int formatlen; char *formatcodes; int *formatargs; int formatcount = 0; @@ -126,7 +126,7 @@ PHP_FUNCTION(pack) convert_to_string_ex(argv[0]); format = Z_STRVAL_PP(argv[0]); - formatlen = Z_STRSIZE_PP(argv[0]); + formatlen = Z_STRLEN_PP(argv[0]); /* We have a maximum of format codes to deal with */ formatcodes = safe_emalloc(formatlen, sizeof(*formatcodes), 0); @@ -186,7 +186,7 @@ PHP_FUNCTION(pack) SEPARATE_ZVAL(argv[currentarg]); } convert_to_string_ex(argv[currentarg]); - arg = Z_STRSIZE_PP(argv[currentarg]); + arg = Z_STRLEN_PP(argv[currentarg]); if (code == 'Z') { /* add one because Z is always NUL-terminated: * pack("Z*", "aa") === "aa\0" @@ -332,7 +332,7 @@ PHP_FUNCTION(pack) } convert_to_string_ex(val); memcpy(&output[outputpos], Z_STRVAL_PP(val), - (Z_STRSIZE_PP(val) < arg_cp) ? Z_STRSIZE_PP(val) : arg_cp); + (Z_STRLEN_PP(val) < arg_cp) ? Z_STRLEN_PP(val) : arg_cp); outputpos += arg; break; } @@ -350,9 +350,9 @@ PHP_FUNCTION(pack) convert_to_string_ex(val); v = Z_STRVAL_PP(val); outputpos--; - if(arg > Z_STRSIZE_PP(val)) { + if(arg > Z_STRLEN_PP(val)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: not enough characters in string", code); - arg = Z_STRSIZE_PP(val); + arg = Z_STRLEN_PP(val); } while (arg-- > 0) { @@ -496,7 +496,7 @@ PHP_FUNCTION(pack) /* {{{ php_unpack */ -static long php_unpack(char *data, zend_str_size_int size, int issigned, int *map) +static long php_unpack(char *data, int size, int issigned, int *map) { long result; char *cresult = (char *) &result; @@ -514,7 +514,7 @@ static long php_unpack(char *data, zend_str_size_int size, int issigned, int *ma /* unpack() is based on Perl's unpack(), but is modified a bit from there. * Rather than depending on error-prone ordered lists or syntactically - * unpleasant pass-by-reference, we return an object with named parameters + * unpleasant pass-by-reference, we return an object with named paramters * (like *_fetch_object()). Syntax is "f[repeat]name/...", where "f" is the * formatter char (like pack()), "[repeat]" is the optional repeater argument, * and "name" is the name of the variable to use. @@ -529,11 +529,10 @@ static long php_unpack(char *data, zend_str_size_int size, int issigned, int *ma PHP_FUNCTION(unpack) { char *format, *input, *formatarg, *inputarg; - int formatlen; - zend_str_size_int formatarg_len, inputarg_len; + int formatlen, formatarg_len, inputarg_len; int inputpos, inputlen, i; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &formatarg, &formatarg_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &formatarg, &formatarg_len, &inputarg, &inputarg_len) == FAILURE) { return; } @@ -551,8 +550,8 @@ PHP_FUNCTION(unpack) char c; int arg = 1, argb; char *name; - zend_str_size_int namelen; - zend_str_size_int size=0; + int namelen; + int size=0; /* Handle format arguments if any */ if (formatlen > 0) { @@ -677,7 +676,7 @@ PHP_FUNCTION(unpack) switch ((int) type) { case 'a': { /* a will not strip any trailing whitespace or null padding */ - zend_str_size_int len = inputlen - inputpos; /* Remaining string */ + int len = inputlen - inputpos; /* Remaining string */ /* If size was given take minimum of len and size */ if ((size >= 0) && (len > size)) { @@ -692,7 +691,7 @@ PHP_FUNCTION(unpack) case 'A': { /* A will strip any trailing whitespace */ char padn = '\0'; char pads = ' '; char padt = '\t'; char padc = '\r'; char padl = '\n'; - zend_str_size_int len = inputlen - inputpos; /* Remaining string */ + int len = inputlen - inputpos; /* Remaining string */ /* If size was given take minimum of len and size */ if ((size >= 0) && (len > size)) { @@ -719,7 +718,7 @@ PHP_FUNCTION(unpack) case 'Z': { /* Z will strip everything after the first null character */ char pad = '\0'; - zend_str_size_int s, + int s, len = inputlen - inputpos; /* Remaining string */ /* If size was given take minimum of len and size */ @@ -743,11 +742,11 @@ PHP_FUNCTION(unpack) case 'h': case 'H': { - zend_str_size_int len = (inputlen - inputpos) * 2; /* Remaining */ + int len = (inputlen - inputpos) * 2; /* Remaining */ int nibbleshift = (type == 'h') ? 0 : 4; int first = 1; char *buf; - zend_str_size_int ipos, opos; + int ipos, opos; /* If size was given take minimum of len and size */ if (size >= 0 && len > (size * 2)) { diff --git a/ext/standard/password.c b/ext/standard/password.c index b16ca71c0d456..212799100c303 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -87,7 +87,7 @@ static zend_bool php_password_salt_to64(const char *str, const size_t str_len, c if ((int) str_len < 0) { return FAILURE; } - buffer = php_base64_encode((unsigned char*) str, str_len, &ret_len); + buffer = php_base64_encode((unsigned char*) str, (int) str_len, (int*) &ret_len); if (ret_len < out_len) { /* Too short of an encoded string generated */ efree(buffer); @@ -354,12 +354,12 @@ PHP_FUNCTION(password_hash) if (options && zend_symtable_find(options, "salt", 5, (void**) &option_buffer) == SUCCESS) { char *buffer; - zend_str_size_int buffer_len_int = 0; + int buffer_len_int = 0; size_t buffer_len; switch (Z_TYPE_PP(option_buffer)) { case IS_STRING: - buffer = estrndup(Z_STRVAL_PP(option_buffer), Z_STRSIZE_PP(option_buffer)); - buffer_len_int = Z_STRSIZE_PP(option_buffer); + buffer = estrndup(Z_STRVAL_PP(option_buffer), Z_STRLEN_PP(option_buffer)); + buffer_len_int = Z_STRLEN_PP(option_buffer); break; case IS_LONG: case IS_DOUBLE: @@ -368,8 +368,8 @@ PHP_FUNCTION(password_hash) MAKE_COPY_ZVAL(option_buffer, &cast_option_buffer); convert_to_string(&cast_option_buffer); if (Z_TYPE(cast_option_buffer) == IS_STRING) { - buffer = estrndup(Z_STRVAL(cast_option_buffer), Z_STRSIZE(cast_option_buffer)); - buffer_len_int = Z_STRSIZE(cast_option_buffer); + buffer = estrndup(Z_STRVAL(cast_option_buffer), Z_STRLEN(cast_option_buffer)); + buffer_len_int = Z_STRLEN(cast_option_buffer); zval_dtor(&cast_option_buffer); break; } diff --git a/ext/standard/php_filestat.h b/ext/standard/php_filestat.h index 510ad208e8cd6..e8e798c510262 100644 --- a/ext/standard/php_filestat.h +++ b/ext/standard/php_filestat.h @@ -83,9 +83,13 @@ PHP_FUNCTION(clearstatcache); #define getuid() 1 #endif -typedef zend_str_size php_stat_len; +#ifdef PHP_WIN32 +typedef unsigned int php_stat_len; +#else +typedef int php_stat_len; +#endif -PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, zend_str_size_int filename_len TSRMLS_DC); +PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, int filename_len TSRMLS_DC); PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int type, zval *return_value TSRMLS_DC); /* Switches for various filestat functions: */ diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index 0fb27baacd8e5..f8d7bda482385 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -157,8 +157,7 @@ static void php_stream_apply_filter_list(php_stream *stream, char *filterlist, i } /* }}} */ -php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, - char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ +php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ { int fd = -1; int mode_rw = 0; diff --git a/ext/standard/php_fopen_wrappers.h b/ext/standard/php_fopen_wrappers.h index 366a1295b3c2c..5f78256bcb423 100644 --- a/ext/standard/php_fopen_wrappers.h +++ b/ext/standard/php_fopen_wrappers.h @@ -23,8 +23,8 @@ #ifndef PHP_FOPEN_WRAPPERS_H #define PHP_FOPEN_WRAPPERS_H -php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); -php_stream *php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); +php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); +php_stream *php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); extern PHPAPI php_stream_wrapper php_stream_http_wrapper; extern PHPAPI php_stream_wrapper php_stream_ftp_wrapper; extern php_stream_wrapper php_stream_php_wrapper; diff --git a/ext/standard/php_http.h b/ext/standard/php_http.h index 2b4cca59a8824..468fd0508cc33 100644 --- a/ext/standard/php_http.h +++ b/ext/standard/php_http.h @@ -25,9 +25,9 @@ #include "php_smart_str.h" PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, - const char *num_prefix, zend_str_size_int num_prefix_len, - const char *key_prefix, zend_str_size_int key_prefix_len, - const char *key_suffix, zend_str_size_int key_suffix_len, + const char *num_prefix, int num_prefix_len, + const char *key_prefix, int key_prefix_len, + const char *key_suffix, int key_suffix_len, zval *type, char *arg_sep, int enc_type TSRMLS_DC); #define php_url_encode_hash(ht, formstr) php_url_encode_hash_ex((ht), (formstr), NULL, 0, NULL, 0, NULL, 0, NULL TSRMLS_CC) diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h index c259654a48889..f998996d62238 100644 --- a/ext/standard/php_incomplete_class.h +++ b/ext/standard/php_incomplete_class.h @@ -46,7 +46,7 @@ #define PHP_CLASS_ATTRIBUTES \ char *class_name; \ - zend_str_size name_len; \ + zend_uint name_len; \ zend_bool free_class_name = 0; \ zend_bool incomplete_class = 0 @@ -58,8 +58,8 @@ extern "C" { #endif PHPAPI zend_class_entry *php_create_incomplete_class(TSRMLS_D); -PHPAPI char *php_lookup_class_name(zval *object, zend_str_size_uint *nlen); -PHPAPI void php_store_class_name(zval *object, const char *name, zend_str_size_uint len); +PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen); +PHPAPI void php_store_class_name(zval *object, const char *name, zend_uint len); #ifdef __cplusplus }; diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h index 7e8c4915fe43a..2fef1d0bd0071 100644 --- a/ext/standard/php_smart_str.h +++ b/ext/standard/php_smart_str.h @@ -88,15 +88,13 @@ smart_str_append_ex((dest), (src), 0) #define smart_str_append_long(dest, val) \ smart_str_append_long_ex((dest), (val), 0) -#define smart_str_append_str_size(dest, val) \ - smart_str_append_str_size_ex((dest), (val), 0) #define smart_str_append_off_t(dest, val) \ smart_str_append_off_t_ex((dest), (val), 0) #define smart_str_append_unsigned(dest, val) \ smart_str_append_unsigned_ex((dest), (val), 0) #define smart_str_appendc_ex(dest, ch, what) do { \ - register zend_str_size __nl; \ + register size_t __nl; \ smart_str_alloc4((dest), 1, (what), __nl); \ (dest)->len = __nl; \ ((unsigned char *) (dest)->c)[(dest)->len - 1] = (ch); \ @@ -112,7 +110,7 @@ } while (0) #define smart_str_appendl_ex(dest, src, nlen, what) do { \ - register zend_str_size __nl; \ + register size_t __nl; \ smart_str *__dest = (smart_str *) (dest); \ \ smart_str_alloc4(__dest, (nlen), (what), __nl); \ @@ -177,9 +175,6 @@ static inline char *smart_str_print_unsigned(char *buf, long num) { #define smart_str_append_long_ex(dest, num, type) \ smart_str_append_generic_ex((dest), (num), (type), unsigned long, _long) -#define smart_str_append_str_size_ex(dest, num, type) \ - smart_str_append_generic_ex((dest), (num), (type), zend_str_size, _long) - #define smart_str_append_off_t_ex(dest, num, type) \ smart_str_append_generic_ex((dest), (num), (type), off_t, _long) diff --git a/ext/standard/php_smart_str_public.h b/ext/standard/php_smart_str_public.h index fdcb8b924e3e8..ed36a7a6feb68 100644 --- a/ext/standard/php_smart_str_public.h +++ b/ext/standard/php_smart_str_public.h @@ -25,8 +25,8 @@ typedef struct { char *c; - zend_str_size len; - zend_str_size a; + size_t len; + size_t a; } smart_str; #endif diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h index 3708661dc339c..65219f257adee 100644 --- a/ext/standard/php_string.h +++ b/ext/standard/php_string.h @@ -112,36 +112,36 @@ PHP_MINIT_FUNCTION(nl_langinfo); strnatcmp_ex(a, strlen(a), b, strlen(b), 0) #define strnatcasecmp(a, b) \ strnatcmp_ex(a, strlen(a), b, strlen(b), 1) -PHPAPI int strnatcmp_ex(char const *a, zend_str_size_size_t a_len, char const *b, zend_str_size_size_t b_len, int fold_case); +PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len, int fold_case); #ifdef HAVE_LOCALECONV PHPAPI struct lconv *localeconv_r(struct lconv *out); #endif -PHPAPI char *php_strtoupper(char *s, zend_str_size_size_t len); -PHPAPI char *php_strtolower(char *s, zend_str_size_size_t len); -PHPAPI char *php_strtr(char *str, zend_str_size_int len, char *str_from, char *str_to, zend_str_size_int trlen); -PHPAPI char *php_addslashes(char *str, zend_str_size_int length, zend_str_size_int *new_length, int freeit TSRMLS_DC); -PHPAPI char *php_addcslashes(const char *str, zend_str_size_int length, zend_str_size_int *new_length, int freeit, char *what, zend_str_size_int wlength TSRMLS_DC); -PHPAPI void php_stripslashes(char *str, zend_str_size_int *len TSRMLS_DC); -PHPAPI void php_stripcslashes(char *str, zend_str_size_int *len); -PHPAPI void php_basename(const char *s, zend_str_size_size_t len, char *suffix, zend_str_size_size_t sufflen, char **p_ret, zend_str_size_size_t *p_len TSRMLS_DC); -PHPAPI zend_str_size_size_t php_dirname(char *str, zend_str_size_size_t len); -PHPAPI char *php_stristr(char *s, char *t, zend_str_size_size_t s_len, zend_str_size_size_t t_len); -PHPAPI char *php_str_to_str_ex(char *haystack, zend_str_size_int length, char *needle, - zend_str_size_int needle_len, char *str, zend_str_size_int str_len, zend_str_size_int *_new_length, int case_sensitivity, zend_str_size_int *replace_count); -PHPAPI char *php_str_to_str(char *haystack, zend_str_size_int length, char *needle, - zend_str_size_int needle_len, char *str, zend_str_size_int str_len, zend_str_size_int *_new_length); -PHPAPI char *php_trim(char *c, zend_str_size_int len, char *what, zend_str_size_int what_len, zval *return_value, int mode TSRMLS_DC); -PHPAPI zend_str_size_size_t php_strip_tags(char *rbuf, zend_str_size_int len, int *state, char *allow, zend_str_size_int allow_len); -PHPAPI zend_str_size_size_t php_strip_tags_ex(char *rbuf, zend_str_size_int len, int *stateptr, char *allow, zend_str_size_int allow_len, zend_bool allow_tag_spaces); -PHPAPI zend_str_size_int php_char_to_str_ex(char *str, zend_str_size_uint len, char from, char *to, zend_str_size_int to_len, zval *result, int case_sensitivity, zend_str_size_int *replace_count); -PHPAPI zend_str_size_int php_char_to_str(char *str, zend_str_size_uint len, char from, char *to, zend_str_size_int to_len, zval *result); +PHPAPI char *php_strtoupper(char *s, size_t len); +PHPAPI char *php_strtolower(char *s, size_t len); +PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen); +PHPAPI char *php_addslashes(char *str, int length, int *new_length, int freeit TSRMLS_DC); +PHPAPI char *php_addcslashes(const char *str, int length, int *new_length, int freeit, char *what, int wlength TSRMLS_DC); +PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC); +PHPAPI void php_stripcslashes(char *str, int *len); +PHPAPI void php_basename(const char *s, size_t len, char *suffix, size_t sufflen, char **p_ret, size_t *p_len TSRMLS_DC); +PHPAPI size_t php_dirname(char *str, size_t len); +PHPAPI char *php_stristr(char *s, char *t, size_t s_len, size_t t_len); +PHPAPI char *php_str_to_str_ex(char *haystack, int length, char *needle, + int needle_len, char *str, int str_len, int *_new_length, int case_sensitivity, int *replace_count); +PHPAPI char *php_str_to_str(char *haystack, int length, char *needle, + int needle_len, char *str, int str_len, int *_new_length); +PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval *return_value, int mode TSRMLS_DC); +PHPAPI size_t php_strip_tags(char *rbuf, int len, int *state, char *allow, int allow_len); +PHPAPI size_t php_strip_tags_ex(char *rbuf, int len, int *stateptr, char *allow, int allow_len, zend_bool allow_tag_spaces); +PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int to_len, zval *result, int case_sensitivity, int *replace_count); +PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len, zval *result); PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC); PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, long limit); -PHPAPI zend_str_size_size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end); -PHPAPI zend_str_size_size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end); +PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end); +PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end); PHPAPI int string_natural_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensitive TSRMLS_DC); PHPAPI int string_natural_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); diff --git a/ext/standard/php_uuencode.h b/ext/standard/php_uuencode.h index dfc579506d4f2..28bcb09c3e897 100644 --- a/ext/standard/php_uuencode.h +++ b/ext/standard/php_uuencode.h @@ -24,8 +24,8 @@ PHP_FUNCTION(convert_uudecode); PHP_FUNCTION(convert_uuencode); -PHPAPI zend_str_size_int php_uudecode(char *src, zend_str_size_int src_len, char **dest, int *error); -PHPAPI zend_str_size_int php_uuencode(char *src, zend_str_size_int src_len, char **dest); +PHPAPI int php_uudecode(char *src, int src_len, char **dest); +PHPAPI int php_uuencode(char *src, int src_len, char **dest); #endif /* PHP_UUENCODE_H */ diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index f8ba3e5bf0116..4e39a40be4ebf 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -81,7 +81,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent char **ep; #endif char *p; - zend_str_size string_length, cnt, l, sizeenv=0, el_len; + uint string_length, cnt, l, sizeenv=0, el_len; ulong num_key; HashTable *target_hash; HashPosition pos; @@ -113,7 +113,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent zend_hash_move_forward_ex(target_hash, &pos)) { convert_to_string_ex(element); - el_len = Z_STRSIZE_PP(element); + el_len = Z_STRLEN_PP(element); if (el_len == 0) { continue; } @@ -140,7 +140,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent zend_hash_move_forward_ex(target_hash, &pos)) { convert_to_string_ex(element); - el_len = Z_STRSIZE_PP(element); + el_len = Z_STRLEN_PP(element); if (el_len == 0) { continue; @@ -172,7 +172,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent #endif p += el_len + 1; break; - case HASH_KEY_NON_EXISTENT: + case HASH_KEY_NON_EXISTANT: break; } } @@ -430,7 +430,7 @@ struct php_proc_open_descriptor_item { PHP_FUNCTION(proc_open) { char *command, *cwd=NULL; - zend_str_size command_len, cwd_len = 0; + int command_len, cwd_len = 0; zval *descriptorspec; zval *pipes; zval *environment = NULL; @@ -471,7 +471,7 @@ PHP_FUNCTION(proc_open) php_file_descriptor_t slave_pty = -1; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Saz|S!a!a!", &command, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "saz|s!a!a!", &command, &command_len, &descriptorspec, &pipes, &cwd, &cwd_len, &environment, &other_options) == FAILURE) { RETURN_FALSE; @@ -602,7 +602,7 @@ PHP_FUNCTION(proc_open) #endif descriptors[ndesc].mode_flags = descriptors[ndesc].mode & DESC_PARENT_MODE_WRITE ? O_WRONLY : O_RDONLY; #ifdef PHP_WIN32 - if (Z_STRSIZE_PP(zmode) >= 2 && Z_STRVAL_PP(zmode)[1] == 'b') + if (Z_STRLEN_PP(zmode) >= 2 && Z_STRVAL_PP(zmode)[1] == 'b') descriptors[ndesc].mode_flags |= O_BINARY; #endif diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 7756804d80ff8..f487763b9e02b 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -86,7 +86,7 @@ PHP_FUNCTION(stream_socket_pair) PHP_FUNCTION(stream_socket_client) { char *host; - zend_str_size host_len; + int host_len; zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL; double timeout = FG(default_socket_timeout); php_timeout_ull conv; @@ -100,7 +100,7 @@ PHP_FUNCTION(stream_socket_client) RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|zzdlr", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zzdlr", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -175,7 +175,7 @@ PHP_FUNCTION(stream_socket_client) PHP_FUNCTION(stream_socket_server) { char *host; - zend_str_size host_len; + int host_len; zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL; php_stream *stream = NULL; int err = 0; @@ -185,7 +185,7 @@ PHP_FUNCTION(stream_socket_server) RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|zzlr", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zzlr", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -242,7 +242,7 @@ PHP_FUNCTION(stream_socket_accept) double timeout = FG(default_socket_timeout); zval *zpeername = NULL; char *peername = NULL; - zend_str_size peername_len; + int peername_len; php_timeout_ull conv; struct timeval tv; php_stream *stream = NULL, *clistream = NULL; @@ -300,7 +300,7 @@ PHP_FUNCTION(stream_socket_get_name) zval *zstream; zend_bool want_peer; char *name = NULL; - zend_str_size name_len; + int name_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb", &zstream, &want_peer) == FAILURE) { RETURN_FALSE; @@ -328,11 +328,11 @@ PHP_FUNCTION(stream_socket_sendto) zval *zstream; long flags = 0; char *data, *target_addr = NULL; - zend_str_size datalen, target_addr_len = 0; + int datalen, target_addr_len = 0; php_sockaddr_storage sa; socklen_t sl = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS|lS", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ls", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) { RETURN_FALSE; } php_stream_from_zval(stream, &zstream); @@ -356,7 +356,7 @@ PHP_FUNCTION(stream_socket_recvfrom) php_stream *stream; zval *zstream, *zremote = NULL; char *remote_addr = NULL; - zend_str_size remote_addr_len; + int remote_addr_len; long to_read = 0; char *read_buf; long flags = 0; @@ -407,7 +407,7 @@ PHP_FUNCTION(stream_get_contents) zval *zsrc; long maxlen = PHP_STREAM_COPY_ALL, desiredpos = -1L; - zend_str_size len; + int len; char *contents = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zsrc, &maxlen, &desiredpos) == FAILURE) { @@ -417,7 +417,7 @@ PHP_FUNCTION(stream_get_contents) php_stream_from_zval(stream, &zsrc); if (desiredpos >= 0) { - zend_str_size seek_res = 0; + int seek_res = 0; off_t position; position = php_stream_tell(stream); @@ -453,7 +453,7 @@ PHP_FUNCTION(stream_copy_to_stream) php_stream *src, *dest; zval *zsrc, *zdest; long maxlen = PHP_STREAM_COPY_ALL, pos = 0; - zend_str_size len; + size_t len; int ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|ll", &zsrc, &zdest, &maxlen, &pos) == FAILURE) { @@ -542,7 +542,7 @@ PHP_FUNCTION(stream_get_transports) { HashTable *stream_xport_hash; char *stream_xport; - zend_str_size stream_xport_len; + uint stream_xport_len; ulong num_key; if (zend_parse_parameters_none() == FAILURE) { @@ -572,7 +572,7 @@ PHP_FUNCTION(stream_get_wrappers) HashTable *url_stream_wrappers_hash; char *stream_protocol; int key_flags; - zend_str_size stream_protocol_len = 0; + uint stream_protocol_len = 0; ulong num_key; if (zend_parse_parameters_none() == FAILURE) { @@ -583,7 +583,7 @@ PHP_FUNCTION(stream_get_wrappers) HashPosition pos; array_init(return_value); for (zend_hash_internal_pointer_reset_ex(url_stream_wrappers_hash, &pos); - (key_flags = zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, &stream_protocol_len, &num_key, 0, &pos)) != HASH_KEY_NON_EXISTENT; + (key_flags = zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, &stream_protocol_len, &num_key, 0, &pos)) != HASH_KEY_NON_EXISTANT; zend_hash_move_forward_ex(url_stream_wrappers_hash, &pos)) { if (key_flags == HASH_KEY_IS_STRING) { add_next_index_stringl(return_value, stream_protocol, stream_protocol_len - 1, 1); @@ -658,7 +658,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC) int type; char *key; - zend_str_size key_len; + uint key_len; ulong num_ind; /* Temporary int fd is needed for the STREAM data type on windows, passing this_fd directly to php_stream_cast() would eventually bring a wrong result on x64. php_stream_cast() casts to int internally, and this will leave @@ -668,7 +668,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC) type = zend_hash_get_current_key_ex(Z_ARRVAL_P(stream_array), &key, &key_len, &num_ind, 0, NULL); - if (type == HASH_KEY_NON_EXISTENT || + if (type == HASH_KEY_NON_EXISTANT || zend_hash_get_current_data(Z_ARRVAL_P(stream_array), (void **) &elem) == FAILURE) { continue; /* should not happen */ } @@ -872,7 +872,7 @@ PHP_FUNCTION(stream_select) /* {{{ stream_context related functions */ static void user_space_stream_notifier(php_stream_context *context, int notifycode, int severity, - char *xmsg, int xcode, zend_str_size_size_t bytes_sofar, zend_str_size_size_t bytes_max, void * ptr TSRMLS_DC) + char *xmsg, int xcode, size_t bytes_sofar, size_t bytes_max, void * ptr TSRMLS_DC) { zval *callback = (zval*)context->notifier->ptr; zval *retval = NULL; @@ -923,7 +923,7 @@ static int parse_context_options(php_stream_context *context, zval *options TSRM HashPosition pos, opos; zval **wval, **oval; char *wkey, *okey; - zend_str_size wkey_len, okey_len; + uint wkey_len, okey_len; int ret = SUCCESS; ulong num_key; @@ -1035,10 +1035,10 @@ PHP_FUNCTION(stream_context_set_option) zval *options = NULL, *zcontext = NULL, *zvalue = NULL; php_stream_context *context; char *wrappername, *optionname; - zend_str_size wrapperlen, optionlen; + int wrapperlen, optionlen; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, - "rSSz", &zcontext, &wrappername, &wrapperlen, + "rssz", &zcontext, &wrappername, &wrapperlen, &optionname, &optionlen, &zvalue) == FAILURE) { if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ra", &zcontext, &options) == FAILURE) { @@ -1190,13 +1190,13 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS) zval *zstream; php_stream *stream; char *filtername; - zend_str_size filternamelen; + int filternamelen; long read_write = 0; zval *filterparams = NULL; php_stream_filter *filter = NULL; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS|lz", &zstream, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lz", &zstream, &filtername, &filternamelen, &read_write, &filterparams) == FAILURE) { RETURN_FALSE; } @@ -1312,14 +1312,14 @@ PHP_FUNCTION(stream_filter_remove) PHP_FUNCTION(stream_get_line) { char *str = NULL; - zend_str_size str_len = 0; + int str_len = 0; long max_length; zval *zstream; char *buf; size_t buf_size; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|S", &zstream, &max_length, &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|s", &zstream, &max_length, &str, &str_len) == FAILURE) { RETURN_FALSE; } @@ -1543,9 +1543,9 @@ Determine what file will be opened by calls to fopen() with a relative path */ PHP_FUNCTION(stream_resolve_include_path) { char *filename, *resolved_path; - zend_str_size filename_len; + int filename_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { return; } diff --git a/ext/standard/string.c b/ext/standard/string.c index 55b1ccae2336a..f3f78100b4c6f 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -13,7 +13,7 @@ | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Rasmus Lerdorf | - | Stig S�ther Bakken | + | Stig S�ther Bakken | | Zeev Suraski | +----------------------------------------------------------------------+ */ @@ -23,6 +23,11 @@ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ #include +#ifdef PHP_WIN32 +# include "win32/php_stdint.h" +#else +# include +#endif #include "php.h" #include "php_rand.h" #include "php_string.h" @@ -115,7 +120,7 @@ void register_string_constants(INIT_FUNC_ARGS) } /* }}} */ -int php_tag_find(char *tag, zend_str_size_int len, char *set); +int php_tag_find(char *tag, int len, char *set); /* this is read-only, so it's ok */ static char hexconvtab[] = "0123456789abcdef"; @@ -127,10 +132,10 @@ static MUTEX_T locale_mutex = NULL; /* {{{ php_bin2hex */ -static char *php_bin2hex(const unsigned char *old, const zend_str_size_size_t oldlen, zend_str_size_size_t *newlen) +static char *php_bin2hex(const unsigned char *old, const size_t oldlen, size_t *newlen) { register unsigned char *result = NULL; - zend_str_size i, j; + size_t i, j; result = (unsigned char *) safe_emalloc(oldlen, 2 * sizeof(char), 1); @@ -149,11 +154,11 @@ static char *php_bin2hex(const unsigned char *old, const zend_str_size_size_t ol /* {{{ php_hex2bin */ -static char *php_hex2bin(const unsigned char *old, const zend_str_size_size_t oldlen, zend_str_size_size_t *newlen) +static char *php_hex2bin(const unsigned char *old, const size_t oldlen, size_t *newlen) { - zend_str_size_size_t target_length = oldlen >> 1; + size_t target_length = oldlen >> 1; register unsigned char *str = (unsigned char *)safe_emalloc(target_length, sizeof(char), 1); - zend_str_size_size_t i, j; + size_t i, j; for (i = j = 0; i < target_length; i++) { char c = old[j++]; if (c >= '0' && c <= '9') { @@ -238,10 +243,10 @@ PHP_MSHUTDOWN_FUNCTION(localeconv) PHP_FUNCTION(bin2hex) { char *result, *data; - zend_str_size newlen; - zend_str_size datalen; + size_t newlen; + int datalen; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &data, &datalen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &datalen) == FAILURE) { return; } @@ -260,9 +265,10 @@ PHP_FUNCTION(bin2hex) PHP_FUNCTION(hex2bin) { char *result, *data; - zend_str_size newlen, datalen; + size_t newlen; + int datalen; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &data, &datalen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &datalen) == FAILURE) { return; } @@ -274,7 +280,6 @@ PHP_FUNCTION(hex2bin) result = php_hex2bin((unsigned char *)data, datalen, &newlen); if (!result) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input string must be hexadecimal string"); RETURN_FALSE; } @@ -285,10 +290,10 @@ PHP_FUNCTION(hex2bin) static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ */ { char *s11, *s22; - zend_str_size len1, len2; + int len1, len2; long start = 0, len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ll", &s11, &len1, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ll", &s11, &len1, &s22, &len2, &start, &len) == FAILURE) { return; } @@ -717,9 +722,9 @@ PHP_FUNCTION(nl_langinfo) PHP_FUNCTION(strcoll) { char *s1, *s2; - zend_str_size s1len, s2len; + int s1len, s2len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &s1, &s1len, &s2, &s2len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &s1, &s1len, &s2, &s2len) == FAILURE) { return; } @@ -734,7 +739,7 @@ PHP_FUNCTION(strcoll) * it needs to be incrementing. * Returns: FAILURE/SUCCESS whether the input was correct (i.e. no range errors) */ -static inline int php_charmask(unsigned char *input, zend_str_size_int len, char *mask TSRMLS_DC) +static inline int php_charmask(unsigned char *input, int len, char *mask TSRMLS_DC) { unsigned char *end; unsigned char c; @@ -783,7 +788,7 @@ static inline int php_charmask(unsigned char *input, zend_str_size_int len, char * mode 3 : trim left and right * what indicates which chars are to be trimmed. NULL->default (' \t\n\r\v\0') */ -PHPAPI char *php_trim(char *c, zend_str_size_int len, char *what, zend_str_size_int what_len, zval *return_value, int mode TSRMLS_DC) +PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval *return_value, int mode TSRMLS_DC) { register int i; int trimmed = 0; @@ -832,9 +837,9 @@ static void php_do_trim(INTERNAL_FUNCTION_PARAMETERS, int mode) { char *str; char *what = NULL; - zend_str_size str_len, what_len = 0; + int str_len, what_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &str, &str_len, &what, &what_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &what, &what_len) == FAILURE) { return; } @@ -872,13 +877,13 @@ PHP_FUNCTION(wordwrap) { const char *text, *breakchar = "\n"; char *newtext; - zend_str_size textlen, breakcharlen = 1, newtextlen, chk; - zend_str_size alloced; + int textlen, breakcharlen = 1, newtextlen, chk; + size_t alloced; long current = 0, laststart = 0, lastspace = 0; long linelength = 75; zend_bool docut = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lSb", &text, &textlen, &linelength, &breakchar, &breakcharlen, &docut) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lsb", &text, &textlen, &linelength, &breakchar, &breakcharlen, &docut) == FAILURE) { return; } @@ -921,7 +926,7 @@ PHP_FUNCTION(wordwrap) } else { /* Multiple character line break or forced cut */ if (linelength > 0) { - chk = (zend_str_size)(textlen/linelength + 1); + chk = (int)(textlen/linelength + 1); newtext = safe_emalloc(chk, breakcharlen, textlen + 1); alloced = textlen + chk * breakcharlen + 1; } else { @@ -936,9 +941,9 @@ PHP_FUNCTION(wordwrap) laststart = lastspace = 0; for (current = 0; current < textlen; current++) { if (chk <= 0) { - alloced += (zend_str_size) (((textlen - current + 1)/linelength + 1) * breakcharlen) + 1; + alloced += (int) (((textlen - current + 1)/linelength + 1) * breakcharlen) + 1; newtext = erealloc(newtext, alloced); - chk = (zend_str_size) ((textlen - current)/linelength) + 1; + chk = (int) ((textlen - current)/linelength) + 1; } /* when we hit an existing break, copy to new buffer, and * fix up laststart and lastspace */ @@ -1011,18 +1016,18 @@ PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, long limit) { char *p1, *p2, *endp; - endp = Z_STRVAL_P(str) + Z_STRSIZE_P(str); + endp = Z_STRVAL_P(str) + Z_STRLEN_P(str); p1 = Z_STRVAL_P(str); - p2 = php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp); + p2 = php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp); if (p2 == NULL) { - add_next_index_stringl(return_value, p1, Z_STRSIZE_P(str), 1); + add_next_index_stringl(return_value, p1, Z_STRLEN_P(str), 1); } else { do { add_next_index_stringl(return_value, p1, p2 - p1, 1); - p1 = p2 + Z_STRSIZE_P(delim); - } while ((p2 = php_memnstr(p1, Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp)) != NULL && + p1 = p2 + Z_STRLEN_P(delim); + } while ((p2 = php_memnstr(p1, Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp)) != NULL && --limit > 1); if (p1 <= endp) @@ -1038,10 +1043,10 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu #define EXPLODE_ALLOC_STEP 64 char *p1, *p2, *endp; - endp = Z_STRVAL_P(str) + Z_STRSIZE_P(str); + endp = Z_STRVAL_P(str) + Z_STRLEN_P(str); p1 = Z_STRVAL_P(str); - p2 = php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp); + p2 = php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp); if (p2 == NULL) { /* @@ -1049,7 +1054,7 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu by doing nothing we return empty array */ } else { - zend_str_size allocated = EXPLODE_ALLOC_STEP, found = 0; + int allocated = EXPLODE_ALLOC_STEP, found = 0; long i, to_return; char **positions = emalloc(allocated * sizeof(char *)); @@ -1059,14 +1064,14 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu allocated = found + EXPLODE_ALLOC_STEP;/* make sure we have enough memory */ positions = erealloc(positions, allocated*sizeof(char *)); } - positions[found++] = p1 = p2 + Z_STRSIZE_P(delim); - } while ((p2 = php_memnstr(p1, Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp)) != NULL); + positions[found++] = p1 = p2 + Z_STRLEN_P(delim); + } while ((p2 = php_memnstr(p1, Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp)) != NULL); to_return = limit + found; /* limit is at least -1 therefore no need of bounds checking : i will be always less than found */ for (i = 0;i < to_return;i++) { /* this checks also for to_return > 0 */ add_next_index_stringl(return_value, positions[i], - (positions[i+1] - Z_STRSIZE_P(delim)) - positions[i], + (positions[i+1] - Z_STRLEN_P(delim)) - positions[i], 1 ); } @@ -1081,11 +1086,11 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu PHP_FUNCTION(explode) { char *str, *delim; - zend_str_size str_len = 0, delim_len = 0; + int str_len = 0, delim_len = 0; long limit = LONG_MAX; /* No limit */ zval zdelim, zstr; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|l", &delim, &delim_len, &str, &str_len, &limit) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &delim, &delim_len, &str, &str_len, &limit) == FAILURE) { return; } @@ -1128,7 +1133,7 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC) smart_str implstr = {0}; int numelems, i = 0; zval tmp_val; - zend_str_size str_len; + int str_len; numelems = zend_hash_num_elements(Z_ARRVAL_P(arr)); @@ -1141,7 +1146,7 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC) while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **) &tmp, &pos) == SUCCESS) { switch ((*tmp)->type) { case IS_STRING: - smart_str_appendl(&implstr, Z_STRVAL_PP(tmp), Z_STRSIZE_PP(tmp)); + smart_str_appendl(&implstr, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); break; case IS_LONG: { @@ -1172,7 +1177,7 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC) int copy; zval expr; zend_make_printable_zval(*tmp, &expr, ©); - smart_str_appendl(&implstr, Z_STRVAL(expr), Z_STRSIZE(expr)); + smart_str_appendl(&implstr, Z_STRVAL(expr), Z_STRLEN(expr)); if (copy) { zval_dtor(&expr); } @@ -1183,14 +1188,14 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC) tmp_val = **tmp; zval_copy_ctor(&tmp_val); convert_to_string(&tmp_val); - smart_str_appendl(&implstr, Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val)); + smart_str_appendl(&implstr, Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); zval_dtor(&tmp_val); break; } if (++i != numelems) { - smart_str_appendl(&implstr, Z_STRVAL_P(delim), Z_STRSIZE_P(delim)); + smart_str_appendl(&implstr, Z_STRVAL_P(delim), Z_STRLEN_P(delim)); } zend_hash_move_forward_ex(Z_ARRVAL_P(arr), &pos); } @@ -1257,7 +1262,7 @@ PHP_FUNCTION(implode) PHP_FUNCTION(strtok) { char *str, *tok = NULL; - zend_str_size str_len, tok_len = 0; + int str_len, tok_len = 0; zval *zv; char *token; @@ -1266,7 +1271,7 @@ PHP_FUNCTION(strtok) char *pe; int skipped = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &str, &str_len, &tok, &tok_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &tok, &tok_len) == FAILURE) { return; } @@ -1358,9 +1363,9 @@ PHPAPI char *php_strtoupper(char *s, size_t len) PHP_FUNCTION(strtoupper) { char *arg; - zend_str_size arglen; + int arglen; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arg, &arglen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arglen) == FAILURE) { return; } @@ -1392,9 +1397,9 @@ PHPAPI char *php_strtolower(char *s, size_t len) PHP_FUNCTION(strtolower) { char *str; - zend_str_size arglen; + int arglen; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &arglen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &arglen) == FAILURE) { return; } @@ -1406,10 +1411,10 @@ PHP_FUNCTION(strtolower) /* {{{ php_basename */ -PHPAPI void php_basename(const char *s, zend_str_size_size_t len, char *suffix, zend_str_size_size_t sufflen, char **p_ret, zend_str_size_size_t *p_len TSRMLS_DC) +PHPAPI void php_basename(const char *s, size_t len, char *suffix, size_t sufflen, char **p_ret, size_t *p_len TSRMLS_DC) { char *ret = NULL, *c, *comp, *cend; - zend_str_size_size_t inc_len, cnt; + size_t inc_len, cnt; int state; c = comp = cend = (char*)s; @@ -1482,21 +1487,21 @@ PHPAPI void php_basename(const char *s, zend_str_size_size_t len, char *suffix, PHP_FUNCTION(basename) { char *string, *suffix = NULL, *ret; - zend_str_size string_len, suffix_len = 0; - zend_str_size ret_len; + int string_len, suffix_len = 0; + size_t ret_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &string, &string_len, &suffix, &suffix_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &string, &string_len, &suffix, &suffix_len) == FAILURE) { return; } php_basename(string, string_len, suffix, suffix_len, &ret, &ret_len TSRMLS_CC); - RETURN_STRINGL(ret, ret_len, 0); + RETURN_STRINGL(ret, (int)ret_len, 0); } /* }}} */ /* {{{ php_dirname Returns directory name component of path */ -PHPAPI zend_str_size_size_t php_dirname(char *path, zend_str_size_size_t len) +PHPAPI size_t php_dirname(char *path, size_t len) { return zend_dirname(path, len); } @@ -1508,9 +1513,10 @@ PHP_FUNCTION(dirname) { char *str; char *ret; - zend_str_size str_len, ret_len; + int str_len; + size_t ret_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { return; } @@ -1527,11 +1533,11 @@ PHP_FUNCTION(pathinfo) { zval *tmp; char *path, *ret = NULL; - zend_str_size path_len, ret_len; - int have_basename; + int path_len, have_basename; + size_t ret_len; long opt = PHP_PATHINFO_ALL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &path, &path_len, &opt) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &path_len, &opt) == FAILURE) { return; } @@ -1575,7 +1581,7 @@ PHP_FUNCTION(pathinfo) const char *p; int idx; - /* Have we already looked up the basename? */ + /* Have we alrady looked up the basename? */ if (!have_basename && !ret) { php_basename(path, path_len, NULL, 0, &ret, &ret_len TSRMLS_CC); } @@ -1607,7 +1613,7 @@ PHP_FUNCTION(pathinfo) /* {{{ php_stristr case insensitve strstr */ -PHPAPI char *php_stristr(char *s, char *t, zend_str_size_size_t s_len, zend_str_size_size_t t_len) +PHPAPI char *php_stristr(char *s, char *t, size_t s_len, size_t t_len) { php_strtolower(s, s_len); php_strtolower(t, t_len); @@ -1617,7 +1623,7 @@ PHPAPI char *php_stristr(char *s, char *t, zend_str_size_size_t s_len, zend_str_ /* {{{ php_strspn */ -PHPAPI zend_str_size_size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end) +PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end) { register const char *p = s1, *spanp; register char c = *p; @@ -1635,7 +1641,7 @@ PHPAPI zend_str_size_size_t php_strspn(char *s1, char *s2, char *s1_end, char *s /* {{{ php_strcspn */ -PHPAPI zend_str_size_size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end) +PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end) { register const char *p, *spanp; register char c = *s1; @@ -1693,14 +1699,14 @@ PHP_FUNCTION(stristr) { zval *needle; char *haystack; - zend_str_size haystack_len; + int haystack_len; char *found = NULL; - zend_str_size found_offset; + int found_offset; char *haystack_dup; char needle_char[2]; zend_bool part = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|b", &haystack, &haystack_len, &needle, &part) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|b", &haystack, &haystack_len, &needle, &part) == FAILURE) { return; } @@ -1708,13 +1714,13 @@ PHP_FUNCTION(stristr) if (Z_TYPE_P(needle) == IS_STRING) { char *orig_needle; - if (!Z_STRSIZE_P(needle)) { + if (!Z_STRLEN_P(needle)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle"); efree(haystack_dup); RETURN_FALSE; } - orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRSIZE_P(needle)); - found = php_stristr(haystack_dup, orig_needle, haystack_len, Z_STRSIZE_P(needle)); + orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle)); + found = php_stristr(haystack_dup, orig_needle, haystack_len, Z_STRLEN_P(needle)); efree(orig_needle); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { @@ -1747,23 +1753,23 @@ PHP_FUNCTION(strstr) { zval *needle; char *haystack; - zend_str_size haystack_len; + int haystack_len; char *found = NULL; char needle_char[2]; - zend_str_size found_offset; + long found_offset; zend_bool part = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|b", &haystack, &haystack_len, &needle, &part) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|b", &haystack, &haystack_len, &needle, &part) == FAILURE) { return; } if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRSIZE_P(needle)) { + if (!Z_STRLEN_P(needle)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle"); RETURN_FALSE; } - found = php_memnstr(haystack, Z_STRVAL_P(needle), Z_STRSIZE_P(needle), haystack + haystack_len); + found = php_memnstr(haystack, Z_STRVAL_P(needle), Z_STRLEN_P(needle), haystack + haystack_len); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { RETURN_FALSE; @@ -1798,9 +1804,9 @@ PHP_FUNCTION(strpos) char *found = NULL; char needle_char[2]; long offset = 0; - zend_str_size haystack_len; + int haystack_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &haystack, &haystack_len, &needle, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &needle, &offset) == FAILURE) { return; } @@ -1810,14 +1816,14 @@ PHP_FUNCTION(strpos) } if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRSIZE_P(needle)) { + if (!Z_STRLEN_P(needle)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle"); RETURN_FALSE; } found = php_memnstr(haystack + offset, Z_STRVAL_P(needle), - Z_STRSIZE_P(needle), + Z_STRLEN_P(needle), haystack + haystack_len); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { @@ -1845,13 +1851,13 @@ PHP_FUNCTION(stripos) { char *found = NULL; char *haystack; - zend_str_size haystack_len; + int haystack_len; long offset = 0; char *needle_dup = NULL, *haystack_dup; char needle_char[2]; zval *needle; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &haystack, &haystack_len, &needle, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &needle, &offset) == FAILURE) { return; } @@ -1868,14 +1874,14 @@ PHP_FUNCTION(stripos) php_strtolower(haystack_dup, haystack_len); if (Z_TYPE_P(needle) == IS_STRING) { - if (Z_STRSIZE_P(needle) == 0 || Z_STRSIZE_P(needle) > haystack_len) { + if (Z_STRLEN_P(needle) == 0 || Z_STRLEN_P(needle) > haystack_len) { efree(haystack_dup); RETURN_FALSE; } - needle_dup = estrndup(Z_STRVAL_P(needle), Z_STRSIZE_P(needle)); - php_strtolower(needle_dup, Z_STRSIZE_P(needle)); - found = php_memnstr(haystack_dup + offset, needle_dup, Z_STRSIZE_P(needle), haystack_dup + haystack_len); + needle_dup = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle)); + php_strtolower(needle_dup, Z_STRLEN_P(needle)); + found = php_memnstr(haystack_dup + offset, needle_dup, Z_STRLEN_P(needle), haystack_dup + haystack_len); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { efree(haystack_dup); @@ -1908,17 +1914,17 @@ PHP_FUNCTION(strrpos) { zval *zneedle; char *needle, *haystack; - zend_str_size needle_len, haystack_len; + int needle_len, haystack_len; long offset = 0; char *p, *e, ord_needle[2]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &haystack, &haystack_len, &zneedle, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &zneedle, &offset) == FAILURE) { RETURN_FALSE; } if (Z_TYPE_P(zneedle) == IS_STRING) { needle = Z_STRVAL_P(zneedle); - needle_len = Z_STRSIZE_P(zneedle); + needle_len = Z_STRLEN_P(zneedle); } else { if (php_needle_char(zneedle, ord_needle TSRMLS_CC) != SUCCESS) { RETURN_FALSE; @@ -1981,18 +1987,18 @@ PHP_FUNCTION(strripos) { zval *zneedle; char *needle, *haystack; - zend_str_size needle_len, haystack_len; + int needle_len, haystack_len; long offset = 0; char *p, *e, ord_needle[2]; char *needle_dup, *haystack_dup; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", &haystack, &haystack_len, &zneedle, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &zneedle, &offset) == FAILURE) { RETURN_FALSE; } if (Z_TYPE_P(zneedle) == IS_STRING) { needle = Z_STRVAL_P(zneedle); - needle_len = Z_STRSIZE_P(zneedle); + needle_len = Z_STRLEN_P(zneedle); } else { if (php_needle_char(zneedle, ord_needle TSRMLS_CC) != SUCCESS) { RETURN_FALSE; @@ -2087,9 +2093,9 @@ PHP_FUNCTION(strrchr) char *haystack; const char *found = NULL; long found_offset; - zend_str_size haystack_len; + int haystack_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &haystack, &haystack_len, &needle) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &haystack, &haystack_len, &needle) == FAILURE) { return; } @@ -2115,13 +2121,13 @@ PHP_FUNCTION(strrchr) /* {{{ php_chunk_split */ -static char *php_chunk_split(char *src, zend_str_size_int srclen, char *end, zend_str_size_int endlen, zend_str_size_int chunklen, zend_str_size_int *destlen) +static char *php_chunk_split(char *src, int srclen, char *end, int endlen, int chunklen, int *destlen) { char *dest; char *p, *q; - zend_str_size chunks; /* complete chunks! */ - zend_str_size restlen; - zend_str_size out_len; + int chunks; /* complete chunks! */ + int restlen; + int out_len; chunks = srclen / chunklen; restlen = srclen - chunks * chunklen; /* srclen % chunklen */ @@ -2139,7 +2145,7 @@ static char *php_chunk_split(char *src, zend_str_size_int srclen, char *end, zen } out_len += srclen + 1; - dest = safe_emalloc(out_len, sizeof(char), 0); + dest = safe_emalloc((int)out_len, sizeof(char), 0); for (p = src, q = dest; p < (src + srclen - chunklen + 1); ) { memcpy(q, p, chunklen); @@ -2172,12 +2178,12 @@ PHP_FUNCTION(chunk_split) char *str; char *result; char *end = "\r\n"; - zend_str_size endlen = 2; + int endlen = 2; long chunklen = 76; - zend_str_size result_len; - zend_str_size str_len; + int result_len; + int str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lS", &str, &str_len, &chunklen, &end, &endlen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len, &chunklen, &end, &endlen) == FAILURE) { return; } @@ -2216,10 +2222,10 @@ PHP_FUNCTION(substr) { char *str; long l = 0, f; - zend_str_size str_len; + int str_len; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sl|l", &str, &str_len, &f, &l) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", &str, &str_len, &f, &l) == FAILURE) { return; } @@ -2233,7 +2239,7 @@ PHP_FUNCTION(substr) l = str_len; } - if (f > 0 && f > str_len) { + if (f > str_len) { RETURN_FALSE; } else if (f < 0 && -f > str_len) { f = 0; @@ -2284,8 +2290,8 @@ PHP_FUNCTION(substr_replace) zval **len = NULL; zval **repl; char *result; - zend_str_size result_len; - int l = 0; /* l and f should be size_t, however this needs much closer below logic investigation.*/ + int result_len; + int l = 0; int f; int argc = ZEND_NUM_ARGS(); @@ -2323,7 +2329,7 @@ PHP_FUNCTION(substr_replace) } } else { if (Z_TYPE_PP(str) != IS_ARRAY) { - l = Z_STRSIZE_PP(str); + l = Z_STRLEN_PP(str); } } @@ -2333,19 +2339,19 @@ PHP_FUNCTION(substr_replace) (argc == 4 && Z_TYPE_PP(from) != Z_TYPE_PP(len)) ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "'from' and 'len' should be of same type - numerical or array "); - RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRSIZE_PP(str), 1); + RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1); } if (argc == 4 && Z_TYPE_PP(from) == IS_ARRAY) { if (zend_hash_num_elements(Z_ARRVAL_PP(from)) != zend_hash_num_elements(Z_ARRVAL_PP(len))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "'from' and 'len' should have the same number of elements"); - RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRSIZE_PP(str), 1); + RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1); } } } if (Z_TYPE_PP(str) != IS_ARRAY) { if (Z_TYPE_PP(from) != IS_ARRAY) { - zend_str_size repl_len = 0; + int repl_len = 0; f = Z_LVAL_PP(from); @@ -2353,58 +2359,58 @@ PHP_FUNCTION(substr_replace) * of the string */ if (f < 0) { - f = Z_STRSIZE_PP(str) + f; + f = Z_STRLEN_PP(str) + f; if (f < 0) { f = 0; } - } else if (f > Z_STRSIZE_PP(str)) { - f = Z_STRSIZE_PP(str); + } else if (f > Z_STRLEN_PP(str)) { + f = Z_STRLEN_PP(str); } /* if "length" position is negative, set it to the length * needed to stop that many chars from the end of the string */ if (l < 0) { - l = (Z_STRSIZE_PP(str) - f) + l; + l = (Z_STRLEN_PP(str) - f) + l; if (l < 0) { l = 0; } } - if (f > Z_STRSIZE_PP(str) || (f < 0 && -f > Z_STRSIZE_PP(str))) { + if (f > Z_STRLEN_PP(str) || (f < 0 && -f > Z_STRLEN_PP(str))) { RETURN_FALSE; - } else if (l > Z_STRSIZE_PP(str) || (l < 0 && -l > Z_STRSIZE_PP(str))) { - l = Z_STRSIZE_PP(str); + } else if (l > Z_STRLEN_PP(str) || (l < 0 && -l > Z_STRLEN_PP(str))) { + l = Z_STRLEN_PP(str); } - if ((f + l) > Z_STRSIZE_PP(str)) { - l = Z_STRSIZE_PP(str) - f; + if ((f + l) > Z_STRLEN_PP(str)) { + l = Z_STRLEN_PP(str) - f; } if (Z_TYPE_PP(repl) == IS_ARRAY) { zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(repl), &pos_repl); if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(repl), (void **) &tmp_repl, &pos_repl)) { convert_to_string_ex(tmp_repl); - repl_len = Z_STRSIZE_PP(tmp_repl); + repl_len = Z_STRLEN_PP(tmp_repl); } } else { - repl_len = Z_STRSIZE_PP(repl); + repl_len = Z_STRLEN_PP(repl); } - result_len = Z_STRSIZE_PP(str) - l + repl_len; + result_len = Z_STRLEN_PP(str) - l + repl_len; result = emalloc(result_len + 1); memcpy(result, Z_STRVAL_PP(str), f); if (repl_len) { memcpy((result + f), (Z_TYPE_PP(repl) == IS_ARRAY ? Z_STRVAL_PP(tmp_repl) : Z_STRVAL_PP(repl)), repl_len); } - memcpy((result + f + repl_len), Z_STRVAL_PP(str) + f + l, Z_STRSIZE_PP(str) - f - l); + memcpy((result + f + repl_len), Z_STRVAL_PP(str) + f + l, Z_STRLEN_PP(str) - f - l); result[result_len] = '\0'; RETURN_STRINGL(result, result_len, 0); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Functionality of 'from' and 'len' as arrays is not implemented"); - RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRSIZE_PP(str), 1); + RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1); } } else { /* str is array of strings */ char *str_index = NULL; - zend_str_size str_index_len; + uint str_index_len; ulong num_index; array_init(return_value); @@ -2452,12 +2458,12 @@ PHP_FUNCTION(substr_replace) } if (f < 0) { - f = Z_STRSIZE_P(orig_str) + f; + f = Z_STRLEN_P(orig_str) + f; if (f < 0) { f = 0; } - } else if (f > Z_STRSIZE_P(orig_str)) { - f = Z_STRSIZE_P(orig_str); + } else if (f > Z_STRLEN_P(orig_str)) { + f = Z_STRLEN_P(orig_str); } zend_hash_move_forward_ex(Z_ARRVAL_PP(from), &pos_from); } else { @@ -2466,12 +2472,12 @@ PHP_FUNCTION(substr_replace) } else { f = Z_LVAL_PP(from); if (f < 0) { - f = Z_STRSIZE_P(orig_str) + f; + f = Z_STRLEN_P(orig_str) + f; if (f < 0) { f = 0; } - } else if (f > Z_STRSIZE_P(orig_str)) { - f = Z_STRSIZE_P(orig_str); + } else if (f > Z_STRLEN_P(orig_str)) { + f = Z_STRLEN_P(orig_str); } } @@ -2487,26 +2493,26 @@ PHP_FUNCTION(substr_replace) } zend_hash_move_forward_ex(Z_ARRVAL_PP(len), &pos_len); } else { - l = Z_STRSIZE_P(orig_str); + l = Z_STRLEN_P(orig_str); } } else if (argc > 3) { l = Z_LVAL_PP(len); } else { - l = Z_STRSIZE_P(orig_str); + l = Z_STRLEN_P(orig_str); } if (l < 0) { - l = (Z_STRSIZE_P(orig_str) - f) + l; + l = (Z_STRLEN_P(orig_str) - f) + l; if (l < 0) { l = 0; } } - if ((f + l) > Z_STRSIZE_P(orig_str)) { - l = Z_STRSIZE_P(orig_str) - f; + if ((f + l) > Z_STRLEN_P(orig_str)) { + l = Z_STRLEN_P(orig_str) - f; } - result_len = Z_STRSIZE_P(orig_str) - l; + result_len = Z_STRLEN_P(orig_str) - l; if (Z_TYPE_PP(repl) == IS_ARRAY) { if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(repl), (void **) &tmp_repl, &pos_repl)) { @@ -2529,13 +2535,13 @@ PHP_FUNCTION(substr_replace) break; } - result_len += Z_STRSIZE_P(repl_str); + result_len += Z_STRLEN_P(repl_str); zend_hash_move_forward_ex(Z_ARRVAL_PP(repl), &pos_repl); result = emalloc(result_len + 1); memcpy(result, Z_STRVAL_P(orig_str), f); - memcpy((result + f), Z_STRVAL_P(repl_str), Z_STRSIZE_P(repl_str)); - memcpy((result + f + Z_STRSIZE_P(repl_str)), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l); + memcpy((result + f), Z_STRVAL_P(repl_str), Z_STRLEN_P(repl_str)); + memcpy((result + f + Z_STRLEN_P(repl_str)), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); if(Z_TYPE_PP(tmp_repl) != IS_STRING) { zval_dtor(repl_str); } @@ -2543,16 +2549,16 @@ PHP_FUNCTION(substr_replace) result = emalloc(result_len + 1); memcpy(result, Z_STRVAL_P(orig_str), f); - memcpy((result + f), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l); + memcpy((result + f), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); } } else { - result_len += Z_STRSIZE_PP(repl); + result_len += Z_STRLEN_PP(repl); result = emalloc(result_len + 1); memcpy(result, Z_STRVAL_P(orig_str), f); - memcpy((result + f), Z_STRVAL_PP(repl), Z_STRSIZE_PP(repl)); - memcpy((result + f + Z_STRSIZE_PP(repl)), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l); + memcpy((result + f), Z_STRVAL_PP(repl), Z_STRLEN_PP(repl)); + memcpy((result + f + Z_STRLEN_PP(repl)), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); } result[result_len] = '\0'; @@ -2582,9 +2588,9 @@ PHP_FUNCTION(quotemeta) char *old_end; char *p, *q; char c; - zend_str_size old_len; + int old_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &old, &old_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &old, &old_len) == FAILURE) { return; } @@ -2627,9 +2633,9 @@ PHP_FUNCTION(quotemeta) PHP_FUNCTION(ord) { char *str; - zend_str_size str_len; + int str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { return; } @@ -2674,9 +2680,9 @@ static void php_ucfirst(char *str) PHP_FUNCTION(ucfirst) { char *str; - zend_str_size str_len; + int str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { return; } @@ -2704,9 +2710,9 @@ static void php_lcfirst(char *str) PHP_FUNCTION(lcfirst) { char *str; - zend_str_size str_len; + int str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { return; } @@ -2725,9 +2731,9 @@ PHP_FUNCTION(ucwords) { char *str; register char *r, *r_end; - zend_str_size str_len; + int str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { return; } @@ -2739,7 +2745,7 @@ PHP_FUNCTION(ucwords) r = Z_STRVAL_P(return_value); *r = toupper((unsigned char) *r); - for (r_end = r + Z_STRSIZE_P(return_value) - 1; r < r_end; ) { + for (r_end = r + Z_STRLEN_P(return_value) - 1; r < r_end; ) { if (isspace((int) *(unsigned char *)r++)) { *r = toupper((unsigned char) *r); } @@ -2749,9 +2755,9 @@ PHP_FUNCTION(ucwords) /* {{{ php_strtr */ -PHPAPI char *php_strtr(char *str, zend_str_size_int len, char *str_from, char *str_to, zend_str_size_int trlen) +PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen) { - zend_str_size i; + int i; unsigned char xlat[256]; if ((trlen < 1) || (len < 1)) { @@ -2773,18 +2779,19 @@ PHPAPI char *php_strtr(char *str, zend_str_size_int len, char *str_from, char *s /* }}} */ /* {{{ Definitions for php_strtr_array */ +typedef size_t STRLEN; /* STRLEN should be unsigned */ typedef uint16_t HASH; typedef struct { HASH table_mask; - zend_str_size entries[1]; + STRLEN entries[1]; } SHIFT_TAB; typedef struct { HASH table_mask; - int entries[1]; + int entries[1]; } HASH_TAB; typedef struct { const char *s; - zend_str_size l; + STRLEN l; } STR; typedef struct _pat_and_repl { STR pat; @@ -2800,9 +2807,9 @@ typedef struct _pat_and_repl { #define HASH_TAB_SIZE (1U << HASH_TAB_BITS) typedef struct { - zend_str_size B; /* size of suffixes */ - zend_str_size Bp; /* size of prefixes */ - zend_str_size m; /* minimum pattern length */ + int B; /* size of suffixes */ + int Bp; /* size of prefixes */ + STRLEN m; /* minimum pattern length */ int patnum; /* number of patterns */ SHIFT_TAB *shift; /* table mapping hash to allowed shift */ HASH_TAB *hash; /* table mapping hash to int (pair of pointers) */ @@ -2812,10 +2819,10 @@ typedef struct { /* }}} */ /* {{{ php_strtr_hash */ -static inline HASH php_strtr_hash(const char *str, zend_str_size_int len) +static inline HASH php_strtr_hash(const char *str, int len) { HASH res = 0; - zend_str_size i; + int i; for (i = 0; i < len; i++) { res = res * 33 + (unsigned char)str[i]; } @@ -2824,10 +2831,10 @@ static inline HASH php_strtr_hash(const char *str, zend_str_size_int len) } /* }}} */ /* {{{ php_strtr_populate_shift */ -static inline void php_strtr_populate_shift(PATNREPL *patterns, int patnum, zend_str_size_int B, zend_str_size m, SHIFT_TAB *shift) +static inline void php_strtr_populate_shift(PATNREPL *patterns, int patnum, int B, STRLEN m, SHIFT_TAB *shift) { - zend_str_size i; - zend_str_size j, + int i; + STRLEN j, max_shift; max_shift = m - B + 1; @@ -2877,7 +2884,7 @@ static void php_strtr_free_strp(void *strp) } /* }}} */ /* {{{ php_strtr_array_prepare_repls */ -static PATNREPL *php_strtr_array_prepare_repls(zend_str_size_int slen, HashTable *pats, zend_llist **allocs, zend_str_size_int *outsize) +static PATNREPL *php_strtr_array_prepare_repls(int slen, HashTable *pats, zend_llist **allocs, int *outsize) { PATNREPL *patterns; HashPosition hpos; @@ -2893,7 +2900,7 @@ static PATNREPL *php_strtr_array_prepare_repls(zend_str_size_int slen, HashTable zend_hash_get_current_data_ex(pats, (void **)&entry, &hpos) == SUCCESS; zend_hash_move_forward_ex(pats, &hpos)) { char *string_key; - zend_str_size string_key_len; + uint string_key_len; ulong num_key; zval *tzv = NULL; @@ -2928,7 +2935,7 @@ static PATNREPL *php_strtr_array_prepare_repls(zend_str_size_int slen, HashTable S(&patterns[i].pat) = string_key; L(&patterns[i].pat) = string_key_len; S(&patterns[i].repl) = Z_STRVAL_PP(entry); - L(&patterns[i].repl) = Z_STRSIZE_PP(entry); + L(&patterns[i].repl) = Z_STRLEN_PP(entry); i++; if (tzv) { @@ -2943,12 +2950,12 @@ static PATNREPL *php_strtr_array_prepare_repls(zend_str_size_int slen, HashTable /* }}} */ /* {{{ PPRES *php_strtr_array_prepare(STR *text, PATNREPL *patterns, int patnum, int B, int Bp) */ -static PPRES *php_strtr_array_prepare(STR *text, PATNREPL *patterns, int patnum, zend_str_size_int B, zend_str_size_int Bp) +static PPRES *php_strtr_array_prepare(STR *text, PATNREPL *patterns, int patnum, int B, int Bp) { - zend_str_size i; + int i; PPRES *res = emalloc(sizeof *res); - res->m = (zend_str_size)-1; + res->m = (STRLEN)-1; for (i = 0; i < patnum; i++) { if (L(&patterns[i].pat) < res->m) { res->m = L(&patterns[i].pat); @@ -3024,14 +3031,14 @@ static void php_strtr_array_destroy_ppres(PPRES *d) /* {{{ php_strtr_array_do_repl(STR *text, PPRES *d, zval *return_value) */ static void php_strtr_array_do_repl(STR *text, PPRES *d, zval *return_value) { - zend_str_size pos = 0, + STRLEN pos = 0, nextwpos = 0, lastpos = L(text) - d->m; smart_str result = {0}; while (pos <= lastpos) { HASH h = php_strtr_hash(&S(text)[pos + d->m - d->B], d->B) & d->shift->table_mask; - zend_str_size shift = d->shift->entries[h]; + STRLEN shift = d->shift->entries[h]; if (shift > 0) { pos += shift; @@ -3039,7 +3046,7 @@ static void php_strtr_array_do_repl(STR *text, PPRES *d, zval *return_value) HASH h2 = h & d->hash->table_mask, prefix_h = php_strtr_hash(&S(text)[pos], d->Bp); - zend_str_size offset_start = d->hash->entries[h2], + int offset_start = d->hash->entries[h2], offset_end = d->hash->entries[h2 + 1], /* exclusive */ i = 0; @@ -3077,12 +3084,12 @@ end_outer_loop: ; /* }}} */ /* {{{ php_strtr_array */ -static void php_strtr_array(zval *return_value, char *str, zend_str_size_int slen, HashTable *pats) +static void php_strtr_array(zval *return_value, char *str, int slen, HashTable *pats) { PPRES *data; STR text; PATNREPL *patterns; - zend_str_size_int patterns_len; + int patterns_len; zend_llist *allocs; S(&text) = str; @@ -3107,10 +3114,10 @@ PHP_FUNCTION(strtr) { zval **from; char *str, *to = NULL; - zend_str_size str_len, to_len = 0; + int str_len, to_len = 0; int ac = ZEND_NUM_ARGS(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SZ|S", &str, &str_len, &from, &to, &to_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sZ|s", &str, &str_len, &from, &to, &to_len) == FAILURE) { return; } @@ -3132,10 +3139,10 @@ PHP_FUNCTION(strtr) ZVAL_STRINGL(return_value, str, str_len, 1); php_strtr(Z_STRVAL_P(return_value), - Z_STRSIZE_P(return_value), + Z_STRLEN_P(return_value), Z_STRVAL_PP(from), to, - MIN(Z_STRSIZE_PP(from), + MIN(Z_STRLEN_PP(from), to_len)); } } @@ -3147,9 +3154,9 @@ PHP_FUNCTION(strrev) { char *str; char *e, *n, *p; - zend_str_size str_len; + int str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { return; } @@ -3170,12 +3177,12 @@ PHP_FUNCTION(strrev) /* {{{ php_similar_str */ -static void php_similar_str(const char *txt1, zend_str_size_int len1, const char *txt2, zend_str_size_int len2, zend_str_size_int *pos1, zend_str_size_int *pos2, zend_str_size_int *max) +static void php_similar_str(const char *txt1, int len1, const char *txt2, int len2, int *pos1, int *pos2, int *max) { char *p, *q; char *end1 = (char *) txt1 + len1; char *end2 = (char *) txt2 + len2; - zend_str_size l; + int l; *max = 0; for (p = (char *) txt1; p < end1; p++) { @@ -3193,10 +3200,10 @@ static void php_similar_str(const char *txt1, zend_str_size_int len1, const char /* {{{ php_similar_char */ -static zend_str_size_int php_similar_char(const char *txt1, zend_str_size_int len1, const char *txt2, zend_str_size_int len2) +static int php_similar_char(const char *txt1, int len1, const char *txt2, int len2) { - zend_str_size sum; - zend_str_size pos1, pos2, max; + int sum; + int pos1, pos2, max; php_similar_str(txt1, len1, txt2, len2, &pos1, &pos2, &max); if ((sum = max)) { @@ -3221,10 +3228,10 @@ PHP_FUNCTION(similar_text) char *t1, *t2; zval **percent = NULL; int ac = ZEND_NUM_ARGS(); - zend_str_size_int sim; - zend_str_size t1_len, t2_len; + int sim; + int t1_len, t2_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|Z", &t1, &t1_len, &t2, &t2_len, &percent) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|Z", &t1, &t1_len, &t2, &t2_len, &percent) == FAILURE) { return; } @@ -3253,10 +3260,10 @@ PHP_FUNCTION(similar_text) /* {{{ php_stripslashes * * be careful, this edits the string in-place */ -PHPAPI void php_stripslashes(char *str, zend_str_size_int *len TSRMLS_DC) +PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC) { char *s, *t; - zend_str_size l; + int l; if (len != NULL) { l = *len; @@ -3298,9 +3305,9 @@ PHPAPI void php_stripslashes(char *str, zend_str_size_int *len TSRMLS_DC) PHP_FUNCTION(addcslashes) { char *str, *what; - zend_str_size str_len, what_len; + int str_len, what_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &str, &str_len, &what, &what_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &str, &str_len, &what, &what_len) == FAILURE) { return; } @@ -3312,8 +3319,8 @@ PHP_FUNCTION(addcslashes) RETURN_STRINGL(str, str_len, 1); } - Z_STRVAL_P(return_value) = php_addcslashes(str, str_len, &Z_STRSIZE_P(return_value), 0, what, what_len TSRMLS_CC); - RETURN_STRINGL(Z_STRVAL_P(return_value), Z_STRSIZE_P(return_value), 0); + Z_STRVAL_P(return_value) = php_addcslashes(str, str_len, &Z_STRLEN_P(return_value), 0, what, what_len TSRMLS_CC); + RETURN_STRINGL(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), 0); } /* }}} */ @@ -3322,9 +3329,9 @@ PHP_FUNCTION(addcslashes) PHP_FUNCTION(addslashes) { char *str; - zend_str_size str_len; + int str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { return; } @@ -3334,7 +3341,7 @@ PHP_FUNCTION(addslashes) RETURN_STRING(php_addslashes(str, str_len, - &Z_STRSIZE_P(return_value), 0 + &Z_STRLEN_P(return_value), 0 TSRMLS_CC), 0); } /* }}} */ @@ -3344,14 +3351,14 @@ PHP_FUNCTION(addslashes) PHP_FUNCTION(stripcslashes) { char *str; - zend_str_size str_len; + int str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { return; } ZVAL_STRINGL(return_value, str, str_len, 1); - php_stripcslashes(Z_STRVAL_P(return_value), &Z_STRSIZE_P(return_value)); + php_stripcslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value)); } /* }}} */ @@ -3360,14 +3367,14 @@ PHP_FUNCTION(stripcslashes) PHP_FUNCTION(stripslashes) { char *str; - zend_str_size str_len; + int str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { return; } ZVAL_STRINGL(return_value, str, str_len, 1); - php_stripslashes(Z_STRVAL_P(return_value), &Z_STRSIZE_P(return_value) TSRMLS_CC); + php_stripslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value) TSRMLS_CC); } /* }}} */ @@ -3392,10 +3399,10 @@ char *php_strerror(int errnum) /* {{{ php_stripcslashes */ -PHPAPI void php_stripcslashes(char *str, zend_str_size_int *len) +PHPAPI void php_stripcslashes(char *str, int *len) { char *source, *target, *end; - zend_str_size nlen = *len, i; + int nlen = *len, i; char numtmp[4]; for (source=str, end=str+nlen, target=str; source < end; source++) { @@ -3455,14 +3462,14 @@ PHPAPI void php_stripcslashes(char *str, zend_str_size_int *len) /* {{{ php_addcslashes */ -PHPAPI char *php_addcslashes(const char *str, zend_str_size_int length, zend_str_size_int *new_length, int should_free, char *what, zend_str_size_int wlength TSRMLS_DC) +PHPAPI char *php_addcslashes(const char *str, int length, int *new_length, int should_free, char *what, int wlength TSRMLS_DC) { char flags[256]; char *new_str = safe_emalloc(4, (length?length:(length=strlen(str))), 1); char *source, *target; char *end; char c; - zend_str_size_int newlen; + int newlen; if (!wlength) { wlength = strlen(what); @@ -3508,13 +3515,13 @@ PHPAPI char *php_addcslashes(const char *str, zend_str_size_int length, zend_str /* {{{ php_addslashes */ -PHPAPI char *php_addslashes(char *str, zend_str_size_int length, zend_str_size_int *new_length, int should_free TSRMLS_DC) +PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_free TSRMLS_DC) { /* maximum string length, worst case situation */ char *new_str; char *source, *target; char *end; - zend_str_size_int local_new_length; + int local_new_length; if (!new_length) { new_length = &local_new_length; @@ -3565,10 +3572,10 @@ PHPAPI char *php_addslashes(char *str, zend_str_size_int length, zend_str_size_i /* {{{ php_char_to_str_ex */ -PHPAPI zend_str_size_int php_char_to_str_ex(char *str, zend_str_size_uint len, char from, char *to, zend_str_size_int to_len, zval *result, int case_sensitivity, zend_str_size_int *replace_count) +PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int to_len, zval *result, int case_sensitivity, int *replace_count) { - zend_str_size char_count = 0; - zend_str_size replaced = 0; + int char_count = 0; + int replaced = 0; char *source, *target, *tmp, *source_end=str+len, *tmp_end = NULL; if (case_sensitivity) { @@ -3590,7 +3597,7 @@ PHPAPI zend_str_size_int php_char_to_str_ex(char *str, zend_str_size_uint len, c return 0; } - Z_STRSIZE_P(result) = len + (char_count * (to_len - 1)); + Z_STRLEN_P(result) = len + (char_count * (to_len - 1)); Z_STRVAL_P(result) = target = safe_emalloc(char_count, to_len, len + 1); Z_TYPE_P(result) = IS_STRING; @@ -3635,7 +3642,7 @@ PHPAPI zend_str_size_int php_char_to_str_ex(char *str, zend_str_size_uint len, c /* {{{ php_char_to_str */ -PHPAPI zend_str_size_int php_char_to_str(char *str, zend_str_size_uint len, char from, char *to, zend_str_size_int to_len, zval *result) +PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len, zval *result) { return php_char_to_str_ex(str, len, from, to, to_len, result, 1, NULL); } @@ -3643,8 +3650,8 @@ PHPAPI zend_str_size_int php_char_to_str(char *str, zend_str_size_uint len, char /* {{{ php_str_to_str_ex */ -PHPAPI char *php_str_to_str_ex(char *haystack, zend_str_size_int length, - char *needle, zend_str_size_int needle_len, char *str, zend_str_size_int str_len, zend_str_size_int *_new_length, int case_sensitivity, zend_str_size_int *replace_count) +PHPAPI char *php_str_to_str_ex(char *haystack, int length, + char *needle, int needle_len, char *str, int str_len, int *_new_length, int case_sensitivity, int *replace_count) { char *new_str; @@ -3691,7 +3698,7 @@ PHPAPI char *php_str_to_str_ex(char *haystack, zend_str_size_int length, if (str_len < needle_len) { new_str = emalloc(length + 1); } else { - zend_str_size count = 0; + int count = 0; char *o, *n, *endp; if (case_sensitivity) { @@ -3815,8 +3822,8 @@ PHPAPI char *php_str_to_str_ex(char *haystack, zend_str_size_int length, /* {{{ php_str_to_str */ -PHPAPI char *php_str_to_str(char *haystack, zend_str_size_int length, - char *needle, zend_str_size_int needle_len, char *str, zend_str_size_int str_len, zend_str_size_int *_new_length) +PHPAPI char *php_str_to_str(char *haystack, int length, + char *needle, int needle_len, char *str, int str_len, int *_new_length) { return php_str_to_str_ex(haystack, length, needle, needle_len, str, str_len, _new_length, 1, NULL); } @@ -3824,18 +3831,18 @@ PHPAPI char *php_str_to_str(char *haystack, zend_str_size_int length, /* {{{ php_str_replace_in_subject */ -static void php_str_replace_in_subject(zval *search, zval *replace, zval **subject, zval *result, int case_sensitivity, zend_str_size_int *replace_count) +static void php_str_replace_in_subject(zval *search, zval *replace, zval **subject, zval *result, int case_sensitivity, int *replace_count) { zval **search_entry, **replace_entry = NULL, temp_result; char *replace_value = NULL; - zend_str_size replace_len = 0; + int replace_len = 0; /* Make sure we're dealing with strings. */ convert_to_string_ex(subject); Z_TYPE_P(result) = IS_STRING; - if (Z_STRSIZE_PP(subject) == 0) { + if (Z_STRLEN_PP(subject) == 0) { ZVAL_STRINGL(result, "", 0, 1); return; } @@ -3852,7 +3859,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje } else { /* Set replacement value to the passed one */ replace_value = Z_STRVAL_P(replace); - replace_len = Z_STRSIZE_P(replace); + replace_len = Z_STRLEN_P(replace); } /* For each entry in the search array, get the entry */ @@ -3860,7 +3867,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje /* Make sure we're dealing with strings. */ SEPARATE_ZVAL(search_entry); convert_to_string(*search_entry); - if (Z_STRSIZE_PP(search_entry) == 0) { + if (Z_STRLEN_PP(search_entry) == 0) { zend_hash_move_forward(Z_ARRVAL_P(search)); if (Z_TYPE_P(replace) == IS_ARRAY) { zend_hash_move_forward(Z_ARRVAL_P(replace)); @@ -3877,7 +3884,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje /* Set replacement value to the one we got from array */ replace_value = Z_STRVAL_PP(replace_entry); - replace_len = Z_STRSIZE_PP(replace_entry); + replace_len = Z_STRLEN_PP(replace_entry); zend_hash_move_forward(Z_ARRVAL_P(replace)); } else { @@ -3887,45 +3894,45 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje } } - if (Z_STRSIZE_PP(search_entry) == 1) { + if (Z_STRLEN_PP(search_entry) == 1) { php_char_to_str_ex(Z_STRVAL_P(result), - Z_STRSIZE_P(result), + Z_STRLEN_P(result), Z_STRVAL_PP(search_entry)[0], replace_value, replace_len, &temp_result, case_sensitivity, replace_count); - } else if (Z_STRSIZE_PP(search_entry) > 1) { - Z_STRVAL(temp_result) = php_str_to_str_ex(Z_STRVAL_P(result), Z_STRSIZE_P(result), - Z_STRVAL_PP(search_entry), Z_STRSIZE_PP(search_entry), - replace_value, replace_len, &Z_STRSIZE(temp_result), case_sensitivity, replace_count); + } else if (Z_STRLEN_PP(search_entry) > 1) { + Z_STRVAL(temp_result) = php_str_to_str_ex(Z_STRVAL_P(result), Z_STRLEN_P(result), + Z_STRVAL_PP(search_entry), Z_STRLEN_PP(search_entry), + replace_value, replace_len, &Z_STRLEN(temp_result), case_sensitivity, replace_count); } str_efree(Z_STRVAL_P(result)); Z_STRVAL_P(result) = Z_STRVAL(temp_result); - Z_STRSIZE_P(result) = Z_STRSIZE(temp_result); + Z_STRLEN_P(result) = Z_STRLEN(temp_result); - if (Z_STRSIZE_P(result) == 0) { + if (Z_STRLEN_P(result) == 0) { return; } zend_hash_move_forward(Z_ARRVAL_P(search)); } } else { - if (Z_STRSIZE_P(search) == 1) { + if (Z_STRLEN_P(search) == 1) { php_char_to_str_ex(Z_STRVAL_PP(subject), - Z_STRSIZE_PP(subject), + Z_STRLEN_PP(subject), Z_STRVAL_P(search)[0], Z_STRVAL_P(replace), - Z_STRSIZE_P(replace), + Z_STRLEN_P(replace), result, case_sensitivity, replace_count); - } else if (Z_STRSIZE_P(search) > 1) { - Z_STRVAL_P(result) = php_str_to_str_ex(Z_STRVAL_PP(subject), Z_STRSIZE_PP(subject), - Z_STRVAL_P(search), Z_STRSIZE_P(search), - Z_STRVAL_P(replace), Z_STRSIZE_P(replace), &Z_STRSIZE_P(result), case_sensitivity, replace_count); + } else if (Z_STRLEN_P(search) > 1) { + Z_STRVAL_P(result) = php_str_to_str_ex(Z_STRVAL_PP(subject), Z_STRLEN_PP(subject), + Z_STRVAL_P(search), Z_STRLEN_P(search), + Z_STRVAL_P(replace), Z_STRLEN_P(replace), &Z_STRLEN_P(result), case_sensitivity, replace_count); } else { MAKE_COPY_ZVAL(subject, result); } @@ -3940,9 +3947,9 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit zval **subject, **search, **replace, **subject_entry, **zcount = NULL; zval *result; char *string_key; - zend_str_size string_key_len; + uint string_key_len; ulong num_key; - zend_str_size count = 0; + int count = 0; int argc = ZEND_NUM_ARGS(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ|Z", &search, &replace, &subject, &zcount) == FAILURE) { @@ -3997,7 +4004,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit } if (argc > 3) { zval_dtor(*zcount); - ZVAL_LONG(*zcount, (long) count); + ZVAL_LONG(*zcount, count); } } /* }}} */ @@ -4027,12 +4034,12 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) { char *str; char *heb_str, *tmp, *target, *broken_str; - zend_str_size block_start, block_end, block_type, block_length, i; + int block_start, block_end, block_type, block_length, i; long max_chars=0; - zend_str_size begin, end, char_count, orig_begin; - zend_str_size str_len; + int begin, end, char_count, orig_begin; + int str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &str_len, &max_chars) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &max_chars) == FAILURE) { return; } @@ -4140,7 +4147,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) } } if (char_count == max_chars) { /* try to avoid breaking words */ - zend_str_size_int new_char_count=char_count, new_begin=begin; + int new_char_count=char_count, new_begin=begin; while (new_char_count > 0) { if (_isblank(heb_str[new_begin]) || _isnewline(heb_str[new_begin])) { @@ -4185,7 +4192,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) efree(broken_str); } else { Z_STRVAL_P(return_value) = broken_str; - Z_STRSIZE_P(return_value) = str_len; + Z_STRLEN_P(return_value) = str_len; Z_TYPE_P(return_value) = IS_STRING; } } @@ -4213,13 +4220,13 @@ PHP_FUNCTION(nl2br) { /* in brief this inserts
or
before matched regexp \n\r?|\r\n? */ char *tmp, *str; - zend_str_size new_length; + int new_length; char *end, *target; - zend_str_size repl_cnt = 0; - zend_str_size str_len; + int repl_cnt = 0; + int str_len; zend_bool is_xhtml = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &str, &str_len, &is_xhtml) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &str, &str_len, &is_xhtml) == FAILURE) { return; } @@ -4249,7 +4256,7 @@ PHP_FUNCTION(nl2br) } { - zend_str_size repl_len = is_xhtml ? (sizeof("
") - 1) : (sizeof("
") - 1); + size_t repl_len = is_xhtml ? (sizeof("
") - 1) : (sizeof("
") - 1); new_length = str_len + repl_cnt * repl_len; tmp = target = safe_emalloc(repl_cnt, repl_len, str_len + 1); @@ -4295,11 +4302,11 @@ PHP_FUNCTION(strip_tags) char *str; zval **allow=NULL; char *allowed_tags=NULL; - zend_str_size allowed_tags_len=0; - zend_str_size str_len; + int allowed_tags_len=0; + int str_len; size_t retval_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|Z", &str, &str_len, &allow) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|Z", &str, &str_len, &allow) == FAILURE) { return; } @@ -4307,7 +4314,7 @@ PHP_FUNCTION(strip_tags) if (allow != NULL) { convert_to_string_ex(allow); allowed_tags = Z_STRVAL_PP(allow); - allowed_tags_len = Z_STRSIZE_PP(allow); + allowed_tags_len = Z_STRLEN_PP(allow); } buf = estrndup(str, str_len); @@ -4388,7 +4395,7 @@ PHP_FUNCTION(setlocale) loc = NULL; } else { loc = Z_STRVAL_PP(plocale); - if (Z_STRSIZE_PP(plocale) >= 255) { + if (Z_STRLEN_PP(plocale) >= 255) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Specified locale name is too long"); break; } @@ -4431,9 +4438,9 @@ PHP_FUNCTION(parse_str) char *arg; zval *arrayArg = NULL; char *res = NULL; - zend_str_size arglen; + int arglen; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|z", &arg, &arglen, &arrayArg) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &arg, &arglen, &arrayArg) == FAILURE) { return; } @@ -4470,7 +4477,7 @@ PHP_FUNCTION(parse_str) * 0 start tag * 1 first non-whitespace char seen */ -int php_tag_find(char *tag, zend_str_size_int len, char *set) { +int php_tag_find(char *tag, int len, char *set) { char c, *n, *t; int state=0, done=0; char *norm; @@ -4525,7 +4532,7 @@ int php_tag_find(char *tag, zend_str_size_int len, char *set) { } /* }}} */ -PHPAPI zend_str_size_size_t php_strip_tags(char *rbuf, zend_str_size_int len, int *stateptr, char *allow, zend_str_size_int allow_len) /* {{{ */ +PHPAPI size_t php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int allow_len) /* {{{ */ { return php_strip_tags_ex(rbuf, len, stateptr, allow, allow_len, 0); } @@ -4551,12 +4558,11 @@ PHPAPI zend_str_size_size_t php_strip_tags(char *rbuf, zend_str_size_int len, in swm: Added ability to strip 1) { - php_string_shuffle(Z_STRVAL_P(return_value), (long) Z_STRSIZE_P(return_value) TSRMLS_CC); + if (Z_STRLEN_P(return_value) > 1) { + php_string_shuffle(Z_STRVAL_P(return_value), (long) Z_STRLEN_P(return_value) TSRMLS_CC); } } /* }}} */ @@ -5380,10 +5385,10 @@ PHP_FUNCTION(str_shuffle) PHP_FUNCTION(str_word_count) { char *buf, *str, *char_list = NULL, *p, *e, *s, ch[256]; - zend_str_size str_len, char_list_len = 0, word_count = 0; + int str_len, char_list_len = 0, word_count = 0; long type = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lS", &str, &str_len, &type, &char_list, &char_list_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len, &type, &char_list, &char_list_len) == FAILURE) { return; } @@ -5458,12 +5463,12 @@ PHP_FUNCTION(str_word_count) Convert monetary value(s) to string */ PHP_FUNCTION(money_format) { - zend_str_size format_len = 0, str_len; + int format_len = 0, str_len; char *format, *str, *p, *e; double value; zend_bool check = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sd", &format, &format_len, &value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sd", &format, &format_len, &value) == FAILURE) { return; } @@ -5499,12 +5504,12 @@ PHP_FUNCTION(money_format) PHP_FUNCTION(str_split) { char *str; - zend_str_size str_len; + int str_len; long split_length = 1; char *p; - zend_str_size n_reg_segments; + int n_reg_segments; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &str_len, &split_length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &split_length) == FAILURE) { return; } @@ -5539,10 +5544,10 @@ PHP_FUNCTION(str_split) PHP_FUNCTION(strpbrk) { char *haystack, *char_list; - zend_str_size haystack_len, char_list_len; + int haystack_len, char_list_len; char *haystack_ptr, *cl_ptr; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &haystack, &haystack_len, &char_list, &char_list_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &haystack, &haystack_len, &char_list, &char_list_len) == FAILURE) { RETURN_FALSE; } @@ -5568,12 +5573,12 @@ PHP_FUNCTION(strpbrk) PHP_FUNCTION(substr_compare) { char *s1, *s2; - zend_str_size s1_len, s2_len; + int s1_len, s2_len; long offset, len=0; zend_bool cs=0; - zend_str_size cmp_len; + uint cmp_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSl|lb", &s1, &s1_len, &s2, &s2_len, &offset, &len, &cs) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl|lb", &s1, &s1_len, &s2, &s2_len, &offset, &len, &cs) == FAILURE) { RETURN_FALSE; } @@ -5592,7 +5597,7 @@ PHP_FUNCTION(substr_compare) RETURN_FALSE; } - cmp_len = (zend_str_size) (len ? len : MAX(s2_len, (s1_len - offset))); + cmp_len = (uint) (len ? len : MAX(s2_len, (s1_len - offset))); if (!cs) { RETURN_LONG(zend_binary_strncmp(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); diff --git a/ext/standard/tests/array/array_column_basic.phpt b/ext/standard/tests/array/array_column_basic.phpt index 418f373872f7a..7c30cdfd10501 100644 --- a/ext/standard/tests/array/array_column_basic.phpt +++ b/ext/standard/tests/array/array_column_basic.phpt @@ -178,7 +178,7 @@ array(3) { *** Testing multiple data types *** array(8) { [0]=> - object(stdClass)#%d (0) { + object(stdClass)#1 (0) { } [1]=> float(34.2345) @@ -197,7 +197,7 @@ array(8) { } array(8) { [1]=> - object(stdClass)#%d (0) { + object(stdClass)#1 (0) { } [2]=> float(34.2345) diff --git a/ext/standard/tests/array/array_count_values_variation.phpt b/ext/standard/tests/array/array_count_values_variation.phpt index 1d614b452ad56..89d7f37b1fe1b 100644 --- a/ext/standard/tests/array/array_count_values_variation.phpt +++ b/ext/standard/tests/array/array_count_values_variation.phpt @@ -1,5 +1,5 @@ --TEST-- -Test array_count_values() function : Test all normal parameter variations +Test array_count_values() function : Test all normal paramter variations --FILE-- "01", "ActionKey" => "00", "ContactCommissionArticle"=> "0,00", - "QuantdependentPriceKey"=> "", + "QuantDependantPriceKey"=> "", "Quant" => "1", "QuantUnit" => "", "Meas" => array( @@ -584,7 +584,7 @@ gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) /Docs/Doc/DocItems/DocItem/ContactCommissionArticle=0,00 gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) -/Docs/Doc/DocItems/DocItem/QuantdependentPriceKey +/Docs/Doc/DocItems/DocItem/QuantDependantPriceKey gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) /Docs/Doc/DocItems/DocItem/Quant=1 diff --git a/ext/standard/tests/array/bug34066_1.phpt b/ext/standard/tests/array/bug34066_1.phpt index 6d0f7f84e933d..edc16efd05d8a 100644 --- a/ext/standard/tests/array/bug34066_1.phpt +++ b/ext/standard/tests/array/bug34066_1.phpt @@ -123,7 +123,7 @@ Bug #34066 (recursive array_walk causes segfault) "ProceedKeyArticle" => "01", "ActionKey" => "00", "ContactCommissionArticle"=> "0,00", - "QuantdependentPriceKey"=> "", + "QuantDependantPriceKey"=> "", "Quant" => "1", "QuantUnit" => "", "Meas" => array( @@ -543,7 +543,7 @@ gen_xml(prefix=/Docs/) /Docs/ContactCommissionArticle=0,00 gen_xml(prefix=/Docs/) end gen_xml(prefix=/Docs/) -/Docs/QuantdependentPriceKey +/Docs/QuantDependantPriceKey gen_xml(prefix=/Docs/) end gen_xml(prefix=/Docs/) /Docs/Quant=1 diff --git a/ext/standard/tests/array/bug65304.phpt b/ext/standard/tests/array/bug65304.phpt deleted file mode 100644 index e5c9dfc5e6a47..0000000000000 --- a/ext/standard/tests/array/bug65304.phpt +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Bug #65304 (Use of max int in array_sum) ---FILE-- - ---EXPECTF-- -float(%s) -float(%s) diff --git a/ext/standard/tests/array/in_array_variation4.phpt b/ext/standard/tests/array/in_array_variation4.phpt index a27bb196b460f..b88a5a2d628c0 100644 --- a/ext/standard/tests/array/in_array_variation4.phpt +++ b/ext/standard/tests/array/in_array_variation4.phpt @@ -19,7 +19,7 @@ $file_handle = fopen(__FILE__, "r"); //directory type resource $dir_handle = opendir( dirname(__FILE__) ); -//store resources in array for comparison. +//store resources in array for comparision. $resources = array($file_handle, $dir_handle); // search for resouce type in the resource array diff --git a/ext/standard/tests/array/uasort_object2.phpt b/ext/standard/tests/array/uasort_object2.phpt index 889db9886aef8..cd32d8d947d42 100644 --- a/ext/standard/tests/array/uasort_object2.phpt +++ b/ext/standard/tests/array/uasort_object2.phpt @@ -8,7 +8,7 @@ Test uasort() function : object functionality - sort diff. objects * /* - * This testcase tests uasort() functionality with different objects + * This testcase tests uasort() functionality with differnt objects * Objects of different classes: * simple class, * child class, diff --git a/ext/standard/tests/array/uasort_variation10.phpt b/ext/standard/tests/array/uasort_variation10.phpt index e0c5e72f7e13b..809cb78f565d8 100644 --- a/ext/standard/tests/array/uasort_variation10.phpt +++ b/ext/standard/tests/array/uasort_variation10.phpt @@ -11,7 +11,7 @@ Test uasort() function : usage variations - sort array with reference variables * Testing uasort() with 'array_arg' containing different reference variables */ -// comparison function +// comparision function /* Prototype : int cmp_function(mixed $value1, mixed $value2) * Parameters : $value1 and $value2 - values to be compared * Return value : 0 - if both values are same diff --git a/ext/standard/tests/array/uasort_variation4.phpt b/ext/standard/tests/array/uasort_variation4.phpt index 0ed797fb87206..c2844bfd24169 100644 --- a/ext/standard/tests/array/uasort_variation4.phpt +++ b/ext/standard/tests/array/uasort_variation4.phpt @@ -12,7 +12,7 @@ Test uasort() function : usage variations - sort different numeric values * integer, octal, hexadecimal & float */ -// comparison function +// comparision function /* Prototype : int cmp_function(mixed $value1, mixed $value2) * Parameters : $value1 and $value2 - values to be compared * Return value : 0 - if both values are same diff --git a/ext/standard/tests/file/bug41874.phpt b/ext/standard/tests/file/bug41874.phpt index 8cc1ce2e6e8ec..827f486d4ded8 100644 --- a/ext/standard/tests/file/bug41874.phpt +++ b/ext/standard/tests/file/bug41874.phpt @@ -6,9 +6,9 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) die('skip windows only test'); ?> --FILE-- --EXPECT-- The system cannot find the drive specified. diff --git a/ext/standard/tests/file/bug41874_2.phpt b/ext/standard/tests/file/bug41874_2.phpt index bf76a749fd82b..5d7b7cad8df75 100644 --- a/ext/standard/tests/file/bug41874_2.phpt +++ b/ext/standard/tests/file/bug41874_2.phpt @@ -10,7 +10,7 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) { ?> --FILE-- --EXPECT-- diff --git a/ext/standard/tests/file/bug41874_3.phpt b/ext/standard/tests/file/bug41874_3.phpt index 05095c6f10c78..4d7b139ad78c4 100644 --- a/ext/standard/tests/file/bug41874_3.phpt +++ b/ext/standard/tests/file/bug41874_3.phpt @@ -10,7 +10,7 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) { ?> --FILE-- --EXPECT-- The system cannot find the drive specified. \ No newline at end of file diff --git a/ext/standard/tests/file/chmod_basic-win32.phpt b/ext/standard/tests/file/chmod_basic-win32.phpt index 31d44c80aae38..ca224f7d113dd 100644 --- a/ext/standard/tests/file/chmod_basic-win32.phpt +++ b/ext/standard/tests/file/chmod_basic-win32.phpt @@ -1,5 +1,5 @@ --TEST-- -chmod() basic functionality +chmod() basic fuctionality --SKIPIF-- " if each element of stat1 is > than stat2 "<" if each element of stat1 is < than stat2 $fields = contains the key of the elements that needs to be compared. - type of the comparison is based on $op argument value + type of the comparision is based on $op argument value $flag = specify true to dump the stat1 and stat2 */ diff --git a/ext/standard/tests/file/lchown_error.phpt b/ext/standard/tests/file/lchown_error.phpt index bacbd93c82656..979959e280040 100644 --- a/ext/standard/tests/file/lchown_error.phpt +++ b/ext/standard/tests/file/lchown_error.phpt @@ -36,7 +36,7 @@ var_dump( lchown( $filename ) ); // More than expected arguments var_dump( lchown( $filename, $uid, 'foobar' ) ); -// Non-existent filename +// Non-existant filename var_dump( lchown( 'foobar_lchown.txt', $uid ) ); // Wrong argument types diff --git a/ext/standard/tests/file/symlink_to_symlink.phpt b/ext/standard/tests/file/symlink_to_symlink.phpt index 8b7ff65cf0d31..b7554f9bd07c2 100644 --- a/ext/standard/tests/file/symlink_to_symlink.phpt +++ b/ext/standard/tests/file/symlink_to_symlink.phpt @@ -19,8 +19,8 @@ symlink(basename($prefix . "_file"), $prefix . "_link1"); symlink(basename($prefix . "_link1"), $prefix . "_link2"); // symlink to a non-existent path -@unlink($prefix . "_nonexistent"); -symlink(basename($prefix . "_nonexistent"), $prefix . "_link3"); +@unlink($prefix . "_nonexistant"); +symlink(basename($prefix . "_nonexistant"), $prefix . "_link3"); // symlink to a regular file using an absolute path symlink($prefix . "_file", $prefix . "_link4"); @@ -45,6 +45,6 @@ unlink($prefix . "_file"); --EXPECTF-- %unicode|string%(%d) "symlink_to_symlink.php_file" %unicode|string%(%d) "symlink_to_symlink.php_link1" -%unicode|string%(%d) "symlink_to_symlink.php_nonexistent" +%unicode|string%(%d) "symlink_to_symlink.php_nonexistant" %unicode|string%(%d) "%s/symlink_to_symlink.php_file" %unicode|string%(%d) "%s/symlink_to_symlink.php_link4" diff --git a/ext/standard/tests/file/userstreams.phpt b/ext/standard/tests/file/userstreams.phpt index d39898bbe2aa4..b5a9707e95d14 100644 --- a/ext/standard/tests/file/userstreams.phpt +++ b/ext/standard/tests/file/userstreams.phpt @@ -158,7 +158,7 @@ class mystream } if (@stream_wrapper_register("bogus", "class_not_exist")) { - die("Registered a non-existent class!!!???"); + die("Registered a non-existant class!!!???"); } echo "Not Registered\n"; diff --git a/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt b/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt index c53b5153f851d..e242d45dcb491 100644 --- a/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt +++ b/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt @@ -1,12 +1,5 @@ --TEST-- dl() filename length checks (CVE-2007-4887) ---SKIPIF-- - --INI-- enable_dl=1 --FILE-- diff --git a/ext/standard/tests/mail/ezmlm_hash_variation1.phpt b/ext/standard/tests/mail/ezmlm_hash_variation1.phpt index 58957c84a98ca..aa1e521e9232f 100644 --- a/ext/standard/tests/mail/ezmlm_hash_variation1.phpt +++ b/ext/standard/tests/mail/ezmlm_hash_variation1.phpt @@ -24,8 +24,8 @@ class sample { //getting the resource $file_handle = fopen(__FILE__, "r"); -// array with different values for $delimiter -$delimiters = array ( +// array with different values for $delimeter +$delimeters = array ( // integer values 0, @@ -68,13 +68,13 @@ $delimiters = array ( @$unset_var ); -// loop through with each element of the $delimiters array to test explode() function +// loop through with each element of the $delimeters array to test explode() function $count = 1; $string = "piece1 piece2 piece3 piece4 piece5 piece6"; $limit = 5; -foreach($delimiters as $delimiter) { +foreach($delimeters as $delimeter) { echo "-- Iteration $count --\n"; - var_dump( explode($delimiter, $string, $limit) ); + var_dump( explode($delimeter, $string, $limit) ); $count ++; } diff --git a/ext/standard/tests/network/ip2long_variation2_x64.phpt b/ext/standard/tests/network/ip2long_variation2_x64.phpt index a6fde5bdd9858..d4b62fbca8b4f 100644 --- a/ext/standard/tests/network/ip2long_variation2_x64.phpt +++ b/ext/standard/tests/network/ip2long_variation2_x64.phpt @@ -1,21 +1,13 @@ --TEST-- Test ip2long() function : usage variation 2, 64 bit --SKIPIF-- - + --FILE-- ===Done=== diff --git a/ext/standard/tests/strings/explode_variation1.phpt b/ext/standard/tests/strings/explode_variation1.phpt index f16f69bece13c..9c9ce116959b0 100644 --- a/ext/standard/tests/strings/explode_variation1.phpt +++ b/ext/standard/tests/strings/explode_variation1.phpt @@ -24,8 +24,8 @@ class sample { //getting the resource $file_handle = fopen(__FILE__, "r"); -// array with different values for $delimiter -$delimiters = array ( +// array with different values for $delimeter +$delimeters = array ( // integer values /*1*/ 0, @@ -68,13 +68,13 @@ $delimiters = array ( /*22*/ @$unset_var ); -// loop through with each element of the $delimiters array to test explode() function +// loop through with each element of the $delimeters array to test explode() function $count = 1; $string = "piece1 piece2 piece3 piece4 piece5 piece6"; $limit = 5; -foreach($delimiters as $delimiter) { +foreach($delimeters as $delimeter) { echo "-- Iteration $count --\n"; - var_dump( explode($delimiter, $string, $limit) ); + var_dump( explode($delimeter, $string, $limit) ); $count ++; } diff --git a/ext/standard/tests/strings/explode_variation2.phpt b/ext/standard/tests/strings/explode_variation2.phpt index 4de4637ac14bf..9e1f72c5ac9b7 100644 --- a/ext/standard/tests/strings/explode_variation2.phpt +++ b/ext/standard/tests/strings/explode_variation2.phpt @@ -70,11 +70,11 @@ $strings = array ( // loop through with each element of the $strings array to test explode() function $count = 1; -$delimiter = " "; +$delimeter = " "; $limit = 5; foreach($strings as $string) { echo "-- Iteration $count --\n"; - var_dump( explode($delimiter, $string, $limit) ); + var_dump( explode($delimeter, $string, $limit) ); $count ++; } diff --git a/ext/standard/tests/strings/explode_variation3.phpt b/ext/standard/tests/strings/explode_variation3.phpt index 2e878931076e7..54d5222caa97b 100644 --- a/ext/standard/tests/strings/explode_variation3.phpt +++ b/ext/standard/tests/strings/explode_variation3.phpt @@ -24,7 +24,7 @@ class sample { //getting the resource $file_handle = fopen(__FILE__, "r"); -// array with different values for $delimiter +// array with different values for $delimeter $limits = array ( // integer values @@ -70,11 +70,11 @@ $limits = array ( // loop through with each element of the $limits array to test explode() function $count = 1; -$delimiter = " "; +$delimeter = " "; $string = "piece1 piece2 piece3 piece4 piece5 piece6"; foreach($limits as $limit) { echo "-- Iteration $count --\n"; - var_dump( explode($delimiter, $string, $limit) ); + var_dump( explode($delimeter, $string, $limit) ); $count ++; } diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt index 3997c54b59eb3b86777b64b58f7ce67f25acac55..4d3502f18ab135a9c6811b0c529aaaebdefa6f91 100644 GIT binary patch delta 14 VcmeyY`$c!dA`ZsP&5Jk!`2aH>1;PLT delta 12 TcmeyO`&oCxB96_AIRg0rDQ^W? diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt index e603f4bbf8d425626d903fe40e94e344055db422..4c5bec898dd5dbce9d6189a4850975c3887b5006 100644 GIT binary patch delta 12 Tcmca-de?MA7w6_~&R{_RCo=^U delta 12 Tcmca>de3x27w6_q&JaNWCo2UL diff --git a/ext/standard/tests/strings/str_replace.phpt b/ext/standard/tests/strings/str_replace.phpt index 15c1c8e53d0dd..830378b9a1541 100644 --- a/ext/standard/tests/strings/str_replace.phpt +++ b/ext/standard/tests/strings/str_replace.phpt @@ -120,7 +120,7 @@ var_dump($count); echo "\n-- Testing objects --\n"; /* we get "Catchable fatal error: saying Object of class could not be converted to string" by default, when an object is passed instead of string: -The error can be avoided by choosing the __toString magix method as follows: */ +The error can be avoided by chosing the __toString magix method as follows: */ class subject { diff --git a/ext/standard/tests/strings/str_replace_variation3.phpt b/ext/standard/tests/strings/str_replace_variation3.phpt index 7b46f8b286967..9b19153fa818d 100644 --- a/ext/standard/tests/strings/str_replace_variation3.phpt +++ b/ext/standard/tests/strings/str_replace_variation3.phpt @@ -33,7 +33,7 @@ var_dump($count); echo "\n-- Testing objects --\n"; /* we get "Catchable fatal error: saying Object of class could not be converted to string" by default, when an object is passed instead of string: -The error can be avoided by choosing the __toString magix method as follows: */ +The error can be avoided by chosing the __toString magix method as follows: */ class subject { diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt index b3452cfd7c0f6322844e435ebd00b43f78dc060e..33694f987b83e5bce7854c957bf6f3b5e1473ccc 100644 GIT binary patch delta 14 WcmeynmhsP8#trPOn>kp&1_A&y5C#|k delta 14 Wcmeyfmhtae#trPOo7q^u1p)vx2L=}a diff --git a/ext/standard/tests/strings/strcmp.phpt b/ext/standard/tests/strings/strcmp.phpt index e77ed6e46620eae96697c74a01fb13ab62ad0dc9..0693880119111e28445dc0973dc009fbfe8fb0fb 100644 GIT binary patch delta 14 WcmX>+hw;!H#tq+DHveGp_5=Vm$_B0g delta 14 WcmX>!hw< --EXPECTF-- diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt index bdedb7e9f6719f8eb55e8fed9a16daa8872335fc..b135258f882e7daa4f120c8750a74153dc61a3a2 100644 GIT binary patch delta 12 TcmZ1+v?yr94YtiU*}RkhC!+;+ delta 12 TcmZ1!v^Z$P4YtkK*}RniCz}Oz diff --git a/ext/standard/tests/strings/substr_replace_error.phpt b/ext/standard/tests/strings/substr_replace_error.phpt index fd314cbd9d275..7d3a695d4ebf7 100644 --- a/ext/standard/tests/strings/substr_replace_error.phpt +++ b/ext/standard/tests/strings/substr_replace_error.phpt @@ -26,7 +26,7 @@ echo "\n-- Testing substr_replace() function with start and length different typ var_dump(substr_replace($s1, "evening", array(5))); var_dump(substr_replace($s1, "evening", 5, array(8))); -echo "\n-- Testing substr_replace() function with start and length with a different number of elements --\n"; +echo "\n-- Testing substr_replace() function with start and length with a different number of elments --\n"; var_dump(substr_replace($s1, "evening", array(5, 1), array(8))); echo "\n-- Testing substr_replace() function with start and length as arrays but string not--\n"; @@ -58,7 +58,7 @@ string(12) "Good morning" Warning: substr_replace(): 'from' and 'len' should be of same type - numerical or array in %s on line %d string(12) "Good morning" --- Testing substr_replace() function with start and length with a different number of elements -- +-- Testing substr_replace() function with start and length with a different number of elments -- Warning: substr_replace(): 'from' and 'len' should have the same number of elements in %s on line %d string(12) "Good morning" diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt index 468f7f034e6d10142893677f957b78d983df1cb1..bae40955dbe78b4de4b31fae75333b6946bc90a2 100644 GIT binary patch delta 12 Tcmcbme^Y http://::#: array(2) { - ["scheme"]=> - string(4) "http" - ["host"]=> - string(1) ":" -} - --> x://::6.5: array(3) { ["scheme"]=> string(1) "x" @@ -863,8 +856,6 @@ echo "Done"; --> http://?: bool(false) ---> http://#: bool(false) - --> http://?:: bool(false) --> http://:?: bool(false) @@ -872,4 +863,4 @@ echo "Done"; --> http://blah.com:123456: bool(false) --> http://blah.com:abcdef: bool(false) -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_002.phpt b/ext/standard/tests/url/parse_url_basic_002.phpt index ed0f08a84f534..464e977ffc7a4 100644 --- a/ext/standard/tests/url/parse_url_basic_002.phpt +++ b/ext/standard/tests/url/parse_url_basic_002.phpt @@ -96,7 +96,6 @@ echo "Done"; --> x:/blah.com : string(1) "x" --> x://::abc/? : bool(false) --> http://::? : string(4) "http" ---> http://::# : string(4) "http" --> x://::6.5 : string(1) "x" --> http://?:/ : string(4) "http" --> http://@?:/ : string(4) "http" @@ -119,9 +118,8 @@ echo "Done"; --> http://@:/ : bool(false) --> http://:/ : bool(false) --> http://? : bool(false) ---> http://# : bool(false) --> http://?: : bool(false) --> http://:? : bool(false) --> http://blah.com:123456 : bool(false) --> http://blah.com:abcdef : bool(false) -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_003.phpt b/ext/standard/tests/url/parse_url_basic_003.phpt index a2bbfa6482bd6..57f182bfa311d 100644 --- a/ext/standard/tests/url/parse_url_basic_003.phpt +++ b/ext/standard/tests/url/parse_url_basic_003.phpt @@ -95,7 +95,6 @@ echo "Done"; --> x:/blah.com : NULL --> x://::abc/? : bool(false) --> http://::? : string(1) ":" ---> http://::# : string(1) ":" --> x://::6.5 : string(1) ":" --> http://?:/ : string(1) "?" --> http://@?:/ : string(1) "?" @@ -118,9 +117,8 @@ echo "Done"; --> http://@:/ : bool(false) --> http://:/ : bool(false) --> http://? : bool(false) ---> http://# : bool(false) --> http://?: : bool(false) --> http://:? : bool(false) --> http://blah.com:123456 : bool(false) --> http://blah.com:abcdef : bool(false) -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_004.phpt b/ext/standard/tests/url/parse_url_basic_004.phpt index 839ebee554fff..6abf4ed453c9e 100644 --- a/ext/standard/tests/url/parse_url_basic_004.phpt +++ b/ext/standard/tests/url/parse_url_basic_004.phpt @@ -95,7 +95,6 @@ echo "Done"; --> x:/blah.com : NULL --> x://::abc/? : bool(false) --> http://::? : NULL ---> http://::# : NULL --> x://::6.5 : int(6) --> http://?:/ : NULL --> http://@?:/ : NULL @@ -118,9 +117,8 @@ echo "Done"; --> http://@:/ : bool(false) --> http://:/ : bool(false) --> http://? : bool(false) ---> http://# : bool(false) --> http://?: : bool(false) --> http://:? : bool(false) --> http://blah.com:123456 : bool(false) --> http://blah.com:abcdef : bool(false) -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_005.phpt b/ext/standard/tests/url/parse_url_basic_005.phpt index c113461fe7591..3bcc89106d2e4 100644 --- a/ext/standard/tests/url/parse_url_basic_005.phpt +++ b/ext/standard/tests/url/parse_url_basic_005.phpt @@ -95,7 +95,6 @@ echo "Done"; --> x:/blah.com : NULL --> x://::abc/? : bool(false) --> http://::? : NULL ---> http://::# : NULL --> x://::6.5 : NULL --> http://?:/ : NULL --> http://@?:/ : string(0) "" @@ -118,9 +117,8 @@ echo "Done"; --> http://@:/ : bool(false) --> http://:/ : bool(false) --> http://? : bool(false) ---> http://# : bool(false) --> http://?: : bool(false) --> http://:? : bool(false) --> http://blah.com:123456 : bool(false) --> http://blah.com:abcdef : bool(false) -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_006.phpt b/ext/standard/tests/url/parse_url_basic_006.phpt index 24de1cc23384f..741a424a616d9 100644 --- a/ext/standard/tests/url/parse_url_basic_006.phpt +++ b/ext/standard/tests/url/parse_url_basic_006.phpt @@ -95,7 +95,6 @@ echo "Done"; --> x:/blah.com : NULL --> x://::abc/? : bool(false) --> http://::? : NULL ---> http://::# : NULL --> x://::6.5 : NULL --> http://?:/ : NULL --> http://@?:/ : NULL @@ -118,9 +117,8 @@ echo "Done"; --> http://@:/ : bool(false) --> http://:/ : bool(false) --> http://? : bool(false) ---> http://# : bool(false) --> http://?: : bool(false) --> http://:? : bool(false) --> http://blah.com:123456 : bool(false) --> http://blah.com:abcdef : bool(false) -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_007.phpt b/ext/standard/tests/url/parse_url_basic_007.phpt index d4006879f4e99..bf8f98042e63f 100644 --- a/ext/standard/tests/url/parse_url_basic_007.phpt +++ b/ext/standard/tests/url/parse_url_basic_007.phpt @@ -95,7 +95,6 @@ echo "Done"; --> x:/blah.com : string(9) "/blah.com" --> x://::abc/? : bool(false) --> http://::? : NULL ---> http://::# : NULL --> x://::6.5 : NULL --> http://?:/ : string(1) "/" --> http://@?:/ : string(1) "/" @@ -118,9 +117,8 @@ echo "Done"; --> http://@:/ : bool(false) --> http://:/ : bool(false) --> http://? : bool(false) ---> http://# : bool(false) --> http://?: : bool(false) --> http://:? : bool(false) --> http://blah.com:123456 : bool(false) --> http://blah.com:abcdef : bool(false) -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_008.phpt b/ext/standard/tests/url/parse_url_basic_008.phpt index b283829c46624..a61fd06943cc0 100644 --- a/ext/standard/tests/url/parse_url_basic_008.phpt +++ b/ext/standard/tests/url/parse_url_basic_008.phpt @@ -95,7 +95,6 @@ echo "Done"; --> x:/blah.com : NULL --> x://::abc/? : bool(false) --> http://::? : NULL ---> http://::# : NULL --> x://::6.5 : NULL --> http://?:/ : NULL --> http://@?:/ : NULL @@ -118,9 +117,8 @@ echo "Done"; --> http://@:/ : bool(false) --> http://:/ : bool(false) --> http://? : bool(false) ---> http://# : bool(false) --> http://?: : bool(false) --> http://:? : bool(false) --> http://blah.com:123456 : bool(false) --> http://blah.com:abcdef : bool(false) -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_009.phpt b/ext/standard/tests/url/parse_url_basic_009.phpt index a7d70f34da7ec..5302388f6f515 100644 --- a/ext/standard/tests/url/parse_url_basic_009.phpt +++ b/ext/standard/tests/url/parse_url_basic_009.phpt @@ -95,7 +95,6 @@ echo "Done"; --> x:/blah.com : NULL --> x://::abc/? : bool(false) --> http://::? : NULL ---> http://::# : NULL --> x://::6.5 : NULL --> http://?:/ : NULL --> http://@?:/ : NULL @@ -118,9 +117,8 @@ echo "Done"; --> http://@:/ : bool(false) --> http://:/ : bool(false) --> http://? : bool(false) ---> http://# : bool(false) --> http://?: : bool(false) --> http://:? : bool(false) --> http://blah.com:123456 : bool(false) --> http://blah.com:abcdef : bool(false) -Done +Done \ No newline at end of file diff --git a/ext/standard/tests/url/urls.inc b/ext/standard/tests/url/urls.inc index 4192f4a869770..27521c852007e 100644 --- a/ext/standard/tests/url/urls.inc +++ b/ext/standard/tests/url/urls.inc @@ -75,7 +75,6 @@ $urls = array( 'x:/blah.com', 'x://::abc/?', 'http://::?', -'http://::#', 'x://::6.5', 'http://?:/', 'http://@?:/', @@ -100,7 +99,6 @@ $urls = array( 'http://@:/', 'http://:/', 'http://?', -'http://#', 'http://?:', 'http://:?', 'http://blah.com:123456', @@ -108,4 +106,4 @@ $urls = array( ); -?> +?> \ No newline at end of file diff --git a/ext/standard/type.c b/ext/standard/type.c index 12fcd6494caf0..5d93f66f5b725 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -92,9 +92,9 @@ PHP_FUNCTION(settype) { zval **var; char *type; - zend_str_size type_len = 0; + int type_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZS", &var, &type, &type_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zs", &var, &type, &type_len) == FAILURE) { return; } @@ -326,7 +326,7 @@ PHP_FUNCTION(is_numeric) break; case IS_STRING: - if (is_numeric_string(Z_STRVAL_PP(arg), Z_STRSIZE_PP(arg), NULL, NULL, 0)) { + if (is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), NULL, NULL, 0)) { RETURN_TRUE; } else { RETURN_FALSE; diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c index 993f42f4cf268..eac389c26c459 100644 --- a/ext/standard/uniqid.c +++ b/ext/standard/uniqid.c @@ -50,11 +50,10 @@ PHP_FUNCTION(uniqid) zend_bool more_entropy = 0; #endif char *uniqid; - int sec, usec; - zend_str_size prefix_len = 0; + int sec, usec, prefix_len = 0; struct timeval tv; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|Sb", &prefix, &prefix_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sb", &prefix, &prefix_len, &more_entropy)) { return; } diff --git a/ext/standard/url.c b/ext/standard/url.c index 16069bad0f42e..94f6638d64721 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -61,7 +61,7 @@ PHPAPI void php_url_free(php_url *theurl) /* {{{ php_replace_controlchars */ -PHPAPI char *php_replace_controlchars_ex(char *str, zend_str_size_int len) +PHPAPI char *php_replace_controlchars_ex(char *str, int len) { unsigned char *s = (unsigned char *)str; unsigned char *e = (unsigned char *)str + len; @@ -94,7 +94,7 @@ PHPAPI php_url *php_url_parse(char const *str) /* {{{ php_url_parse */ -PHPAPI php_url *php_url_parse_ex(char const *str, zend_str_size_int length) +PHPAPI php_url *php_url_parse_ex(char const *str, int length) { char port_buf[6]; php_url *ret = ecalloc(1, sizeof(php_url)); @@ -266,7 +266,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, zend_str_size_int length) p = s; } else { /* memrchr is a GNU specific extension - Emulate for wide compatibility */ + Emulate for wide compatability */ for(p = e; *p != ':' && p >= s; p--); } @@ -375,11 +375,11 @@ PHPAPI php_url *php_url_parse_ex(char const *str, zend_str_size_int length) PHP_FUNCTION(parse_url) { char *str; - zend_str_size_int str_len; + int str_len; php_url *resource; long key = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &str_len, &key) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &key) == FAILURE) { return; } @@ -485,7 +485,7 @@ static unsigned char hexchars[] = "0123456789ABCDEF"; /* {{{ php_url_encode */ -PHPAPI char *php_url_encode(char const *s, zend_str_size_int len, zend_str_size_int *new_length) +PHPAPI char *php_url_encode(char const *s, int len, int *new_length) { register unsigned char c; unsigned char *to, *start; @@ -534,9 +534,9 @@ PHPAPI char *php_url_encode(char const *s, zend_str_size_int len, zend_str_size_ PHP_FUNCTION(urlencode) { char *in_str, *out_str; - zend_str_size_int in_str_len, out_str_len; + int in_str_len, out_str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &in_str, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str, &in_str_len) == FAILURE) { return; } @@ -551,9 +551,9 @@ PHP_FUNCTION(urlencode) PHP_FUNCTION(urldecode) { char *in_str, *out_str; - zend_str_size_int in_str_len, out_str_len; + int in_str_len, out_str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &in_str, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str, &in_str_len) == FAILURE) { return; } @@ -567,7 +567,7 @@ PHP_FUNCTION(urldecode) /* {{{ php_url_decode */ -PHPAPI zend_str_size_int php_url_decode(char *str, zend_str_size_int len) +PHPAPI int php_url_decode(char *str, int len) { char *dest = str; char *data = str; @@ -598,7 +598,7 @@ PHPAPI zend_str_size_int php_url_decode(char *str, zend_str_size_int len) /* {{{ php_raw_url_encode */ -PHPAPI char *php_raw_url_encode(char const *s, zend_str_size_int len, zend_str_size_int *new_length) +PHPAPI char *php_raw_url_encode(char const *s, int len, int *new_length) { register int x, y; unsigned char *str; @@ -635,9 +635,9 @@ PHPAPI char *php_raw_url_encode(char const *s, zend_str_size_int len, zend_str_s PHP_FUNCTION(rawurlencode) { char *in_str, *out_str; - zend_str_size_int in_str_len, out_str_len; + int in_str_len, out_str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &in_str, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str, &in_str_len) == FAILURE) { return; } @@ -652,9 +652,9 @@ PHP_FUNCTION(rawurlencode) PHP_FUNCTION(rawurldecode) { char *in_str, *out_str; - zend_str_size_int in_str_len, out_str_len; + int in_str_len, out_str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &in_str, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str, &in_str_len) == FAILURE) { return; } @@ -668,7 +668,7 @@ PHP_FUNCTION(rawurldecode) /* {{{ php_raw_url_decode */ -PHPAPI zend_str_size_int php_raw_url_decode(char *str, zend_str_size_int len) +PHPAPI int php_raw_url_decode(char *str, int len) { char *dest = str; char *data = str; @@ -699,7 +699,7 @@ PHPAPI zend_str_size_int php_raw_url_decode(char *str, zend_str_size_int len) PHP_FUNCTION(get_headers) { char *url; - zend_str_size_int url_len; + int url_len; php_stream_context *context; php_stream *stream; zval **prev_val, **hdr = NULL, **h; @@ -707,7 +707,7 @@ PHP_FUNCTION(get_headers) HashTable *hashT; long format = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &url, &url_len, &format) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &url, &url_len, &format) == FAILURE) { return; } context = FG(default_context) ? FG(default_context) : (FG(default_context) = php_stream_context_alloc(TSRMLS_C)); @@ -743,7 +743,7 @@ PHP_FUNCTION(get_headers) } if (!format) { no_name_header: - add_next_index_stringl(return_value, Z_STRVAL_PP(hdr), Z_STRSIZE_PP(hdr), 1); + add_next_index_stringl(return_value, Z_STRVAL_PP(hdr), Z_STRLEN_PP(hdr), 1); } else { char c; char *s, *p; @@ -757,10 +757,10 @@ PHP_FUNCTION(get_headers) } if (zend_hash_find(HASH_OF(return_value), Z_STRVAL_PP(hdr), (p - Z_STRVAL_PP(hdr) + 1), (void **) &prev_val) == FAILURE) { - add_assoc_stringl_ex(return_value, Z_STRVAL_PP(hdr), (p - Z_STRVAL_PP(hdr) + 1), s, (Z_STRSIZE_PP(hdr) - (s - Z_STRVAL_PP(hdr))), 1); + add_assoc_stringl_ex(return_value, Z_STRVAL_PP(hdr), (p - Z_STRVAL_PP(hdr) + 1), s, (Z_STRLEN_PP(hdr) - (s - Z_STRVAL_PP(hdr))), 1); } else { /* some headers may occur more then once, therefor we need to remake the string into an array */ convert_to_array(*prev_val); - add_next_index_stringl(*prev_val, s, (Z_STRSIZE_PP(hdr) - (s - Z_STRVAL_PP(hdr))), 1); + add_next_index_stringl(*prev_val, s, (Z_STRLEN_PP(hdr) - (s - Z_STRVAL_PP(hdr))), 1); } *p = c; diff --git a/ext/standard/url.h b/ext/standard/url.h index 03e0068221b46..87e2efbc73d29 100644 --- a/ext/standard/url.h +++ b/ext/standard/url.h @@ -33,11 +33,11 @@ typedef struct php_url { PHPAPI void php_url_free(php_url *theurl); PHPAPI php_url *php_url_parse(char const *str); -PHPAPI php_url *php_url_parse_ex(char const *str, zend_str_size_int length); -PHPAPI zend_str_size_int php_url_decode(char *str, zend_str_size_int len); /* return value: length of decoded string */ -PHPAPI zend_str_size_int php_raw_url_decode(char *str, zend_str_size_int len); /* return value: length of decoded string */ -PHPAPI char *php_url_encode(char const *s, zend_str_size_int len, zend_str_size_int *new_length); -PHPAPI char *php_raw_url_encode(char const *s, zend_str_size_int len, zend_str_size_int *new_length); +PHPAPI php_url *php_url_parse_ex(char const *str, int length); +PHPAPI int php_url_decode(char *str, int len); /* return value: length of decoded string */ +PHPAPI int php_raw_url_decode(char *str, int len); /* return value: length of decoded string */ +PHPAPI char *php_url_encode(char const *s, int len, int *new_length); +PHPAPI char *php_raw_url_encode(char const *s, int len, int *new_length); PHP_FUNCTION(parse_url); PHP_FUNCTION(urlencode); diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index ef44bb670d108..cb5983f685d52 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -1,5 +1,5 @@ /* Generated by re2c 0.13.5 */ -#line 1 "url_scanner_ex.re" +#line 1 "ext/standard/url_scanner_ex.re" /* +----------------------------------------------------------------------+ | PHP Version 5 | @@ -74,7 +74,7 @@ static PHP_INI_MH(OnUpdateTags) val = strchr(key, '='); if (val) { char *q; - zend_str_size_int keylen; + int keylen; *val++ = '\0'; for (q = key; *q; q++) @@ -95,7 +95,7 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("url_rewriter.tags", "a=href,area=href,frame=src,form=,fieldset=", PHP_INI_ALL, OnUpdateTags, url_adapt_state_ex, php_basic_globals, basic_globals) PHP_INI_END() -#line 102 "url_scanner_ex.re" +#line 102 "ext/standard/url_scanner_ex.re" #define YYFILL(n) goto done @@ -114,7 +114,7 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st scan: -#line 118 "url_scanner_ex.c" +#line 118 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -160,19 +160,19 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st if (yych <= '9') goto yy6; if (yych >= ';') goto yy4; ++YYCURSOR; -#line 120 "url_scanner_ex.re" +#line 120 "ext/standard/url_scanner_ex.re" { smart_str_append(dest, url); return; } -#line 166 "url_scanner_ex.c" +#line 166 "ext/standard/url_scanner_ex.c" yy4: ++YYCURSOR; -#line 121 "url_scanner_ex.re" +#line 121 "ext/standard/url_scanner_ex.re" { sep = separator; goto scan; } -#line 171 "url_scanner_ex.c" +#line 171 "ext/standard/url_scanner_ex.c" yy6: ++YYCURSOR; -#line 122 "url_scanner_ex.re" +#line 122 "ext/standard/url_scanner_ex.re" { bash = p - 1; goto done; } -#line 176 "url_scanner_ex.c" +#line 176 "ext/standard/url_scanner_ex.c" yy8: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -180,11 +180,11 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st if (yybm[0+yych] & 128) { goto yy8; } -#line 123 "url_scanner_ex.re" +#line 123 "ext/standard/url_scanner_ex.re" { goto scan; } -#line 186 "url_scanner_ex.c" +#line 186 "ext/standard/url_scanner_ex.c" } -#line 124 "url_scanner_ex.re" +#line 124 "ext/standard/url_scanner_ex.re" done: @@ -364,7 +364,7 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s state_plain: start = YYCURSOR; -#line 368 "url_scanner_ex.c" +#line 368 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -407,9 +407,9 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s goto yy15; } ++YYCURSOR; -#line 303 "url_scanner_ex.re" +#line 303 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; } -#line 413 "url_scanner_ex.c" +#line 413 "ext/standard/url_scanner_ex.c" yy15: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -417,17 +417,17 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s if (yybm[0+yych] & 128) { goto yy15; } -#line 304 "url_scanner_ex.re" +#line 304 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_plain; } -#line 423 "url_scanner_ex.c" +#line 423 "ext/standard/url_scanner_ex.c" } -#line 305 "url_scanner_ex.re" +#line 305 "ext/standard/url_scanner_ex.re" state_tag: start = YYCURSOR; -#line 431 "url_scanner_ex.c" +#line 431 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -478,14 +478,14 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s yych = *YYCURSOR; goto yy25; yy21: -#line 310 "url_scanner_ex.re" +#line 310 "ext/standard/url_scanner_ex.re" { handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; } -#line 484 "url_scanner_ex.c" +#line 484 "ext/standard/url_scanner_ex.c" yy22: ++YYCURSOR; -#line 311 "url_scanner_ex.re" +#line 311 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_plain_begin; } -#line 489 "url_scanner_ex.c" +#line 489 "ext/standard/url_scanner_ex.c" yy24: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -496,7 +496,7 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s } goto yy21; } -#line 312 "url_scanner_ex.re" +#line 312 "ext/standard/url_scanner_ex.re" state_next_arg_begin: @@ -505,7 +505,7 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s state_next_arg: start = YYCURSOR; -#line 509 "url_scanner_ex.c" +#line 509 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -544,78 +544,65 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; - if (yych <= '.') { + if (yych <= ' ') { if (yych <= '\f') { - if (yych <= 0x08) goto yy36; - if (yych <= '\v') goto yy32; - goto yy36; + if (yych <= 0x08) goto yy34; + if (yych <= '\v') goto yy30; + goto yy34; } else { - if (yych <= '\r') goto yy32; - if (yych == ' ') goto yy32; - goto yy36; + if (yych <= '\r') goto yy30; + if (yych <= 0x1F) goto yy34; + goto yy30; } } else { if (yych <= '@') { - if (yych <= '/') goto yy28; - if (yych == '>') goto yy30; - goto yy36; + if (yych != '>') goto yy34; } else { - if (yych <= 'Z') goto yy34; - if (yych <= '`') goto yy36; - if (yych <= 'z') goto yy34; - goto yy36; + if (yych <= 'Z') goto yy32; + if (yych <= '`') goto yy34; + if (yych <= 'z') goto yy32; + goto yy34; } } -yy28: ++YYCURSOR; - if ((yych = *YYCURSOR) == '>') goto yy39; -yy29: -#line 323 "url_scanner_ex.re" - { passthru(STD_ARGS); goto state_plain_begin; } -#line 576 "url_scanner_ex.c" +#line 320 "ext/standard/url_scanner_ex.re" + { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } +#line 571 "ext/standard/url_scanner_ex.c" yy30: ++YYCURSOR; + yych = *YYCURSOR; + goto yy37; yy31: -#line 320 "url_scanner_ex.re" - { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } -#line 582 "url_scanner_ex.c" +#line 321 "ext/standard/url_scanner_ex.re" + { passthru(STD_ARGS); goto state_next_arg; } +#line 579 "ext/standard/url_scanner_ex.c" yy32: ++YYCURSOR; - yych = *YYCURSOR; - goto yy38; -yy33: -#line 321 "url_scanner_ex.re" - { passthru(STD_ARGS); goto state_next_arg; } -#line 590 "url_scanner_ex.c" +#line 322 "ext/standard/url_scanner_ex.re" + { --YYCURSOR; STATE = STATE_ARG; goto state_arg; } +#line 584 "ext/standard/url_scanner_ex.c" yy34: ++YYCURSOR; -#line 322 "url_scanner_ex.re" - { --YYCURSOR; STATE = STATE_ARG; goto state_arg; } -#line 595 "url_scanner_ex.c" +#line 323 "ext/standard/url_scanner_ex.re" + { passthru(STD_ARGS); goto state_plain_begin; } +#line 589 "ext/standard/url_scanner_ex.c" yy36: - yych = *++YYCURSOR; - goto yy29; -yy37: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy38: +yy37: if (yybm[0+yych] & 128) { - goto yy37; + goto yy36; } - goto yy33; -yy39: - ++YYCURSOR; - yych = *YYCURSOR; goto yy31; } -#line 324 "url_scanner_ex.re" +#line 324 "ext/standard/url_scanner_ex.re" state_arg: start = YYCURSOR; -#line 619 "url_scanner_ex.c" +#line 606 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -654,40 +641,40 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; - if (yych <= '@') goto yy44; - if (yych <= 'Z') goto yy42; - if (yych <= '`') goto yy44; - if (yych >= '{') goto yy44; -yy42: + if (yych <= '@') goto yy42; + if (yych <= 'Z') goto yy40; + if (yych <= '`') goto yy42; + if (yych >= '{') goto yy42; +yy40: ++YYCURSOR; yych = *YYCURSOR; - goto yy47; -yy43: -#line 329 "url_scanner_ex.re" + goto yy45; +yy41: +#line 329 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; } -#line 669 "url_scanner_ex.c" -yy44: +#line 656 "ext/standard/url_scanner_ex.c" +yy42: ++YYCURSOR; -#line 330 "url_scanner_ex.re" +#line 330 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; } -#line 674 "url_scanner_ex.c" -yy46: +#line 661 "ext/standard/url_scanner_ex.c" +yy44: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy47: +yy45: if (yybm[0+yych] & 128) { - goto yy46; + goto yy44; } - goto yy43; + goto yy41; } -#line 331 "url_scanner_ex.re" +#line 331 "ext/standard/url_scanner_ex.re" state_before_val: start = YYCURSOR; -#line 691 "url_scanner_ex.c" +#line 678 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -726,173 +713,200 @@ static inline void xx_mainloop(url_adapt_state_ex_t *ctx, const char *newdata, s }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; - if (yych == ' ') goto yy50; - if (yych == '=') goto yy52; - goto yy54; -yy50: + if (yych == ' ') goto yy48; + if (yych == '=') goto yy50; + goto yy52; +yy48: yych = *(YYMARKER = ++YYCURSOR); - if (yych == ' ') goto yy57; - if (yych == '=') goto yy55; -yy51: -#line 337 "url_scanner_ex.re" + if (yych == ' ') goto yy55; + if (yych == '=') goto yy53; +yy49: +#line 337 "ext/standard/url_scanner_ex.re" { --YYCURSOR; goto state_next_arg_begin; } -#line 740 "url_scanner_ex.c" -yy52: +#line 727 "ext/standard/url_scanner_ex.c" +yy50: ++YYCURSOR; yych = *YYCURSOR; - goto yy56; -yy53: -#line 336 "url_scanner_ex.re" + goto yy54; +yy51: +#line 336 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; } -#line 748 "url_scanner_ex.c" -yy54: +#line 735 "ext/standard/url_scanner_ex.c" +yy52: yych = *++YYCURSOR; - goto yy51; -yy55: + goto yy49; +yy53: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy56: +yy54: if (yybm[0+yych] & 128) { - goto yy55; + goto yy53; } - goto yy53; -yy57: + goto yy51; +yy55: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yych == ' ') goto yy57; - if (yych == '=') goto yy55; + if (yych == ' ') goto yy55; + if (yych == '=') goto yy53; YYCURSOR = YYMARKER; - goto yy51; + goto yy49; } -#line 338 "url_scanner_ex.re" +#line 338 "ext/standard/url_scanner_ex.re" state_val: start = YYCURSOR; -#line 777 "url_scanner_ex.c" +#line 764 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 192, 192, 224, 224, 192, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 192, 224, 64, 224, 224, 224, 224, 128, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 0, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 160, 160, 248, 248, 160, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 160, 248, 56, 248, 248, 248, 248, 200, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 0, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 248, 248, }; - if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; if (yych <= ' ') { if (yych <= '\f') { - if (yych <= 0x08) goto yy65; - if (yych <= '\n') goto yy67; - goto yy65; + if (yych <= 0x08) goto yy63; + if (yych <= '\n') goto yy64; + goto yy63; } else { - if (yych <= '\r') goto yy67; - if (yych <= 0x1F) goto yy65; - goto yy67; + if (yych <= '\r') goto yy64; + if (yych <= 0x1F) goto yy63; + goto yy64; } } else { if (yych <= '&') { - if (yych != '"') goto yy65; + if (yych != '"') goto yy63; } else { - if (yych <= '\'') goto yy64; - if (yych == '>') goto yy67; - goto yy65; + if (yych <= '\'') goto yy62; + if (yych == '>') goto yy64; + goto yy63; } } yych = *(YYMARKER = ++YYCURSOR); - if (yych != '>') goto yy76; + goto yy77; +yy61: +#line 346 "ext/standard/url_scanner_ex.re" + { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } +#line 827 "ext/standard/url_scanner_ex.c" +yy62: + yych = *(YYMARKER = ++YYCURSOR); + goto yy69; yy63: -#line 347 "url_scanner_ex.re" - { passthru(STD_ARGS); goto state_next_arg_begin; } -#line 840 "url_scanner_ex.c" + yych = *++YYCURSOR; + goto yy67; yy64: - yych = *(YYMARKER = ++YYCURSOR); - if (yych == '>') goto yy63; - goto yy71; -yy65: ++YYCURSOR; - yych = *YYCURSOR; - goto yy69; +#line 347 "ext/standard/url_scanner_ex.re" + { passthru(STD_ARGS); goto state_next_arg_begin; } +#line 838 "ext/standard/url_scanner_ex.c" yy66: -#line 346 "url_scanner_ex.re" - { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } -#line 852 "url_scanner_ex.c" -yy67: - yych = *++YYCURSOR; - goto yy63; -yy68: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; +yy67: + if (yybm[0+yych] & 8) { + goto yy66; + } + goto yy61; +yy68: + YYMARKER = ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; yy69: - if (yybm[0+yych] & 32) { + if (yybm[0+yych] & 16) { goto yy68; } - goto yy66; -yy70: + if (yych <= '&') goto yy72; + if (yych >= '(') goto yy61; + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy66; + } +yy71: +#line 345 "ext/standard/url_scanner_ex.re" + { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; } +#line 865 "ext/standard/url_scanner_ex.c" +yy72: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy71: - if (yybm[0+yych] & 64) { - goto yy70; + if (yybm[0+yych] & 32) { + goto yy72; } - if (yych <= '=') goto yy73; -yy72: + if (yych <= '=') goto yy75; +yy74: YYCURSOR = YYMARKER; - goto yy63; -yy73: - ++YYCURSOR; -#line 345 "url_scanner_ex.re" - { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; } -#line 881 "url_scanner_ex.c" + goto yy61; yy75: + yych = *++YYCURSOR; + goto yy71; +yy76: + YYMARKER = ++YYCURSOR; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; +yy77: + if (yybm[0+yych] & 64) { + goto yy76; + } + if (yych <= '!') goto yy80; + if (yych >= '#') goto yy61; + ++YYCURSOR; + if (yybm[0+(yych = *YYCURSOR)] & 8) { + goto yy66; + } +yy79: +#line 344 "ext/standard/url_scanner_ex.re" + { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; } +#line 897 "ext/standard/url_scanner_ex.c" +yy80: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy76: if (yybm[0+yych] & 128) { - goto yy75; + goto yy80; } - if (yych >= '>') goto yy72; + if (yych >= '>') goto yy74; ++YYCURSOR; -#line 344 "url_scanner_ex.re" - { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; } -#line 894 "url_scanner_ex.c" + yych = *YYCURSOR; + goto yy79; } -#line 348 "url_scanner_ex.re" +#line 348 "ext/standard/url_scanner_ex.re" stop: @@ -978,7 +992,7 @@ static int php_url_scanner_ex_deactivate(TSRMLS_D) return SUCCESS; } -static void php_url_scanner_output_handler(char *output, zend_str_size_uint output_len, char **handled_output, zend_str_size_uint *handled_output_len, int mode TSRMLS_DC) +static void php_url_scanner_output_handler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC) { size_t len; @@ -1009,10 +1023,10 @@ static void php_url_scanner_output_handler(char *output, zend_str_size_uint outp } } -PHPAPI int php_url_scanner_add_var(char *name, zend_str_size_int name_len, char *value, zend_str_size_int value_len, int urlencode TSRMLS_DC) +PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC) { char *encoded; - zend_str_size_int encoded_len; + int encoded_len; smart_str val; if (! BG(url_adapt_state_ex).active) { diff --git a/ext/standard/url_scanner_ex.h b/ext/standard/url_scanner_ex.h index 3ed9eb53e431a..667c56c1ec0f5 100644 --- a/ext/standard/url_scanner_ex.h +++ b/ext/standard/url_scanner_ex.h @@ -28,7 +28,7 @@ PHP_RINIT_FUNCTION(url_scanner_ex); PHP_RSHUTDOWN_FUNCTION(url_scanner_ex); PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen TSRMLS_DC); -PHPAPI int php_url_scanner_add_var(char *name, zend_str_size_int name_len, char *value, zend_str_size_int value_len, int urlencode TSRMLS_DC); +PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC); PHPAPI int php_url_scanner_reset_vars(TSRMLS_D); #include "php_smart_str_public.h" diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index 08175042181f0..760f725e983b1 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -72,7 +72,7 @@ static PHP_INI_MH(OnUpdateTags) val = strchr(key, '='); if (val) { char *q; - zend_str_size_int keylen; + int keylen; *val++ = '\0'; for (q = key; *q; q++) @@ -317,7 +317,7 @@ state_next_arg_begin: state_next_arg: start = YYCURSOR; /*!re2c - [/]? [>] { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } + ">" { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } [ \v\r\t\n]+ { passthru(STD_ARGS); goto state_next_arg; } alpha { --YYCURSOR; STATE = STATE_ARG; goto state_arg; } any { passthru(STD_ARGS); goto state_plain_begin; } @@ -343,7 +343,7 @@ state_val: /*!re2c ["] (any\[">])* ["] { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; } ['] (any\['>])* ['] { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; } - (any\[ \r\t\n>'"])+ { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } + (any\[ \r\t\n>])+ { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } any { passthru(STD_ARGS); goto state_next_arg_begin; } */ @@ -430,7 +430,7 @@ static int php_url_scanner_ex_deactivate(TSRMLS_D) return SUCCESS; } -static void php_url_scanner_output_handler(char *output, zend_str_size_uint output_len, char **handled_output, zend_str_size_uint *handled_output_len, int mode TSRMLS_DC) +static void php_url_scanner_output_handler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC) { size_t len; @@ -461,10 +461,10 @@ static void php_url_scanner_output_handler(char *output, zend_str_size_uint outp } } -PHPAPI int php_url_scanner_add_var(char *name, zend_str_size_int name_len, char *value, zend_str_size_int value_len, int urlencode TSRMLS_DC) +PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC) { char *encoded; - zend_str_size_int encoded_len; + int encoded_len; smart_str val; if (! BG(url_adapt_state_ex).active) { diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 130cbea07a476..b44be124a15eb 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -167,7 +167,7 @@ php_stream_filter_status_t userfilter_filter( php_stream_filter *thisfilter, php_stream_bucket_brigade *buckets_in, php_stream_bucket_brigade *buckets_out, - zend_str_size_size_t *bytes_consumed, + size_t *bytes_consumed, int flags TSRMLS_DC) { @@ -283,7 +283,7 @@ static php_stream_filter *user_filter_factory_create(const char *filtername, zval *obj, *zfilter; zval func_name; zval *retval = NULL; - zend_str_size len; + int len; /* some sanity checks */ if (persistent) { @@ -462,9 +462,9 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS) if (!bucket->own_buf) { bucket = php_stream_bucket_make_writeable(bucket TSRMLS_CC); } - if (bucket->buflen != Z_STRSIZE_PP(pzdata)) { - bucket->buf = perealloc(bucket->buf, Z_STRSIZE_PP(pzdata), bucket->is_persistent); - bucket->buflen = Z_STRSIZE_PP(pzdata); + if ((int)bucket->buflen != Z_STRLEN_PP(pzdata)) { + bucket->buf = perealloc(bucket->buf, Z_STRLEN_PP(pzdata), bucket->is_persistent); + bucket->buflen = Z_STRLEN_PP(pzdata); } memcpy(bucket->buf, Z_STRVAL_PP(pzdata), bucket->buflen); } @@ -507,10 +507,10 @@ PHP_FUNCTION(stream_bucket_new) php_stream *stream; char *buffer; char *pbuffer; - zend_str_size buffer_len; + int buffer_len; php_stream_bucket *bucket; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zS", &zstream, &buffer, &buffer_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &zstream, &buffer, &buffer_len) == FAILURE) { RETURN_FALSE; } @@ -545,7 +545,7 @@ PHP_FUNCTION(stream_get_filters) { char *filter_name; int key_flags; - zend_str_size filter_name_len = 0; + uint filter_name_len = 0; HashTable *filters_hash; ulong num_key; @@ -559,7 +559,7 @@ PHP_FUNCTION(stream_get_filters) if (filters_hash) { for(zend_hash_internal_pointer_reset(filters_hash); - (key_flags = zend_hash_get_current_key_ex(filters_hash, &filter_name, &filter_name_len, &num_key, 0, NULL)) != HASH_KEY_NON_EXISTENT; + (key_flags = zend_hash_get_current_key_ex(filters_hash, &filter_name, &filter_name_len, &num_key, 0, NULL)) != HASH_KEY_NON_EXISTANT; zend_hash_move_forward(filters_hash)) if (key_flags == HASH_KEY_IS_STRING) { add_next_index_stringl(return_value, filter_name, filter_name_len - 1, 1); @@ -574,10 +574,10 @@ PHP_FUNCTION(stream_get_filters) PHP_FUNCTION(stream_filter_register) { char *filtername, *classname; - zend_str_size filtername_len, classname_len; + int filtername_len, classname_len; struct php_user_filter_data *fdat; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &filtername, &filtername_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &filtername, &filtername_len, &classname, &classname_len) == FAILURE) { RETURN_FALSE; } diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c index b44b01996be22..76701ff24b198 100644 --- a/ext/standard/uuencode.c +++ b/ext/standard/uuencode.c @@ -65,9 +65,9 @@ #define PHP_UU_DEC(c) (((c) - ' ') & 077) -PHPAPI zend_str_size_int php_uuencode(char *src, zend_str_size_int src_len, char **dest) /* {{{ */ +PHPAPI int php_uuencode(char *src, int src_len, char **dest) /* {{{ */ { - zend_str_size_int len = 45; + int len = 45; char *p, *s, *e, *ee; /* encoded length is ~ 38% greater than the original */ @@ -124,12 +124,11 @@ PHPAPI zend_str_size_int php_uuencode(char *src, zend_str_size_int src_len, char } /* }}} */ -PHPAPI zend_str_size_int php_uudecode(char *src, zend_str_size_int src_len, char **dest, int *error) /* {{{ */ +PHPAPI int php_uudecode(char *src, int src_len, char **dest) /* {{{ */ { - zend_str_size_int len, total_len=0; + int len, total_len=0; char *s, *e, *p, *ee; - *error = 0; p = *dest = safe_emalloc((size_t) ceil(src_len * 0.75), 1, 1); s = src; e = src + src_len; @@ -182,8 +181,7 @@ PHPAPI zend_str_size_int php_uudecode(char *src, zend_str_size_int src_len, char err: efree(*dest); - *error = 1; - return 0; + return -1; } /* }}} */ @@ -192,9 +190,9 @@ PHPAPI zend_str_size_int php_uudecode(char *src, zend_str_size_int src_len, char PHP_FUNCTION(convert_uuencode) { char *src, *dst; - zend_str_size_int src_len, dst_len; + int src_len, dst_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &src, &src_len) == FAILURE || src_len < 1) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &src, &src_len) == FAILURE || src_len < 1) { RETURN_FALSE; } @@ -209,15 +207,14 @@ PHP_FUNCTION(convert_uuencode) PHP_FUNCTION(convert_uudecode) { char *src, *dst; - zend_str_size_int src_len, dst_len; - int err = 0;; + int src_len, dst_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &src, &src_len) == FAILURE || src_len < 1) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &src, &src_len) == FAILURE || src_len < 1) { RETURN_FALSE; } - dst_len = php_uudecode(src, src_len, &dst, &err); - if (err) { + dst_len = php_uudecode(src, src_len, &dst); + if (dst_len < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The given parameter is not a valid uuencoded string"); RETURN_FALSE; } diff --git a/ext/standard/var.c b/ext/standard/var.c index f21bf40aec039..4acc6f57b7b71 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -63,7 +63,7 @@ static int php_object_property_dump(zval **zv TSRMLS_DC, int num_args, va_list a if (hash_key->nKeyLength == 0) { /* numeric key */ php_printf("%*c[%ld]=>\n", level + 1, ' ', hash_key->h); } else { /* string key */ - zend_str_size unmangle = zend_unmangle_property_name(hash_key->arKey, hash_key->nKeyLength - 1, &class_name, &prop_name); + int unmangle = zend_unmangle_property_name(hash_key->arKey, hash_key->nKeyLength - 1, &class_name, &prop_name); php_printf("%*c[", level + 1, ' '); if (class_name && unmangle == SUCCESS) { @@ -88,7 +88,7 @@ PHPAPI void php_var_dump(zval **struc, int level TSRMLS_DC) /* {{{ */ { HashTable *myht; const char *class_name; - zend_str_size class_name_len; + zend_uint class_name_len; int (*php_element_dump_func)(zval** TSRMLS_DC, int, va_list, zend_hash_key*); int is_temp; @@ -110,8 +110,8 @@ PHPAPI void php_var_dump(zval **struc, int level TSRMLS_DC) /* {{{ */ php_printf("%sfloat(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_PP(struc)); break; case IS_STRING: - php_printf("%sstring(%d) \"", COMMON, Z_STRSIZE_PP(struc)); - PHPWRITE(Z_STRVAL_PP(struc), Z_STRSIZE_PP(struc)); + php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_PP(struc)); + PHPWRITE(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc)); PUTS("\"\n"); break; case IS_ARRAY: @@ -243,7 +243,7 @@ PHPAPI void php_debug_zval_dump(zval **struc, int level TSRMLS_DC) /* {{{ */ { HashTable *myht = NULL; const char *class_name; - zend_str_size class_name_len; + zend_uint class_name_len; int (*zval_element_dump_func)(zval** TSRMLS_DC, int, va_list, zend_hash_key*); int is_temp = 0; @@ -265,8 +265,8 @@ PHPAPI void php_debug_zval_dump(zval **struc, int level TSRMLS_DC) /* {{{ */ php_printf("%sdouble(%.*G) refcount(%u)\n", COMMON, (int) EG(precision), Z_DVAL_PP(struc), Z_REFCOUNT_PP(struc)); break; case IS_STRING: - php_printf("%sstring(%d) \"", COMMON, Z_STRSIZE_PP(struc)); - PHPWRITE(Z_STRVAL_PP(struc), Z_STRSIZE_PP(struc)); + php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_PP(struc)); + PHPWRITE(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc)); php_printf("\" refcount(%u)\n", Z_REFCOUNT_PP(struc)); break; case IS_ARRAY: @@ -335,7 +335,7 @@ PHP_FUNCTION(debug_zval_dump) #define buffer_append_spaces(buf, num_spaces) \ do { \ char *tmp_spaces; \ - zend_str_size tmp_spaces_len; \ + int tmp_spaces_len; \ tmp_spaces_len = spprintf(&tmp_spaces, 0,"%*c", num_spaces, ' '); \ smart_str_appendl(buf, tmp_spaces, tmp_spaces_len); \ efree(tmp_spaces); \ @@ -356,7 +356,7 @@ static int php_array_element_export(zval **zv TSRMLS_DC, int num_args, va_list a } else { /* string key */ char *key, *tmp_str; - zend_str_size key_len, tmp_len; + int key_len, tmp_len; key = php_addcslashes(hash_key->arKey, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC); tmp_str = php_str_to_str_ex(key, key_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len, 0, NULL); @@ -391,7 +391,7 @@ static int php_object_element_export(zval **zv TSRMLS_DC, int num_args, va_list const char *class_name; /* ignored, but must be passed to unmangle */ const char *pname; char *pname_esc; - zend_str_size pname_esc_len; + int pname_esc_len; zend_unmangle_property_name(hash_key->arKey, hash_key->nKeyLength - 1, &class_name, &pname); @@ -417,9 +417,9 @@ PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC) { HashTable *myht; char *tmp_str, *tmp_str2; - zend_str_size tmp_len, tmp_len2; + int tmp_len, tmp_len2; const char *class_name; - zend_str_size class_name_len; + zend_uint class_name_len; switch (Z_TYPE_PP(struc)) { case IS_BOOL: @@ -441,7 +441,7 @@ PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC) efree(tmp_str); break; case IS_STRING: - tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRSIZE_PP(struc), &tmp_len, 0, "'\\", 2 TSRMLS_CC); + tmp_str = php_addcslashes(Z_STRVAL_PP(struc), Z_STRLEN_PP(struc), &tmp_len, 0, "'\\", 2 TSRMLS_CC); tmp_str2 = php_str_to_str_ex(tmp_str, tmp_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len2, 0, NULL); smart_str_appendc(buf, '\''); @@ -547,7 +547,7 @@ static inline int php_add_var_hash(HashTable *var_hash, zval *var, void *var_old { ulong var_no; char id[32], *p; - register zend_str_size len; + register int len; /* relies on "(long)" being a perfect hash function for data pointers, * however the actual identity of an object has had to be determined @@ -592,10 +592,10 @@ static inline void php_var_serialize_long(smart_str *buf, long val) /* {{{ */ } /* }}} */ -static inline void php_var_serialize_string(smart_str *buf, char *str, zend_str_size_int len) /* {{{ */ +static inline void php_var_serialize_string(smart_str *buf, char *str, int len) /* {{{ */ { smart_str_appendl(buf, "s:", 2); - smart_str_append_str_size(buf, len); + smart_str_append_long(buf, len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, str, len); smart_str_appendl(buf, "\";", 2); @@ -608,7 +608,7 @@ static inline zend_bool php_var_serialize_class_name(smart_str *buf, zval *struc PHP_SET_CLASS_ATTRIBUTES(struc); smart_str_appendl(buf, "O:", 2); - smart_str_append_str_size(buf, name_len); + smart_str_append_long(buf, (int)name_len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, class_name, name_len); smart_str_appendl(buf, "\":", 2); @@ -649,7 +649,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt for (;; zend_hash_move_forward_ex(HASH_OF(retval_ptr), &pos)) { i = zend_hash_get_current_key_ex(HASH_OF(retval_ptr), &key, NULL, &index, 0, &pos); - if (i == HASH_KEY_NON_EXISTENT) { + if (i == HASH_KEY_NON_EXISTANT) { break; } @@ -666,18 +666,18 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt continue; } propers = Z_OBJPROP_P(struc); - if (zend_hash_find(propers, Z_STRVAL_PP(name), Z_STRSIZE_PP(name) + 1, (void *) &d) == SUCCESS) { - php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRSIZE_PP(name)); + if (zend_hash_find(propers, Z_STRVAL_PP(name), Z_STRLEN_PP(name) + 1, (void *) &d) == SUCCESS) { + php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRLEN_PP(name)); php_var_serialize_intern(buf, *d, var_hash TSRMLS_CC); } else { zend_class_entry *ce; ce = zend_get_class_entry(struc TSRMLS_CC); if (ce) { char *prot_name, *priv_name; - zend_str_size prop_name_length; + int prop_name_length; do { - zend_mangle_property_name(&priv_name, &prop_name_length, ce->name, ce->name_length, Z_STRVAL_PP(name), Z_STRSIZE_PP(name), ce->type & ZEND_INTERNAL_CLASS); + zend_mangle_property_name(&priv_name, &prop_name_length, ce->name, ce->name_length, Z_STRVAL_PP(name), Z_STRLEN_PP(name), ce->type & ZEND_INTERNAL_CLASS); if (zend_hash_find(propers, priv_name, prop_name_length + 1, (void *) &d) == SUCCESS) { php_var_serialize_string(buf, priv_name, prop_name_length); pefree(priv_name, ce->type & ZEND_INTERNAL_CLASS); @@ -685,7 +685,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt break; } pefree(priv_name, ce->type & ZEND_INTERNAL_CLASS); - zend_mangle_property_name(&prot_name, &prop_name_length, "*", 1, Z_STRVAL_PP(name), Z_STRSIZE_PP(name), ce->type & ZEND_INTERNAL_CLASS); + zend_mangle_property_name(&prot_name, &prop_name_length, "*", 1, Z_STRVAL_PP(name), Z_STRLEN_PP(name), ce->type & ZEND_INTERNAL_CLASS); if (zend_hash_find(propers, prot_name, prop_name_length + 1, (void *) &d) == SUCCESS) { php_var_serialize_string(buf, prot_name, prop_name_length); pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS); @@ -693,12 +693,12 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt break; } pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS); - php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRSIZE_PP(name)); + php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRLEN_PP(name)); php_var_serialize_intern(buf, nvalp, var_hash TSRMLS_CC); php_error_docref(NULL TSRMLS_CC, E_NOTICE, "\"%s\" returned as member variable from __sleep() but does not exist", Z_STRVAL_PP(name)); } while (0); } else { - php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRSIZE_PP(name)); + php_var_serialize_string(buf, Z_STRVAL_PP(name), Z_STRLEN_PP(name)); php_var_serialize_intern(buf, nvalp, var_hash TSRMLS_CC); } } @@ -760,7 +760,7 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var } case IS_STRING: - php_var_serialize_string(buf, Z_STRVAL_P(struc), Z_STRSIZE_P(struc)); + php_var_serialize_string(buf, Z_STRVAL_P(struc), Z_STRLEN_P(struc)); return; case IS_OBJECT: { @@ -776,16 +776,16 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var if (ce && ce->serialize != NULL) { /* has custom handler */ unsigned char *serialized_data = NULL; - zend_str_size serialized_length; + zend_uint serialized_length; if (ce->serialize(struc, &serialized_data, &serialized_length, (zend_serialize_data *)var_hash TSRMLS_CC) == SUCCESS) { smart_str_appendl(buf, "C:", 2); - smart_str_append_str_size(buf, Z_OBJCE_P(struc)->name_length); + smart_str_append_long(buf, (int)Z_OBJCE_P(struc)->name_length); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, Z_OBJCE_P(struc)->name, Z_OBJCE_P(struc)->name_length); smart_str_appendl(buf, "\":", 2); - smart_str_append_str_size(buf, serialized_length); + smart_str_append_long(buf, (int)serialized_length); smart_str_appendl(buf, ":{", 2); smart_str_appendl(buf, serialized_data, serialized_length); smart_str_appendc(buf, '}'); @@ -854,13 +854,13 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var char *key; zval **data; ulong index; - zend_str_size key_len; + uint key_len; HashPosition pos; zend_hash_internal_pointer_reset_ex(myht, &pos); for (;; zend_hash_move_forward_ex(myht, &pos)) { i = zend_hash_get_current_key_ex(myht, &key, &key_len, &index, 0, &pos); - if (i == HASH_KEY_NON_EXISTENT) { + if (i == HASH_KEY_NON_EXISTANT) { break; } if (incomplete_class && strcmp(key, MAGIC_MEMBER) == 0) { @@ -926,7 +926,7 @@ PHP_FUNCTION(serialize) Z_TYPE_P(return_value) = IS_STRING; Z_STRVAL_P(return_value) = NULL; - Z_STRSIZE_P(return_value) = 0; + Z_STRLEN_P(return_value) = 0; PHP_VAR_SERIALIZE_INIT(var_hash); php_var_serialize(&buf, struc, &var_hash TSRMLS_CC); @@ -950,12 +950,12 @@ PHP_FUNCTION(serialize) PHP_FUNCTION(unserialize) { char *buf = NULL; - zend_str_size buf_len; + int buf_len; const unsigned char *p; php_unserialize_data_t var_hash; zval *consumed = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|z", &buf, &buf_len, &consumed) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &buf, &buf_len, &consumed) == FAILURE) { RETURN_FALSE; } diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index 19c3f398c1337..ddf43b02cf14d 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -302,16 +302,16 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL); break; case IS_STRING: - if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRSIZE_P(key) + 1, (void **)&old_data)==SUCCESS) { + if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) { var_push_dtor(var_hash, old_data); } - zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRSIZE_P(key) + 1, &data, sizeof(data), NULL); + zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL); break; } } else { /* object properties should include no integers */ convert_to_string(key); - zend_hash_update(ht, Z_STRVAL_P(key), Z_STRSIZE_P(key) + 1, &data, + zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof data, NULL); } diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index 97588f5d4ca0f..4d99cbfd78944 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -306,16 +306,16 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL); break; case IS_STRING: - if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRSIZE_P(key) + 1, (void **)&old_data)==SUCCESS) { + if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) { var_push_dtor(var_hash, old_data); } - zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRSIZE_P(key) + 1, &data, sizeof(data), NULL); + zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL); break; } } else { /* object properties should include no integers */ convert_to_string(key); - zend_hash_update(ht, Z_STRVAL_P(key), Z_STRSIZE_P(key) + 1, &data, + zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof data, NULL); } diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c index c70f439bc7798..aadbcaf84ab52 100644 --- a/ext/standard/versioning.c +++ b/ext/standard/versioning.c @@ -33,7 +33,7 @@ PHPAPI char * php_canonicalize_version(const char *version) { - zend_str_size_int len = strlen(version); + int len = strlen(version); char *buf = safe_emalloc(len, 2, 1), *q, lp, lq; const char *p; @@ -211,11 +211,11 @@ php_version_compare(const char *orig_ver1, const char *orig_ver2) PHP_FUNCTION(version_compare) { char *v1, *v2, *op = NULL; - zend_str_size_int v1_len, v2_len, op_len = 0; + int v1_len, v2_len, op_len = 0; int compare, argc; argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "SS|S", &v1, &v1_len, &v2, + if (zend_parse_parameters(argc TSRMLS_CC, "ss|s", &v1, &v1_len, &v2, &v2_len, &op, &op_len) == FAILURE) { return; } diff --git a/ext/sybase_ct/config.m4 b/ext/sybase_ct/config.m4 index 276fe12675509..81df1f3126f2e 100644 --- a/ext/sybase_ct/config.m4 +++ b/ext/sybase_ct/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(sybase-ct, for Sybase-CT support, -[ --with-sybase-ct[=DIR] Include Sybase-CT support. DIR is the Sybase home +[ --with-sybase-ct[=DIR] Include Sybase-CT support. DIR is the Sybase home directory [/home/sybase]]) if test "$PHP_SYBASE_CT" != "no"; then diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c index ee53d484cfb9b..bd4cf1429cb3e 100644 --- a/ext/sybase_ct/php_sybase_ct.c +++ b/ext/sybase_ct/php_sybase_ct.c @@ -1121,7 +1121,7 @@ static int php_sybase_finish_results(sybase_result *result TSRMLS_DC) break; case CS_CMD_FAIL: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Command failed, canceling rest"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Command failed, cancelling rest"); ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); fail = 1; break; @@ -1131,7 +1131,7 @@ static int php_sybase_finish_results(sybase_result *result TSRMLS_DC) case CS_PARAM_RESULT: case CS_ROW_RESULT: /* Unexpected results, cancel them. */ - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Unexpected results, canceling current"); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Unexpected results, cancelling current"); ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_CURRENT); break; @@ -1141,7 +1141,7 @@ static int php_sybase_finish_results(sybase_result *result TSRMLS_DC) break; default: - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Unexpected results, canceling all"); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Unexpected results, cancelling all"); ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); break; } @@ -1696,7 +1696,7 @@ PHP_FUNCTION(sybase_free_result) /* Did we fetch up until the end? */ if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS) { - /* php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: canceling the rest of the results"); */ + /* php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Cancelling the rest of the results"); */ ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); php_sybase_finish_results(result TSRMLS_CC); } diff --git a/ext/sybase_ct/tests/bug26407.phpt b/ext/sybase_ct/tests/bug26407.phpt index 27f5f99b9d1ff..35bf6df7ada3a 100644 --- a/ext/sybase_ct/tests/bug26407.phpt +++ b/ext/sybase_ct/tests/bug26407.phpt @@ -80,7 +80,7 @@ bool(true) select "bar" -Notice: sybase_query(): Sybase: Unexpected results, canceling current in %stest.inc on line %d +Notice: sybase_query(): Sybase: Unexpected results, cancelling current in %stest.inc on line %d <<< Return: resource array(1) { [0]=> diff --git a/ext/sybase_ct/tests/bug43578.phpt b/ext/sybase_ct/tests/bug43578.phpt index 9f75b9c0ea06d..e840402edc2ff 100644 --- a/ext/sybase_ct/tests/bug43578.phpt +++ b/ext/sybase_ct/tests/bug43578.phpt @@ -23,7 +23,7 @@ Sybase-CT bug #43578 (Incurred fault #6 - if returned textfield ist empty) var_dump(sybase_query('insert into #Resource values (123, NULL)', $db)); var_dump(sybase_query('insert into #Resource values (124, "")', $db)); - // Select non-existent + // Select non-existant var_dump(sybase_select_ex($db, 'select DC_Rights from #Resource where Resource_ID = 122')); // Select null diff --git a/ext/sybase_ct/tests/test_fetch_object.phpt b/ext/sybase_ct/tests/test_fetch_object.phpt index 2d225cd9cf445..c23658fa35d37 100644 --- a/ext/sybase_ct/tests/test_fetch_object.phpt +++ b/ext/sybase_ct/tests/test_fetch_object.phpt @@ -40,7 +40,7 @@ Sybase-CT sybase_fetch_object // Test with object var_export(fetch_object($db, new article())); echo "\n"; - // Test with non-existent class + // Test with non-existant class var_export(fetch_object($db, '***')); echo "\n"; sybase_close($db); diff --git a/ext/sybase_ct/tests/test_msghandler.phpt b/ext/sybase_ct/tests/test_msghandler.phpt index 3189aaac210bb..afe97cbef359e 100644 --- a/ext/sybase_ct/tests/test_msghandler.phpt +++ b/ext/sybase_ct/tests/test_msghandler.phpt @@ -13,7 +13,7 @@ Sybase-CT server message handler $db= sybase_connect_ex(); - echo 'Nonexistent: '; sybase_set_messagehandler_ex('function_does_not_exist'); + echo 'Nonexistant: '; sybase_set_messagehandler_ex('function_does_not_exist'); echo 'Static method: '; sybase_set_messagehandler_ex(array('sybase', 'static_handler')); echo 'Instance method: '; sybase_set_messagehandler_ex(array(new sybase(), 'handler')); echo 'Lambda function: '; sybase_set_messagehandler_ex(create_function('', 'return FALSE;')); @@ -25,7 +25,7 @@ Sybase-CT server message handler sybase_close($db); ?> --EXPECTF-- -Nonexistent: +Nonexistant: Warning: sybase_set_message_handler() expects parameter 1 to be a valid callback, function 'function_does_not_exist' not found or invalid function name in %stest.inc on line %d NULL Static method: bool(true) diff --git a/ext/tidy/config.m4 b/ext/tidy/config.m4 index 102f6a827e830..675498c8cecab 100644 --- a/ext/tidy/config.m4 +++ b/ext/tidy/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(tidy,for TIDY support, -[ --with-tidy[=DIR] Include TIDY support]) +[ --with-tidy[=DIR] Include TIDY support]) if test "$PHP_TIDY" != "no"; then diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index c3b9d8c3468bd..5cfb1645692c3 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -1443,7 +1443,7 @@ static PHP_FUNCTION(tidy_get_config) /* }}} */ /* {{{ proto int tidy_get_status() - Get status of specified document. */ + Get status of specfied document. */ static PHP_FUNCTION(tidy_get_status) { TIDY_FETCH_OBJECT; diff --git a/ext/wddx/config.m4 b/ext/wddx/config.m4 index 8f933d490aac2..2b02a92aa9fc9 100644 --- a/ext/wddx/config.m4 +++ b/ext/wddx/config.m4 @@ -7,11 +7,11 @@ PHP_ARG_ENABLE(wddx,whether to enable WDDX support, if test -z "$PHP_LIBXML_DIR"; then PHP_ARG_WITH(libxml-dir, libxml2 install dir, - [ --with-libxml-dir=DIR WDDX: libxml2 install prefix], no, no) + [ --with-libxml-dir=DIR WDDX: libxml2 install prefix], no, no) fi PHP_ARG_WITH(libexpat-dir, libexpat dir for WDDX, -[ --with-libexpat-dir=DIR WDDX: libexpat dir for XMLRPC-EPI (deprecated)],no,no) +[ --with-libexpat-dir=DIR WDDX: libexpat dir for XMLRPC-EPI (deprecated)],no,no) if test "$PHP_WDDX" != "no"; then diff --git a/ext/xml/config.m4 b/ext/xml/config.m4 index ebfc0471e086f..65f22915b93af 100644 --- a/ext/xml/config.m4 +++ b/ext/xml/config.m4 @@ -7,11 +7,11 @@ PHP_ARG_ENABLE(xml,whether to enable XML support, if test -z "$PHP_LIBXML_DIR"; then PHP_ARG_WITH(libxml-dir, libxml2 install dir, - [ --with-libxml-dir=DIR XML: libxml2 install prefix], no, no) + [ --with-libxml-dir=DIR XML: libxml2 install prefix], no, no) fi PHP_ARG_WITH(libexpat-dir, libexpat install dir, -[ --with-libexpat-dir=DIR XML: libexpat install prefix (deprecated)], no, no) +[ --with-libexpat-dir=DIR XML: libexpat install prefix (deprecated)], no, no) if test "$PHP_XML" != "no"; then diff --git a/ext/xml/tests/bug65236.phpt b/ext/xml/tests/bug65236.phpt deleted file mode 100644 index 67b26d663f6ab..0000000000000 --- a/ext/xml/tests/bug65236.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Bug #65236 (heap corruption in xml parser) ---SKIPIF-- - ---FILE-- -", 1000), $a); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: xml_parse_into_struct(): Maximum depth exceeded - Results truncated in %s on line %d -Done diff --git a/ext/xml/xml.c b/ext/xml/xml.c index 334938ab24c7b..2fea4f8ab9b4e 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -428,7 +428,7 @@ static void xml_parser_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) } if (parser->ltags) { int inx; - for (inx = 0; ((inx < parser->level) && (inx < XML_MAXLEVEL)); inx++) + for (inx = 0; inx < parser->level; inx++) efree(parser->ltags[ inx ]); efree(parser->ltags); } @@ -805,50 +805,45 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch } if (parser->data) { - if (parser->level <= XML_MAXLEVEL) { - zval *tag, *atr; - int atcnt = 0; + zval *tag, *atr; + int atcnt = 0; - MAKE_STD_ZVAL(tag); - MAKE_STD_ZVAL(atr); - - array_init(tag); - array_init(atr); + MAKE_STD_ZVAL(tag); + MAKE_STD_ZVAL(atr); - _xml_add_to_info(parser,((char *) tag_name) + parser->toffset); - - add_assoc_string(tag,"tag",((char *) tag_name) + parser->toffset,1); /* cast to avoid gcc-warning */ - add_assoc_string(tag,"type","open",1); - add_assoc_long(tag,"level",parser->level); + array_init(tag); + array_init(atr); - parser->ltags[parser->level-1] = estrdup(tag_name); - parser->lastwasopen = 1; + _xml_add_to_info(parser,((char *) tag_name) + parser->toffset); - attributes = (const XML_Char **) attrs; + add_assoc_string(tag,"tag",((char *) tag_name) + parser->toffset,1); /* cast to avoid gcc-warning */ + add_assoc_string(tag,"type","open",1); + add_assoc_long(tag,"level",parser->level); - while (attributes && *attributes) { - att = _xml_decode_tag(parser, attributes[0]); - val = xml_utf8_decode(attributes[1], strlen(attributes[1]), &val_len, parser->target_encoding); + parser->ltags[parser->level-1] = estrdup(tag_name); + parser->lastwasopen = 1; - add_assoc_stringl(atr,att,val,val_len,0); + attributes = (const XML_Char **) attrs; - atcnt++; - attributes += 2; + while (attributes && *attributes) { + att = _xml_decode_tag(parser, attributes[0]); + val = xml_utf8_decode(attributes[1], strlen(attributes[1]), &val_len, parser->target_encoding); + + add_assoc_stringl(atr,att,val,val_len,0); - efree(att); - } + atcnt++; + attributes += 2; - if (atcnt) { - zend_hash_add(Z_ARRVAL_P(tag),"attributes",sizeof("attributes"),&atr,sizeof(zval*),NULL); - } else { - zval_ptr_dtor(&atr); - } + efree(att); + } - zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),(void *) &parser->ctag); - } else if (parser->level == (XML_MAXLEVEL + 1)) { - TSRMLS_FETCH(); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Maximum depth exceeded - Results truncated"); + if (atcnt) { + zend_hash_add(Z_ARRVAL_P(tag),"attributes",sizeof("attributes"),&atr,sizeof(zval*),NULL); + } else { + zval_ptr_dtor(&atr); } + + zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),(void *) &parser->ctag); } efree(tag_name); @@ -900,7 +895,7 @@ void _xml_endElementHandler(void *userData, const XML_Char *name) efree(tag_name); - if ((parser->ltags) && (parser->level <= XML_MAXLEVEL)) { + if (parser->ltags) { efree(parser->ltags[parser->level-1]); } @@ -984,23 +979,18 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) } } - if (parser->level <= XML_MAXLEVEL) { - MAKE_STD_ZVAL(tag); - - array_init(tag); - - _xml_add_to_info(parser,parser->ltags[parser->level-1] + parser->toffset); + MAKE_STD_ZVAL(tag); + + array_init(tag); + + _xml_add_to_info(parser,parser->ltags[parser->level-1] + parser->toffset); - add_assoc_string(tag,"tag",parser->ltags[parser->level-1] + parser->toffset,1); - add_assoc_string(tag,"value",decoded_value,0); - add_assoc_string(tag,"type","cdata",1); - add_assoc_long(tag,"level",parser->level); + add_assoc_string(tag,"tag",parser->ltags[parser->level-1] + parser->toffset,1); + add_assoc_string(tag,"value",decoded_value,0); + add_assoc_string(tag,"type","cdata",1); + add_assoc_long(tag,"level",parser->level); - zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),NULL); - } else if (parser->level == (XML_MAXLEVEL + 1)) { - TSRMLS_FETCH(); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Maximum depth exceeded - Results truncated"); - } + zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),NULL); } } else { efree(decoded_value); diff --git a/ext/xmlreader/config.m4 b/ext/xmlreader/config.m4 index d346b58eea4fc..3614996fb4338 100644 --- a/ext/xmlreader/config.m4 +++ b/ext/xmlreader/config.m4 @@ -7,7 +7,7 @@ PHP_ARG_ENABLE(xmlreader, whether to enable XMLReader support, if test -z "$PHP_LIBXML_DIR"; then PHP_ARG_WITH(libxml-dir, libxml2 install dir, - [ --with-libxml-dir=DIR XMLReader: libxml2 install prefix], no, no) + [ --with-libxml-dir=DIR XMLReader: libxml2 install prefix], no, no) fi if test "$PHP_XMLREADER" != "no"; then diff --git a/ext/xmlrpc/config.m4 b/ext/xmlrpc/config.m4 index f82016edcb000..389d4adaf0106 100644 --- a/ext/xmlrpc/config.m4 +++ b/ext/xmlrpc/config.m4 @@ -8,18 +8,18 @@ sinclude(libxmlrpc/acinclude.m4) sinclude(libxmlrpc/xmlrpc.m4) PHP_ARG_WITH(xmlrpc, for XMLRPC-EPI support, -[ --with-xmlrpc[=DIR] Include XMLRPC-EPI support]) +[ --with-xmlrpc[=DIR] Include XMLRPC-EPI support]) if test -z "$PHP_LIBXML_DIR"; then PHP_ARG_WITH(libxml-dir, libxml2 install dir, - [ --with-libxml-dir=DIR XMLRPC-EPI: libxml2 install prefix], no, no) + [ --with-libxml-dir=DIR XMLRPC-EPI: libxml2 install prefix], no, no) fi PHP_ARG_WITH(libexpat-dir, libexpat dir for XMLRPC-EPI, -[ --with-libexpat-dir=DIR XMLRPC-EPI: libexpat dir for XMLRPC-EPI (deprecated)],no,no) +[ --with-libexpat-dir=DIR XMLRPC-EPI: libexpat dir for XMLRPC-EPI (deprecated)],no,no) PHP_ARG_WITH(iconv-dir, iconv dir for XMLRPC-EPI, -[ --with-iconv-dir=DIR XMLRPC-EPI: iconv dir for XMLRPC-EPI],no,no) +[ --with-iconv-dir=DIR XMLRPC-EPI: iconv dir for XMLRPC-EPI],no,no) if test "$PHP_XMLRPC" != "no"; then diff --git a/ext/xmlrpc/libxmlrpc/xml_to_soap.c b/ext/xmlrpc/libxmlrpc/xml_to_soap.c index ac103e0616ed3..664e8b77b3f97 100644 --- a/ext/xmlrpc/libxmlrpc/xml_to_soap.c +++ b/ext/xmlrpc/libxmlrpc/xml_to_soap.c @@ -279,7 +279,7 @@ XMLRPC_VALUE xml_element_to_SOAP_REQUEST_worker(XMLRPC_REQUEST request, else if (!strcmp(attr_iter->key, TOKEN_MUSTUNDERSTAND)) { b_must_understand = strchr(attr_iter->val, '1') ? 1 : 0; } - /* actor, used in conjunction with must understand. */ + /* actor, used in conjuction with must understand. */ else if (!strcmp(attr_iter->key, TOKEN_ACTOR)) { actor = attr_iter->val; } diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index b73cbcfe2478b..925b554a56768 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -502,7 +502,7 @@ static XMLRPC_VECTOR_TYPE determine_vector_type (HashTable *ht) } bArray = 1; last_num = num_index; - } else if (res == HASH_KEY_NON_EXISTENT) { + } else if (res == HASH_KEY_NON_EXISTANT) { break; } else if (res == HASH_KEY_IS_STRING) { if (bArray) { @@ -582,7 +582,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep int res = my_zend_hash_get_current_key(Z_ARRVAL_P(val_arr), &my_key, &num_index); switch (res) { - case HASH_KEY_NON_EXISTENT: + case HASH_KEY_NON_EXISTANT: break; case HASH_KEY_IS_STRING: case HASH_KEY_IS_LONG: diff --git a/ext/xmlwriter/config.m4 b/ext/xmlwriter/config.m4 index b3b98012f8f8c..0a5d079430095 100644 --- a/ext/xmlwriter/config.m4 +++ b/ext/xmlwriter/config.m4 @@ -7,7 +7,7 @@ PHP_ARG_ENABLE(xmlwriter, whether to enable XMLWriter support, if test -z "$PHP_LIBXML_DIR"; then PHP_ARG_WITH(libxml-dir, libxml2 install dir, - [ --with-libxml-dir=DIR XMLWriter: libxml2 install prefix], no, no) + [ --with-libxml-dir=DIR XMLWriter: libxml2 install prefix], no, no) fi if test "$PHP_XMLWRITER" != "no"; then diff --git a/ext/xmlwriter/tests/bug41287.phpt b/ext/xmlwriter/tests/bug41287.phpt index 72b6720f1d4c6..0612b21f15c54 100644 --- a/ext/xmlwriter/tests/bug41287.phpt +++ b/ext/xmlwriter/tests/bug41287.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #41287 (Namespace functions don't allow xmlns definition to be optional) +Bug #41287 (Namespace functions don't allow xmlns defintion to be optional) --SKIPIF-- = 1.1.0 required)]) if test "$PHP_XSL" != "no"; then diff --git a/ext/zip/config.m4 b/ext/zip/config.m4 index 805d92442e017..85f9119f5aac1 100644 --- a/ext/zip/config.m4 +++ b/ext/zip/config.m4 @@ -11,7 +11,7 @@ if test -z "$PHP_ZLIB_DIR"; then fi PHP_ARG_WITH(pcre-dir, pcre install prefix, -[ --with-pcre-dir ZIP: pcre install prefix], no, no) +[ --with-pcre-dir ZIP: pcre install prefix], no, no) if test "$PHP_ZIP" != "no"; then diff --git a/ext/zip/lib/zipconf.h b/ext/zip/lib/zipconf.h index 646c0bde53f0e..2b4340c861c51 100644 --- a/ext/zip/lib/zipconf.h +++ b/ext/zip/lib/zipconf.h @@ -13,7 +13,11 @@ #define LIBZIP_VERSION_MINOR 10 #define LIBZIP_VERSION_MICRO 0 -#include +#ifdef PHP_WIN32 +#include +#else +#include +#endif typedef int8_t zip_int8_t; #define ZIP_INT8_MIN INT8_MIN diff --git a/ext/zip/php_zip.h b/ext/zip/php_zip.h index dace407d14f31..7dd9ff09d0b51 100644 --- a/ext/zip/php_zip.h +++ b/ext/zip/php_zip.h @@ -81,8 +81,8 @@ typedef struct _ze_zip_object { int filename_len; } ze_zip_object; -php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); -php_stream *php_stream_zip_open(const char *filename, const char *path, const char *mode STREAMS_DC TSRMLS_DC); +php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); +php_stream *php_stream_zip_open(char *filename, char *path, char *mode STREAMS_DC TSRMLS_DC); extern php_stream_wrapper php_stream_zip_wrapper; #endif diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c index 79b54cbbb0cdc..400edd6e6c0b9 100644 --- a/ext/zip/zip_stream.c +++ b/ext/zip/zip_stream.c @@ -185,7 +185,7 @@ php_stream_ops php_stream_zipio_ops = { }; /* {{{ php_stream_zip_open */ -php_stream *php_stream_zip_open(const char *filename, const char *path, const char *mode STREAMS_DC TSRMLS_DC) +php_stream *php_stream_zip_open(char *filename, char *path, char *mode STREAMS_DC TSRMLS_DC) { struct zip_file *zf = NULL; int err = 0; @@ -235,8 +235,8 @@ php_stream *php_stream_zip_open(const char *filename, const char *path, const ch /* {{{ php_stream_zip_opener */ php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, - const char *path, - const char *mode, + char *path, + char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) diff --git a/ext/zlib/config0.m4 b/ext/zlib/config0.m4 index ebf67cc001480..25c7f4f420273 100644 --- a/ext/zlib/config0.m4 +++ b/ext/zlib/config0.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(zlib,for ZLIB support, -[ --with-zlib[=DIR] Include ZLIB support (requires zlib >= 1.0.9)]) +[ --with-zlib[=DIR] Include ZLIB support (requires zlib >= 1.0.9)]) PHP_ARG_WITH(zlib-dir,if the location of ZLIB install directory is defined, [ --with-zlib-dir= Define the location of zlib install directory], no, no) diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h index 3e4b9381e7c81..6b1d0cd80c510 100644 --- a/ext/zlib/php_zlib.h +++ b/ext/zlib/php_zlib.h @@ -58,7 +58,7 @@ ZEND_BEGIN_MODULE_GLOBALS(zlib) zend_bool handler_registered; ZEND_END_MODULE_GLOBALS(zlib); -php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); +php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); extern php_stream_ops php_stream_gzio_ops; extern php_stream_wrapper php_stream_gzip_wrapper; extern php_stream_filter_factory php_zlib_filter_factory; diff --git a/ext/zlib/tests/bug65391.phpt b/ext/zlib/tests/bug65391.phpt deleted file mode 100644 index 439473fc5d0f2..0000000000000 --- a/ext/zlib/tests/bug65391.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Bug #65391 (Unable to send vary header user-agent when ob_start('ob_gzhandler') is called) ---SKIPIF-- - ---GET-- -dummy=1 ---FILE-- - -Done ---EXPECTF-- -Array -( - [0] => X-Powered-By: PHP/%s - [1] => Vary: Cookie - [2] => Vary: Accept-Encoding -) -Done diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 1114bc8a65bc4..1a202e344ed43 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -190,7 +190,7 @@ static int php_zlib_output_handler(void **handler_context, php_output_context *o if ((output_context->op & PHP_OUTPUT_HANDLER_START) && (output_context->op != (PHP_OUTPUT_HANDLER_START|PHP_OUTPUT_HANDLER_CLEAN|PHP_OUTPUT_HANDLER_FINAL)) ) { - sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 0 TSRMLS_CC); + sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC); } return FAILURE; } @@ -220,7 +220,7 @@ static int php_zlib_output_handler(void **handler_context, php_output_context *o deflateEnd(&ctx->Z); return FAILURE; } - sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 0 TSRMLS_CC); + sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC); php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC); } } @@ -478,7 +478,7 @@ static PHP_FUNCTION(ob_gzhandler) sapi_add_header_ex(ZEND_STRL("Content-Encoding: deflate"), 1, 1 TSRMLS_CC); break; } - sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 0 TSRMLS_CC); + sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC); } if (!ZLIBG(ob_gzhandler)) { diff --git a/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c index 2fd9dc7766ec9..1b00eb8713b90 100644 --- a/ext/zlib/zlib_fopen_wrapper.c +++ b/ext/zlib/zlib_fopen_wrapper.c @@ -106,7 +106,7 @@ php_stream_ops php_stream_gzio_ops = { NULL /* set_option */ }; -php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, +php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { struct php_gz_stream_data_t *self; diff --git a/main/SAPI.c b/main/SAPI.c index 075b1eb22110d..dcb2da629a03b 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -192,7 +192,7 @@ SAPI_API void sapi_handle_post(void *arg TSRMLS_DC) static void sapi_read_post_data(TSRMLS_D) { sapi_post_entry *post_entry; - zend_str_size_uint content_type_length = strlen(SG(request_info).content_type); + uint content_type_length = strlen(SG(request_info).content_type); char *content_type = estrndup(SG(request_info).content_type, content_type_length); char *p; char oldchar=0; @@ -285,10 +285,10 @@ SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data) } -static inline char *get_default_content_type(zend_str_size_uint prefix_len, zend_str_size_uint *len TSRMLS_DC) +static inline char *get_default_content_type(uint prefix_len, uint *len TSRMLS_DC) { char *mimetype, *charset, *content_type; - zend_str_size_uint mimetype_len, charset_len; + uint mimetype_len, charset_len; if (SG(default_mimetype)) { mimetype = SG(default_mimetype); @@ -327,7 +327,7 @@ static inline char *get_default_content_type(zend_str_size_uint prefix_len, zend SAPI_API char *sapi_get_default_content_type(TSRMLS_D) { - zend_str_size_uint len; + uint len; return get_default_content_type(0, &len TSRMLS_CC); } @@ -335,7 +335,7 @@ SAPI_API char *sapi_get_default_content_type(TSRMLS_D) SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_header TSRMLS_DC) { - zend_str_size_uint len; + uint len; default_header->header = get_default_content_type(sizeof("Content-type: ")-1, &len TSRMLS_CC); default_header->header_len = len; @@ -591,7 +591,7 @@ static void sapi_update_response_code(int ncode TSRMLS_DC) * since zend_llist_del_element only remove one matched item once, * we should remove them by ourself */ -static void sapi_remove_header(zend_llist *l, char *name, zend_str_size_uint len) { +static void sapi_remove_header(zend_llist *l, char *name, uint len) { sapi_header_struct *header; zend_llist_element *next; zend_llist_element *current=l->head; @@ -858,7 +858,7 @@ SAPI_API int sapi_send_headers(TSRMLS_D) */ if (SG(sapi_headers).send_default_content_type && sapi_module.send_headers) { sapi_header_struct default_header; - zend_str_size_uint len; + uint len; SG(sapi_headers).mimetype = get_default_content_type(0, &len TSRMLS_CC); default_header.header_len = sizeof("Content-type: ") - 1 + len; @@ -975,7 +975,7 @@ SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zva return SUCCESS; } -SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, zend_str_size_uint val_len, zend_str_size_uint *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC) +SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC) { if (SG(sapi_started) && EG(in_execution)) { return FAILURE; diff --git a/main/SAPI.h b/main/SAPI.h index db4ff1fdb7c30..92b7329dbc16c 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -27,7 +27,6 @@ #include "zend_operators.h" #ifdef PHP_WIN32 #include "win95nt.h" -#include "win32/php_stdint.h" #endif #include @@ -51,7 +50,7 @@ typedef struct { char *header; - zend_str_size_uint header_len; + uint header_len; } sapi_header_struct; @@ -83,7 +82,7 @@ typedef struct { char *post_data, *raw_post_data; char *cookie_data; long content_length; - int64_t post_data_length, raw_post_data_length; + uint post_data_length, raw_post_data_length; char *path_translated; char *request_uri; @@ -120,7 +119,7 @@ typedef struct _sapi_globals_struct { void *server_context; sapi_request_info request_info; sapi_headers_struct sapi_headers; - int64_t read_post_bytes; + int read_post_bytes; unsigned char headers_sent; struct stat global_stat; char *default_mimetype; @@ -166,7 +165,7 @@ END_EXTERN_C() typedef struct { char *line; /* If you allocated this, you need to free it yourself */ - zend_str_size_uint line_len; + uint line_len; long response_code; /* long due to zend_parse_parameters compatibility */ } sapi_header_line; @@ -195,7 +194,7 @@ SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry TSRMLS_DC); SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry TSRMLS_DC); SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRMLS_D) TSRMLS_DC); SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC) TSRMLS_DC); -SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, zend_str_size_uint val_len, zend_str_size_uint *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC); +SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC); SAPI_API int sapi_flush(TSRMLS_D); SAPI_API struct stat *sapi_get_stat(TSRMLS_D); @@ -225,7 +224,7 @@ struct _sapi_module_struct { int (*activate)(TSRMLS_D); int (*deactivate)(TSRMLS_D); - zend_str_size_int (*ub_write)(const char *str, zend_str_size_uint str_length TSRMLS_DC); + int (*ub_write)(const char *str, unsigned int str_length TSRMLS_DC); void (*flush)(void *server_context); struct stat *(*get_stat)(TSRMLS_D); char *(*getenv)(char *name, size_t name_len TSRMLS_DC); @@ -263,7 +262,7 @@ struct _sapi_module_struct { int (*get_target_uid)(uid_t * TSRMLS_DC); int (*get_target_gid)(gid_t * TSRMLS_DC); - unsigned int (*input_filter)(int arg, char *var, char **val, zend_str_size_uint val_len, zend_str_size_uint *new_val_len TSRMLS_DC); + unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC); void (*ini_defaults)(HashTable *configuration_hash); int phpinfo_as_text; @@ -297,7 +296,7 @@ struct _sapi_post_entry { #define SAPI_POST_HANDLER_FUNC(post_handler) void post_handler(char *content_type_dup, void *arg TSRMLS_DC) #define SAPI_TREAT_DATA_FUNC(treat_data) void treat_data(int arg, char *str, zval* destArray TSRMLS_DC) -#define SAPI_INPUT_FILTER_FUNC(input_filter) unsigned int input_filter(int arg, char *var, char **val, zend_str_size_uint val_len, zend_str_size_uint *new_val_len TSRMLS_DC) +#define SAPI_INPUT_FILTER_FUNC(input_filter) unsigned int input_filter(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC) BEGIN_EXTERN_C() SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data); diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index 58efaf3dbfab6..6f11cf3f3254b 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -410,7 +410,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC) #endif if (PG(doc_root) && path_info && (length = strlen(PG(doc_root))) && IS_ABSOLUTE_PATH(PG(doc_root), length)) { - zend_str_size_int path_len = strlen(path_info); + int path_len = strlen(path_info); filename = emalloc(length + path_len + 2); if (filename) { memcpy(filename, PG(doc_root), length); @@ -470,12 +470,12 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC) /* {{{ php_resolve_path * Returns the realpath for given filename according to include path */ -PHPAPI char *php_resolve_path(const char *filename, zend_str_size_int filename_length, const char *path TSRMLS_DC) +PHPAPI char *php_resolve_path(const char *filename, int filename_length, const char *path TSRMLS_DC) { char resolved_path[MAXPATHLEN]; char trypath[MAXPATHLEN]; const char *ptr, *end, *p; - const char *actual_path; + char *actual_path; php_stream_wrapper *wrapper; if (!filename || CHECK_NULL_PATH(filename, filename_length)) { diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h index 60a21b419c2fa..ee96eef313a8c 100644 --- a/main/fopen_wrappers.h +++ b/main/fopen_wrappers.h @@ -46,7 +46,7 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char *path PHPAPI int php_check_safe_mode_include_dir(const char *path TSRMLS_DC); -PHPAPI char *php_resolve_path(const char *filename, zend_str_size_int filename_len, const char *path TSRMLS_DC); +PHPAPI char *php_resolve_path(const char *filename, int filename_len, const char *path TSRMLS_DC); PHPAPI FILE *php_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path TSRMLS_DC); diff --git a/main/main.c b/main/main.c index 70d77a2c1dd6d..de794ace995f7 100644 --- a/main/main.c +++ b/main/main.c @@ -323,7 +323,7 @@ static PHP_INI_MH(OnUpdateTimeout) /* {{{ php_get_display_errors_mode() helper function */ -static int php_get_display_errors_mode(char *value, zend_str_size_int value_length) +static int php_get_display_errors_mode(char *value, int value_length) { int mode; @@ -366,8 +366,7 @@ static PHP_INI_MH(OnUpdateDisplayErrors) */ static PHP_INI_DISP(display_errors_mode) { - int mode, cgi_or_cli; - zend_str_size_int tmp_value_length; + int mode, tmp_value_length, cgi_or_cli; char *tmp_value; TSRMLS_FETCH(); @@ -625,7 +624,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) fd = VCWD_OPEN_MODE(PG(error_log), O_CREAT | O_APPEND | O_WRONLY, 0644); if (fd != -1) { char *tmp; - zend_str_size_int len; + int len; char *error_time_str; time(&error_time); @@ -642,7 +641,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) #ifdef PHP_WIN32 php_flock(fd, 2); #endif - php_ignore_value(write(fd, tmp, len)); /* XXX rework on windows, write expects int*/ + php_ignore_value(write(fd, tmp, len)); efree(tmp); efree(error_time_str); close(fd); @@ -662,7 +661,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) /* {{{ php_write wrapper for modules to use PHPWRITE */ -PHPAPI zend_str_size_int php_write(void *buf, zend_str_size_uint size TSRMLS_DC) +PHPAPI int php_write(void *buf, uint size TSRMLS_DC) { return PHPWRITE(buf, size); } @@ -670,12 +669,12 @@ PHPAPI zend_str_size_int php_write(void *buf, zend_str_size_uint size TSRMLS_DC) /* {{{ php_printf */ -PHPAPI zend_str_size_int php_printf(const char *format, ...) +PHPAPI int php_printf(const char *format, ...) { va_list args; - size_t ret; + int ret; char *buffer; - zend_str_size_int size; + int size; TSRMLS_FETCH(); va_start(args, format); @@ -699,11 +698,11 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c char *buffer = NULL, *docref_buf = NULL, *target = NULL; char *docref_target = "", *docref_root = ""; char *p; - zend_str_size_int buffer_len = 0; + int buffer_len = 0; const char *space = ""; const char *class_name = ""; const char *function; - zend_str_size_int origin_len; + int origin_len; char *origin; char *message; int is_function = 0; @@ -784,7 +783,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c /* no docref given but function is known (the default) */ if (!docref && is_function) { - zend_str_size_int doclen; + int doclen; while (*function == '_') { function++; } @@ -916,7 +915,7 @@ PHPAPI void php_win32_docref2_from_error(DWORD error, const char *param1, const php_error_docref2(NULL TSRMLS_CC, param1, param2, E_WARNING, "%s", strerror(errno)); } else { char buf[PHP_WIN32_ERROR_MSG_BUFFER_SIZE + 1]; - zend_str_size_int buf_len; + int buf_len; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, 0, buf, PHP_WIN32_ERROR_MSG_BUFFER_SIZE, NULL); buf_len = strlen(buf); @@ -939,11 +938,10 @@ PHPAPI void php_html_puts(const char *str, uint size TSRMLS_DC) /* {{{ php_error_cb extended error handling function */ -static void php_error_cb(int type, const char *error_filename, const zend_str_size_uint error_lineno, const char *format, va_list args) +static void php_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) { char *buffer; - zend_str_size_int buffer_len; - int display; + int buffer_len, display; TSRMLS_FETCH(); buffer_len = vspprintf(&buffer, PG(log_errors_max_len), format, args); @@ -1266,7 +1264,7 @@ PHP_FUNCTION(set_time_limit) { long new_timeout; char *new_timeout_str; - zend_str_size_int new_timeout_strlen; + int new_timeout_strlen; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_timeout) == FAILURE) { return; @@ -1363,7 +1361,7 @@ PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *h } /* }}} */ -static char *php_resolve_path_for_zend(const char *filename, zend_str_size_int filename_len TSRMLS_DC) /* {{{ */ +static char *php_resolve_path_for_zend(const char *filename, int filename_len TSRMLS_DC) /* {{{ */ { return php_resolve_path(filename, filename_len, PG(include_path) TSRMLS_CC); } @@ -1371,7 +1369,7 @@ static char *php_resolve_path_for_zend(const char *filename, zend_str_size_int f /* {{{ php_get_configuration_directive_for_zend */ -static int php_get_configuration_directive_for_zend(const char *name, zend_str_size_uint name_length, zval *contents) +static int php_get_configuration_directive_for_zend(const char *name, uint name_length, zval *contents) { zval *retval = cfg_get_entry(name, name_length); @@ -1859,7 +1857,7 @@ PHPAPI void php_com_initialize(TSRMLS_D) /* {{{ php_output_wrapper */ -static zend_str_size_int php_output_wrapper(const char *str, zend_str_size_uint str_length) +static int php_output_wrapper(const char *str, uint str_length) { TSRMLS_FETCH(); return php_output_write(str, str_length TSRMLS_CC); @@ -2448,7 +2446,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) primary_file->opened_path == NULL && primary_file->type != ZEND_HANDLE_FILENAME ) { - zend_str_size_int realfile_len; + int realfile_len; int dummy = 1; if (expand_filepath(primary_file->filename, realfile TSRMLS_CC)) { diff --git a/main/network.c b/main/network.c index 99e927ee3f69a..5c0404b239aae 100644 --- a/main/network.c +++ b/main/network.c @@ -499,7 +499,7 @@ php_socket_t php_network_bind_socket_to_local_addr(const char *host, unsigned po } /* }}} */ -PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_str_size_long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC) +PHPAPI int php_network_parse_network_address_with_port(const char *addr, long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC) { char *colon; char *tmp; @@ -590,7 +590,7 @@ PHPAPI void php_network_populate_name_from_sockaddr( /* input address */ struct sockaddr *sa, socklen_t sl, /* output readable address */ - char **textaddr, zend_str_size_long *textaddrlen, + char **textaddr, long *textaddrlen, /* output address */ struct sockaddr **addr, socklen_t *addrlen @@ -655,7 +655,7 @@ PHPAPI void php_network_populate_name_from_sockaddr( } PHPAPI int php_network_get_peer_name(php_socket_t sock, - char **textaddr, zend_str_size_long *textaddrlen, + char **textaddr, long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC) @@ -675,7 +675,7 @@ PHPAPI int php_network_get_peer_name(php_socket_t sock, } PHPAPI int php_network_get_sock_name(php_socket_t sock, - char **textaddr, zend_str_size_long *textaddrlen, + char **textaddr, long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC) @@ -706,7 +706,7 @@ PHPAPI int php_network_get_sock_name(php_socket_t sock, /* {{{ php_network_accept_incoming */ PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock, - char **textaddr, zend_str_size_long *textaddrlen, + char **textaddr, long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen, struct timeval *timeout, @@ -833,7 +833,7 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short if (bindto) { struct sockaddr *local_address = NULL; - zend_str_size local_address_len = 0; + int local_address_len = 0; if (sa->sa_family == AF_INET) { struct sockaddr_in *in4 = emalloc(sizeof(struct sockaddr_in)); diff --git a/main/output.c b/main/output.c index 4f9e76cdcdcd4..9324f059da8be 100644 --- a/main/output.c +++ b/main/output.c @@ -53,9 +53,9 @@ static HashTable php_output_handler_reverse_conflicts; /* {{{ forward declarations */ static inline int php_output_lock_error(int op TSRMLS_DC); -static inline void php_output_op(int op, const char *str, zend_str_size_size_t len TSRMLS_DC); +static inline void php_output_op(int op, const char *str, size_t len TSRMLS_DC); -static inline php_output_handler *php_output_handler_init(const char *name, zend_str_size_size_t name_len, zend_str_size_size_t chunk_size, int flags TSRMLS_DC); +static inline php_output_handler *php_output_handler_init(const char *name, size_t name_len, size_t chunk_size, int flags TSRMLS_DC); static inline php_output_handler_status_t php_output_handler_op(php_output_handler *handler, php_output_context *context); static inline int php_output_handler_append(php_output_handler *handler, const php_output_buffer *buf TSRMLS_DC); static inline zval *php_output_handler_status(php_output_handler *handler, zval *entry); @@ -86,12 +86,12 @@ static inline void php_output_init_globals(zend_output_globals *G) /* }}} */ /* {{{ stderr/stdout writer if not PHP_OUTPUT_ACTIVATED */ -static zend_str_size_int php_output_stdout(const char *str, zend_str_size_size_t str_len) +static int php_output_stdout(const char *str, size_t str_len) { fwrite(str, 1, str_len, stdout); return str_len; } -static zend_str_size_int php_output_stderr(const char *str, zend_str_size_size_t str_len) +static int php_output_stderr(const char *str, size_t str_len) { fwrite(str, 1, str_len, stderr); /* See http://support.microsoft.com/kb/190351 */ @@ -100,7 +100,7 @@ static zend_str_size_int php_output_stderr(const char *str, zend_str_size_size_t #endif return str_len; } -static zend_str_size_int (*php_output_direct)(const char *str, zend_str_size_size_t str_len) = php_output_stderr; +static int (*php_output_direct)(const char *str, size_t str_len) = php_output_stderr; /* }}} */ /* {{{ void php_output_header(TSRMLS_D) */ @@ -232,7 +232,7 @@ PHPAPI int php_output_get_status(TSRMLS_D) /* {{{ int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC) * Unbuffered write */ -PHPAPI zend_str_size_int php_output_write_unbuffered(const char *str, zend_str_size_size_t len TSRMLS_DC) +PHPAPI int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC) { if (OG(flags) & PHP_OUTPUT_DISABLED) { return 0; @@ -246,14 +246,14 @@ PHPAPI zend_str_size_int php_output_write_unbuffered(const char *str, zend_str_s /* {{{ int php_output_write(const char *str, size_t len TSRMLS_DC) * Buffered write */ -PHPAPI zend_str_size_int php_output_write(const char *str, zend_str_size_size_t len TSRMLS_DC) +PHPAPI int php_output_write(const char *str, size_t len TSRMLS_DC) { if (OG(flags) & PHP_OUTPUT_DISABLED) { return 0; } if (OG(flags) & PHP_OUTPUT_ACTIVATED) { php_output_op(PHP_OUTPUT_HANDLER_WRITE, str, len TSRMLS_CC); - return len; + return (int) len; } return php_output_direct(str, len); } @@ -261,7 +261,7 @@ PHPAPI zend_str_size_int php_output_write(const char *str, zend_str_size_size_t /* {{{ SUCCESS|FAILURE php_output_flush(TSRMLS_D) * Flush the most recent output handlers buffer */ -PHPAPI zend_str_size_int php_output_flush(TSRMLS_D) +PHPAPI int php_output_flush(TSRMLS_D) { php_output_context context; @@ -452,7 +452,7 @@ PHPAPI int php_output_start_user(zval *output_handler, size_t chunk_size, int fl /* {{{ SUCCESS|FAILURE php_output_start_internal(zval *name, php_output_handler_func_t handler, size_t chunk_size, int flags TSRMLS_DC) * Start an internal output handler that does not have to maintain a non-global state */ -PHPAPI int php_output_start_internal(const char *name, zend_str_size_size_t name_len, php_output_handler_func_t output_handler, zend_str_size_size_t chunk_size, int flags TSRMLS_DC) +PHPAPI int php_output_start_internal(const char *name, size_t name_len, php_output_handler_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC) { php_output_handler *handler; @@ -468,7 +468,7 @@ PHPAPI int php_output_start_internal(const char *name, zend_str_size_size_t name /* {{{ php_output_handler *php_output_handler_create_user(zval *handler, size_t chunk_size, int flags TSRMLS_DC) * Create a user level output handler */ -PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, zend_str_size_size_t chunk_size, int flags TSRMLS_DC) +PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, size_t chunk_size, int flags TSRMLS_DC) { char *handler_name = NULL, *error = NULL; php_output_handler *handler = NULL; @@ -480,8 +480,8 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, handler = php_output_handler_create_internal(ZEND_STRL(php_output_default_handler_name), php_output_handler_default_func, chunk_size, flags TSRMLS_CC); break; case IS_STRING: - if (Z_STRSIZE_P(output_handler) && (alias = php_output_handler_alias(Z_STRVAL_P(output_handler), Z_STRSIZE_P(output_handler) TSRMLS_CC))) { - handler = (*alias)(Z_STRVAL_P(output_handler), Z_STRSIZE_P(output_handler), chunk_size, flags TSRMLS_CC); + if (Z_STRLEN_P(output_handler) && (alias = php_output_handler_alias(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler) TSRMLS_CC))) { + handler = (*alias)(Z_STRVAL_P(output_handler), Z_STRLEN_P(output_handler), chunk_size, flags TSRMLS_CC); break; } default: @@ -509,7 +509,7 @@ PHPAPI php_output_handler *php_output_handler_create_user(zval *output_handler, /* {{{ php_output_handler *php_output_handler_create_internal(zval *name, php_output_handler_context_func_t handler, size_t chunk_size, int flags TSRMLS_DC) * Create an internal output handler that can maintain a non-global state */ -PHPAPI php_output_handler *php_output_handler_create_internal(const char *name, zend_str_size_size_t name_len, php_output_handler_context_func_t output_handler, zend_str_size_size_t chunk_size, int flags TSRMLS_DC) +PHPAPI php_output_handler *php_output_handler_create_internal(const char *name, size_t name_len, php_output_handler_context_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC) { php_output_handler *handler; @@ -590,7 +590,7 @@ PHPAPI int php_output_handler_started(const char *name, size_t name_len TSRMLS_D /* {{{ int php_output_handler_conflict(zval *handler_new, zval *handler_old TSRMLS_DC) * Check whether a certain handler is in use and issue a warning that the new handler would conflict with the already used one */ -PHPAPI int php_output_handler_conflict(const char *handler_new, zend_str_size_size_t handler_new_len, const char *handler_set, zend_str_size_size_t handler_set_len TSRMLS_DC) +PHPAPI int php_output_handler_conflict(const char *handler_new, size_t handler_new_len, const char *handler_set, size_t handler_set_len TSRMLS_DC) { if (php_output_handler_started(handler_set, handler_set_len TSRMLS_CC)) { if (handler_new_len != handler_set_len || memcmp(handler_new, handler_set, handler_set_len)) { @@ -606,7 +606,7 @@ PHPAPI int php_output_handler_conflict(const char *handler_new, zend_str_size_si /* {{{ SUCCESS|FAILURE php_output_handler_conflict_register(zval *name, php_output_handler_conflict_check_t check_func TSRMLS_DC) * Register a conflict checking function on MINIT */ -PHPAPI int php_output_handler_conflict_register(const char *name, zend_str_size_size_t name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC) +PHPAPI int php_output_handler_conflict_register(const char *name, size_t name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC) { if (!EG(current_module)) { zend_error(E_ERROR, "Cannot register an output handler conflict outside of MINIT"); @@ -618,7 +618,7 @@ PHPAPI int php_output_handler_conflict_register(const char *name, zend_str_size_ /* {{{ SUCCESS|FAILURE php_output_handler_reverse_conflict_register(zval *name, php_output_handler_conflict_check_t check_func TSRMLS_DC) * Register a reverse conflict checking function on MINIT */ -PHPAPI int php_output_handler_reverse_conflict_register(const char *name, zend_str_size_size_t name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC) +PHPAPI int php_output_handler_reverse_conflict_register(const char *name, size_t name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC) { HashTable rev, *rev_ptr = NULL; @@ -646,7 +646,7 @@ PHPAPI int php_output_handler_reverse_conflict_register(const char *name, zend_s /* {{{ php_output_handler_alias_ctor_t php_output_handler_alias(zval *name TSRMLS_DC) * Get an internal output handler for a user handler if it exists */ -PHPAPI php_output_handler_alias_ctor_t *php_output_handler_alias(const char *name, zend_str_size_size_t name_len TSRMLS_DC) +PHPAPI php_output_handler_alias_ctor_t *php_output_handler_alias(const char *name, size_t name_len TSRMLS_DC) { php_output_handler_alias_ctor_t *func = NULL; @@ -657,7 +657,7 @@ PHPAPI php_output_handler_alias_ctor_t *php_output_handler_alias(const char *nam /* {{{ SUCCESS|FAILURE php_output_handler_alias_register(zval *name, php_output_handler_alias_ctor_t func TSRMLS_DC) * Registers an internal output handler as alias for a user handler */ -PHPAPI int php_output_handler_alias_register(const char *name, zend_str_size_size_t name_len, php_output_handler_alias_ctor_t func TSRMLS_DC) +PHPAPI int php_output_handler_alias_register(const char *name, size_t name_len, php_output_handler_alias_ctor_t func TSRMLS_DC) { if (!EG(current_module)) { zend_error(E_ERROR, "Cannot register an output handler alias outside of MINIT"); @@ -797,7 +797,7 @@ static inline void php_output_context_reset(php_output_context *context) /* {{{ static void php_output_context_feed(php_output_context *context, char *, size_t, size_t) * Feed output contexts input buffer */ -static inline void php_output_context_feed(php_output_context *context, char *data, zend_str_size_size_t size, zend_str_size_size_t used, zend_bool free) +static inline void php_output_context_feed(php_output_context *context, char *data, size_t size, size_t used, zend_bool free) { if (context->in.free && context->in.data) { efree(context->in.data); @@ -859,7 +859,7 @@ static inline void php_output_context_dtor(php_output_context *context) /* {{{ static php_output_handler *php_output_handler_init(zval *name, size_t chunk_size, int flags TSRMLS_DC) * Allocates and initializes a php_output_handler structure */ -static inline php_output_handler *php_output_handler_init(const char *name, zend_str_size_size_t name_len, zend_str_size_size_t chunk_size, int flags TSRMLS_DC) +static inline php_output_handler *php_output_handler_init(const char *name, size_t name_len, size_t chunk_size, int flags TSRMLS_DC) { php_output_handler *handler; @@ -883,9 +883,9 @@ static inline int php_output_handler_append(php_output_handler *handler, const p OG(flags) |= PHP_OUTPUT_WRITTEN; /* store it away */ if ((handler->buffer.size - handler->buffer.used) <= buf->used) { - zend_str_size grow_int = PHP_OUTPUT_HANDLER_INITBUF_SIZE(handler->size); - zend_str_size grow_buf = PHP_OUTPUT_HANDLER_INITBUF_SIZE(buf->used - (handler->buffer.size - handler->buffer.used)); - zend_str_size grow_max = MAX(grow_int, grow_buf); + size_t grow_int = PHP_OUTPUT_HANDLER_INITBUF_SIZE(handler->size); + size_t grow_buf = PHP_OUTPUT_HANDLER_INITBUF_SIZE(buf->used - (handler->buffer.size - handler->buffer.used)); + size_t grow_max = MAX(grow_int, grow_buf); handler->buffer.data = erealloc(handler->buffer.data, handler->buffer.size + grow_max); handler->buffer.size += grow_max; @@ -964,9 +964,9 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl status = PHP_OUTPUT_HANDLER_NO_DATA; if (Z_TYPE_P(retval) != IS_BOOL) { convert_to_string_ex(&retval); - if (Z_STRSIZE_P(retval)) { - context->out.data = estrndup(Z_STRVAL_P(retval), Z_STRSIZE_P(retval)); - context->out.used = Z_STRSIZE_P(retval); + if (Z_STRLEN_P(retval)) { + context->out.data = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); + context->out.used = Z_STRLEN_P(retval); context->out.free = 1; status = PHP_OUTPUT_HANDLER_SUCCESS; } @@ -1260,7 +1260,7 @@ static int php_output_handler_compat_func(void **handler_context, php_output_con if (func) { char *out_str = NULL; - zend_str_size out_len = 0; + uint out_len = 0; func(output_context->in.data, output_context->in.used, &out_str, &out_len, output_context->op TSRMLS_CC); @@ -1554,9 +1554,9 @@ PHP_FUNCTION(output_reset_rewrite_vars) PHP_FUNCTION(output_add_rewrite_var) { char *name, *value; - zend_str_size name_len, value_len; + int name_len, value_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &name, &name_len, &value, &value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &value, &value_len) == FAILURE) { return; } diff --git a/main/php.h b/main/php.h index 48830f8aec772..7c1f8fd0c7b96 100644 --- a/main/php.h +++ b/main/php.h @@ -180,8 +180,6 @@ typedef unsigned int socklen_t; # endif #endif -#include "php_stdint.h" - #include "zend_hash.h" #include "zend_alloc.h" #include "zend_stack.h" @@ -279,8 +277,8 @@ ssize_t pread(int, void *, size_t, off64_t); BEGIN_EXTERN_C() void phperror(char *error); -PHPAPI zend_str_size_int php_write(void *buf, zend_str_size_uint size TSRMLS_DC); -PHPAPI zend_str_size_int php_printf(const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, +PHPAPI int php_write(void *buf, uint size TSRMLS_DC); +PHPAPI int php_printf(const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, 2); PHPAPI int php_get_module_initialized(void); PHPAPI void php_log_err(char *log_message TSRMLS_DC); diff --git a/main/php_ini.c b/main/php_ini.c index ad3dc8fd86af5..cb2c7ea80895b 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -80,8 +80,7 @@ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type TSRMLS_DC) ini_entry->displayer(ini_entry, type); } else { char *display_string; - zend_str_size display_string_length; - int esc_html=0; + uint display_string_length, esc_html=0; if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { if (ini_entry->orig_value && ini_entry->orig_value[0]) { @@ -229,17 +228,17 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t /* PHP and Zend extensions are not added into configuration hash! */ if (!is_special_section && !strcasecmp(Z_STRVAL_P(arg1), PHP_EXTENSION_TOKEN)) { /* load PHP extension */ - extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRSIZE_P(arg2)); + extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)); zend_llist_add_element(&extension_lists.functions, &extension_name); } else if (!is_special_section && !strcasecmp(Z_STRVAL_P(arg1), ZEND_EXTENSION_TOKEN)) { /* load Zend extension */ - extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRSIZE_P(arg2)); + extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)); zend_llist_add_element(&extension_lists.engine, &extension_name); /* All other entries are added into either configuration_hash or active ini section array */ } else { /* Store in active hash */ - zend_hash_update(active_hash, Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, arg2, sizeof(zval), (void **) &entry); - Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRSIZE_P(entry)); + zend_hash_update(active_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, arg2, sizeof(zval), (void **) &entry); + Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry)); } } break; @@ -256,23 +255,23 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t /* fprintf(stdout, "ZEND_INI_PARSER_POP_ENTRY: %s[%s] = %s\n",Z_STRVAL_P(arg1), Z_STRVAL_P(arg3), Z_STRVAL_P(arg2)); */ /* If option not found in hash or is not an array -> create array, otherwise add to existing array */ - if (zend_hash_find(active_hash, Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, (void **) &find_arr) == FAILURE || Z_TYPE_P(find_arr) != IS_ARRAY) { + if (zend_hash_find(active_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, (void **) &find_arr) == FAILURE || Z_TYPE_P(find_arr) != IS_ARRAY) { option_arr = (zval *) pemalloc(sizeof(zval), 1); INIT_PZVAL(option_arr); Z_TYPE_P(option_arr) = IS_ARRAY; Z_ARRVAL_P(option_arr) = (HashTable *) pemalloc(sizeof(HashTable), 1); zend_hash_init(Z_ARRVAL_P(option_arr), 0, NULL, (dtor_func_t) config_zval_dtor, 1); - zend_hash_update(active_hash, Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1) + 1, option_arr, sizeof(zval), (void **) &find_arr); + zend_hash_update(active_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1) + 1, option_arr, sizeof(zval), (void **) &find_arr); free(option_arr); } /* arg3 is possible option offset name */ - if (arg3 && Z_STRSIZE_P(arg3) > 0) { - zend_symtable_update(Z_ARRVAL_P(find_arr), Z_STRVAL_P(arg3), Z_STRSIZE_P(arg3) + 1, arg2, sizeof(zval), (void **) &entry); + if (arg3 && Z_STRLEN_P(arg3) > 0) { + zend_symtable_update(Z_ARRVAL_P(find_arr), Z_STRVAL_P(arg3), Z_STRLEN_P(arg3) + 1, arg2, sizeof(zval), (void **) &entry); } else { zend_hash_next_index_insert(Z_ARRVAL_P(find_arr), arg2, sizeof(zval), (void **) &entry); } - Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRSIZE_P(entry)); + Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry)); } break; @@ -281,13 +280,13 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t /* fprintf(stdout, "ZEND_INI_PARSER_SECTION: %s\n",Z_STRVAL_P(arg1)); */ char *key = NULL; - zend_str_size key_len; + uint key_len; /* PATH sections */ if (!strncasecmp(Z_STRVAL_P(arg1), "PATH", sizeof("PATH") - 1)) { key = Z_STRVAL_P(arg1); key = key + sizeof("PATH") - 1; - key_len = Z_STRSIZE_P(arg1) - sizeof("PATH") + 1; + key_len = Z_STRLEN_P(arg1) - sizeof("PATH") + 1; is_special_section = 1; has_per_dir_config = 1; @@ -298,7 +297,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t } else if (!strncasecmp(Z_STRVAL_P(arg1), "HOST", sizeof("HOST") - 1)) { key = Z_STRVAL_P(arg1); key = key + sizeof("HOST") - 1; - key_len = Z_STRSIZE_P(arg1) - sizeof("HOST") + 1; + key_len = Z_STRLEN_P(arg1) - sizeof("HOST") + 1; is_special_section = 1; has_per_host_config = 1; zend_str_tolower(key, key_len); /* host names are case-insensitive. */ @@ -359,14 +358,14 @@ static void php_load_php_extension_cb(void *arg TSRMLS_DC) static void php_load_zend_extension_cb(void *arg TSRMLS_DC) { char *filename = *((char **) arg); - zend_str_size length = strlen(filename); + int length = strlen(filename); if (IS_ABSOLUTE_PATH(filename, length)) { zend_load_extension(filename); } else { char *libpath; char *extension_dir = INI_STR("extension_dir"); - zend_str_size extension_dir_len = strlen(extension_dir); + int extension_dir_len = strlen(extension_dir); if (IS_SLASH(extension_dir[extension_dir_len-1])) { spprintf(&libpath, 0, "%s%s", extension_dir, filename); @@ -385,7 +384,7 @@ int php_init_config(TSRMLS_D) { char *php_ini_file_name = NULL; char *php_ini_search_path = NULL; - zend_str_size php_ini_scanned_path_len; + int php_ini_scanned_path_len; char *open_basedir; int free_ini_search_path = 0; zend_file_handle fh; @@ -408,7 +407,7 @@ int php_init_config(TSRMLS_D) php_ini_search_path = sapi_module.php_ini_path_override; free_ini_search_path = 0; } else if (!sapi_module.php_ini_ignore) { - zend_str_size search_path_size; + int search_path_size; char *default_location; char *env_location; static const char paths_separator[] = { ZEND_PATHS_SEPARATOR, 0 }; @@ -422,7 +421,7 @@ int php_init_config(TSRMLS_D) #ifdef PHP_WIN32 if (!env_location) { char dummybuf; - zend_str_size size; + int size; SetLastError(0); @@ -599,8 +598,8 @@ int php_init_config(TSRMLS_D) { zval tmp; - Z_STRSIZE(tmp) = strlen(fh.filename); - Z_STRVAL(tmp) = zend_strndup(fh.filename, Z_STRSIZE(tmp)); + Z_STRLEN(tmp) = strlen(fh.filename); + Z_STRVAL(tmp) = zend_strndup(fh.filename, Z_STRLEN(tmp)); Z_TYPE(tmp) = IS_STRING; Z_SET_REFCOUNT(tmp, 0); @@ -608,7 +607,7 @@ int php_init_config(TSRMLS_D) if (php_ini_opened_path) { efree(php_ini_opened_path); } - php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRSIZE(tmp)); + php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); } } @@ -672,7 +671,7 @@ int php_init_config(TSRMLS_D) free(namelist); if (total_l) { - zend_str_size php_ini_scanned_files_len = (php_ini_scanned_files) ? strlen(php_ini_scanned_files) + 1 : 0; + int php_ini_scanned_files_len = (php_ini_scanned_files) ? strlen(php_ini_scanned_files) + 1 : 0; php_ini_scanned_files = (char *) realloc(php_ini_scanned_files, php_ini_scanned_files_len + total_l + 1); if (!php_ini_scanned_files_len) { *php_ini_scanned_files = '\0'; @@ -770,7 +769,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int { char *str; zval *data; - zend_str_size str_len; + uint str_len; ulong num_index; /* Walk through config hash and alter matching ini entries using the values found in the hash */ @@ -779,7 +778,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int zend_hash_move_forward(source_hash) ) { zend_hash_get_current_data(source_hash, (void **) &data); - zend_alter_ini_entry_ex(str, str_len, Z_STRVAL_P(data), Z_STRSIZE_P(data), modify_type, stage, 0 TSRMLS_CC); + zend_alter_ini_entry_ex(str, str_len, Z_STRVAL_P(data), Z_STRLEN_P(data), modify_type, stage, 0 TSRMLS_CC); } } /* }}} */ @@ -794,7 +793,7 @@ PHPAPI int php_ini_has_per_dir_config(void) /* {{{ php_ini_activate_per_dir_config */ -PHPAPI void php_ini_activate_per_dir_config(char *path, zend_str_size_uint path_len TSRMLS_DC) +PHPAPI void php_ini_activate_per_dir_config(char *path, uint path_len TSRMLS_DC) { zval *tmp2; char *ptr; @@ -803,12 +802,7 @@ PHPAPI void php_ini_activate_per_dir_config(char *path, zend_str_size_uint path_ char path_bak[MAXPATHLEN]; #endif -#if PHP_WIN32 - /* MAX_PATH is \0-terminated, path_len == MAXPATHLEN would overrun path_bak */ - if (path_len >= MAXPATHLEN) { -#else if (path_len > MAXPATHLEN) { -#endif return; } @@ -845,7 +839,7 @@ PHPAPI int php_ini_has_per_host_config(void) /* {{{ php_ini_activate_per_host_config */ -PHPAPI void php_ini_activate_per_host_config(const char *host, zend_str_size_uint host_len TSRMLS_DC) +PHPAPI void php_ini_activate_per_host_config(const char *host, uint host_len TSRMLS_DC) { zval *tmp; @@ -860,7 +854,7 @@ PHPAPI void php_ini_activate_per_host_config(const char *host, zend_str_size_uin /* {{{ cfg_get_entry */ -PHPAPI zval *cfg_get_entry(const char *name, zend_str_size_uint name_length) +PHPAPI zval *cfg_get_entry(const char *name, uint name_length) { zval *tmp; diff --git a/main/php_ini.h b/main/php_ini.h index 17a5c0e6bc0ef..65c80f75933b4 100644 --- a/main/php_ini.h +++ b/main/php_ini.h @@ -28,7 +28,7 @@ PHPAPI void config_zval_dtor(zval *zvalue); int php_init_config(TSRMLS_D); int php_shutdown_config(void); void php_ini_register_extensions(TSRMLS_D); -PHPAPI zval *cfg_get_entry(const char *name, zend_str_size_uint name_length); +PHPAPI zval *cfg_get_entry(const char *name, uint name_length); PHPAPI int cfg_get_long(const char *varname, long *result); PHPAPI int cfg_get_double(const char *varname, double *result); PHPAPI int cfg_get_string(const char *varname, char **result); @@ -36,8 +36,8 @@ PHPAPI int php_parse_user_ini_file(const char *dirname, char *ini_filename, Hash PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int stage TSRMLS_DC); PHPAPI int php_ini_has_per_dir_config(void); PHPAPI int php_ini_has_per_host_config(void); -PHPAPI void php_ini_activate_per_dir_config(char *path, zend_str_size_uint path_len TSRMLS_DC); -PHPAPI void php_ini_activate_per_host_config(const char *host, zend_str_size_uint host_len TSRMLS_DC); +PHPAPI void php_ini_activate_per_dir_config(char *path, uint path_len TSRMLS_DC); +PHPAPI void php_ini_activate_per_host_config(const char *host, uint host_len TSRMLS_DC); PHPAPI HashTable* php_ini_get_configuration_hash(void); END_EXTERN_C() diff --git a/main/php_network.h b/main/php_network.h index cef1ad6580876..c1535ee040b64 100644 --- a/main/php_network.h +++ b/main/php_network.h @@ -62,7 +62,7 @@ * unless buf is not NULL. * Also works sensibly for win32 */ BEGIN_EXTERN_C() -PHPAPI char *php_socket_strerror(long err, char *buf, zend_str_size_size_t bufsize); +PHPAPI char *php_socket_strerror(long err, char *buf, size_t bufsize); END_EXTERN_C() #ifdef HAVE_NETINET_IN_H @@ -248,7 +248,7 @@ PHPAPI php_socket_t php_network_bind_socket_to_local_addr(const char *host, unsi TSRMLS_DC); PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock, - char **textaddr, zend_str_size_long *textaddrlen, + char **textaddr, long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen, struct timeval *timeout, @@ -257,13 +257,13 @@ PHPAPI php_socket_t php_network_accept_incoming(php_socket_t srvsock, TSRMLS_DC); PHPAPI int php_network_get_sock_name(php_socket_t sock, - char **textaddr, zend_str_size_long *textaddrlen, + char **textaddr, long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC); PHPAPI int php_network_get_peer_name(php_socket_t sock, - char **textaddr, zend_str_size_long *textaddrlen, + char **textaddr, long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC); @@ -277,7 +277,7 @@ struct _php_netstream_data_t { char is_blocked; struct timeval timeout; char timeout_event; - zend_str_size_size_t ownsize; + size_t ownsize; }; typedef struct _php_netstream_data_t php_netstream_data_t; PHPAPI extern php_stream_ops php_stream_socket_ops; @@ -293,14 +293,14 @@ PHPAPI void php_network_populate_name_from_sockaddr( /* input address */ struct sockaddr *sa, socklen_t sl, /* output readable address */ - char **textaddr, zend_str_size_long *textaddrlen, + char **textaddr, long *textaddrlen, /* output address */ struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC); PHPAPI int php_network_parse_network_address_with_port(const char *addr, - zend_str_size_long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC); + long addrlen, struct sockaddr *sa, socklen_t *sl TSRMLS_DC); END_EXTERN_C() #define php_stream_sock_open_from_socket(socket, persistent) _php_stream_sock_open_from_socket((socket), (persistent) STREAMS_CC TSRMLS_CC) diff --git a/main/php_output.h b/main/php_output.h index 488ce5d8320d7..833bddec389cf 100644 --- a/main/php_output.h +++ b/main/php_output.h @@ -92,8 +92,8 @@ typedef enum _php_output_handler_hook_t { typedef struct _php_output_buffer { char *data; - zend_str_size_size_t size; - zend_str_size_size_t used; + size_t size; + size_t used; uint free:1; uint _res:31; } php_output_buffer; @@ -110,15 +110,15 @@ typedef struct _php_output_context { #define PHP_OUTPUT_TSRMLS(ctx) TSRMLS_FETCH_FROM_CTX((ctx)->tsrm_ls) /* old-style, stateless callback */ -typedef void (*php_output_handler_func_t)(char *output, zend_str_size_uint output_len, char **handled_output, zend_str_size_uint *handled_output_len, int mode TSRMLS_DC); +typedef void (*php_output_handler_func_t)(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC); /* new-style, opaque context callback */ typedef int (*php_output_handler_context_func_t)(void **handler_context, php_output_context *output_context); /* output handler context dtor */ typedef void (*php_output_handler_context_dtor_t)(void *opaq TSRMLS_DC); /* conflict check callback */ -typedef int (*php_output_handler_conflict_check_t)(const char *handler_name, zend_str_size_size_t handler_name_len TSRMLS_DC); +typedef int (*php_output_handler_conflict_check_t)(const char *handler_name, size_t handler_name_len TSRMLS_DC); /* ctor for aliases */ -typedef struct _php_output_handler *(*php_output_handler_alias_ctor_t)(const char *handler_name, zend_str_size_size_t handler_name_len, zend_str_size_size_t chunk_size, int flags TSRMLS_DC); +typedef struct _php_output_handler *(*php_output_handler_alias_ctor_t)(const char *handler_name, size_t handler_name_len, size_t chunk_size, int flags TSRMLS_DC); typedef struct _php_output_handler_user_func_t { zend_fcall_info fci; @@ -128,10 +128,10 @@ typedef struct _php_output_handler_user_func_t { typedef struct _php_output_handler { char *name; - zend_str_size_size_t name_len; + size_t name_len; int flags; int level; - zend_str_size_size_t size; + size_t size; php_output_buffer buffer; void *opaq; @@ -149,7 +149,7 @@ ZEND_BEGIN_MODULE_GLOBALS(output) php_output_handler *active; php_output_handler *running; const char *output_start_filename; - zend_str_size_int output_start_lineno; + int output_start_lineno; ZEND_END_MODULE_GLOBALS(output) /* there should not be a need to use OG() from outside of output.c */ @@ -207,10 +207,10 @@ PHPAPI void php_output_set_implicit_flush(int flush TSRMLS_DC); PHPAPI const char *php_output_get_start_filename(TSRMLS_D); PHPAPI int php_output_get_start_lineno(TSRMLS_D); -PHPAPI zend_str_size_int php_output_write_unbuffered(const char *str, zend_str_size_size_t len TSRMLS_DC); -PHPAPI zend_str_size_int php_output_write(const char *str, zend_str_size_size_t len TSRMLS_DC); +PHPAPI int php_output_write_unbuffered(const char *str, size_t len TSRMLS_DC); +PHPAPI int php_output_write(const char *str, size_t len TSRMLS_DC); -PHPAPI zend_str_size_int php_output_flush(TSRMLS_D); +PHPAPI int php_output_flush(TSRMLS_D); PHPAPI void php_output_flush_all(TSRMLS_D); PHPAPI int php_output_clean(TSRMLS_D); PHPAPI void php_output_clean_all(TSRMLS_D); @@ -227,25 +227,25 @@ PHPAPI php_output_handler* php_output_get_active_handler(TSRMLS_D); PHPAPI int php_output_start_default(TSRMLS_D); PHPAPI int php_output_start_devnull(TSRMLS_D); -PHPAPI int php_output_start_user(zval *output_handler, zend_str_size_size_t chunk_size, int flags TSRMLS_DC); -PHPAPI int php_output_start_internal(const char *name, zend_str_size_size_t name_len, php_output_handler_func_t output_handler, zend_str_size_size_t chunk_size, int flags TSRMLS_DC); +PHPAPI int php_output_start_user(zval *output_handler, size_t chunk_size, int flags TSRMLS_DC); +PHPAPI int php_output_start_internal(const char *name, size_t name_len, php_output_handler_func_t output_handler, size_t chunk_size, int flags TSRMLS_DC); -PHPAPI php_output_handler *php_output_handler_create_user(zval *handler, zend_str_size_size_t chunk_size, int flags TSRMLS_DC); -PHPAPI php_output_handler *php_output_handler_create_internal(const char *name, zend_str_size_size_t name_len, php_output_handler_context_func_t handler, zend_str_size_size_t chunk_size, int flags TSRMLS_DC); +PHPAPI php_output_handler *php_output_handler_create_user(zval *handler, size_t chunk_size, int flags TSRMLS_DC); +PHPAPI php_output_handler *php_output_handler_create_internal(const char *name, size_t name_len, php_output_handler_context_func_t handler, size_t chunk_size, int flags TSRMLS_DC); PHPAPI void php_output_handler_set_context(php_output_handler *handler, void *opaq, void (*dtor)(void* TSRMLS_DC) TSRMLS_DC); PHPAPI int php_output_handler_start(php_output_handler *handler TSRMLS_DC); -PHPAPI int php_output_handler_started(const char *name, zend_str_size_size_t name_len TSRMLS_DC); +PHPAPI int php_output_handler_started(const char *name, size_t name_len TSRMLS_DC); PHPAPI int php_output_handler_hook(php_output_handler_hook_t type, void *arg TSRMLS_DC); PHPAPI void php_output_handler_dtor(php_output_handler *handler TSRMLS_DC); PHPAPI void php_output_handler_free(php_output_handler **handler TSRMLS_DC); -PHPAPI int php_output_handler_conflict(const char *handler_new, zend_str_size_size_t handler_new_len, const char *handler_set, zend_str_size_size_t handler_set_len TSRMLS_DC); -PHPAPI int php_output_handler_conflict_register(const char *handler_name, zend_str_size_size_t handler_name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC); -PHPAPI int php_output_handler_reverse_conflict_register(const char *handler_name, zend_str_size_size_t handler_name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC); +PHPAPI int php_output_handler_conflict(const char *handler_new, size_t handler_new_len, const char *handler_set, size_t handler_set_len TSRMLS_DC); +PHPAPI int php_output_handler_conflict_register(const char *handler_name, size_t handler_name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC); +PHPAPI int php_output_handler_reverse_conflict_register(const char *handler_name, size_t handler_name_len, php_output_handler_conflict_check_t check_func TSRMLS_DC); -PHPAPI php_output_handler_alias_ctor_t *php_output_handler_alias(const char *handler_name, zend_str_size_size_t handler_name_len TSRMLS_DC); -PHPAPI int php_output_handler_alias_register(const char *handler_name, zend_str_size_size_t handler_name_len, php_output_handler_alias_ctor_t func TSRMLS_DC); +PHPAPI php_output_handler_alias_ctor_t *php_output_handler_alias(const char *handler_name, size_t handler_name_len TSRMLS_DC); +PHPAPI int php_output_handler_alias_register(const char *handler_name, size_t handler_name_len, php_output_handler_alias_ctor_t func TSRMLS_DC); END_EXTERN_C() diff --git a/main/php_stdint.h b/main/php_stdint.h deleted file mode 100644 index 87edb0fde085a..0000000000000 --- a/main/php_stdint.h +++ /dev/null @@ -1,206 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2013 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Michael Wallner | - +----------------------------------------------------------------------+ -*/ - -#ifndef PHP_STDINT_H -#define PHP_STDINT_H - -#if defined(_MSC_VER) -/* Make sure the regular stdint.h wasn't included already and prevent it to be - included afterwards. Though if some other library needs some stuff from - stdint.h included afterwards and misses it, we'd have to extend ours. On - the other hand, if stdint.h was included before, some conflicts might - happen so we'd likewise have to fix ours. */ -# if !defined(_STDINT) -# define _STDINT -# include "win32/php_stdint.h" -# endif -# define HAVE_INT8_T 1 -# define HAVE_UINT8_T 1 -# define HAVE_INT16_T 1 -# define HAVE_UINT16_T 1 -# define HAVE_INT32_T 1 -# define HAVE_UINT32_T 1 -# define HAVE_INT64_T 1 -# define HAVE_UINT64_T 1 -#else - -#include "php_config.h" - -#if HAVE_SYS_TYPES_H -# include -#endif - -#if HAVE_INTTYPES_H -# include -#endif - -#if HAVE_STDINT_H -# include -#endif - -#ifndef HAVE_INT8_T -# ifdef HAVE_INT8 -typedef int8 int8_t; -# else -typedef signed char int8_t; -# endif -#endif - -#ifndef INT8_C -# define INT8_C(c) c -#endif - -#ifndef HAVE_UINT8_T -# ifdef HAVE_UINT8 -typedef uint8 uint8_t -# elif HAVE_U_INT8_T -typedef u_int8_t uint8_t; -# else -typedef unsigned char uint8_t; -# endif -#endif - -#ifndef UINT8_C -# define UINT8_C(c) c -#endif - -#ifndef HAVE_INT16_T -# ifdef HAVE_INT16 -typedef int16 int16_t; -# elif SIZEOF_SHORT >= 2 -typedef signed short int16_t; -# else -# error "No suitable 16bit integer type found" -# endif -#endif - -#ifndef INT16_C -# define INT16_C(c) c -#endif - -#ifndef HAVE_UINT16_T -# ifdef HAVE_UINT16 -typedef uint16 uint16_t -# elif HAVE_U_INT16_T -typedef u_int16_t uint16_t; -# elif SIZEOF_SHORT >= 2 -typedef unsigned short uint16_t; -# else -# error "No suitable 16bit integer type found" -# endif -#endif - -#ifndef UINT16_C -# define UINT16_C(c) c -#endif - -#ifndef HAVE_INT32_T -# ifdef HAVE_INT32 -typedef int32 int32_t; -# elif SIZEOF_INT >= 4 -typedef int int32_t; -# elif SIZEOF_LONG >= 4 -typedef long int32_t; -# else -# error "No suitable 32bit integer type found" -# endif -#endif - -#ifndef INT32_C -# define INT32_C(c) c -#endif - -#ifndef HAVE_UINT32_T -# ifdef HAVE_UINT32 -typedef uint32 uint32_t -# elif HAVE_U_INT32_T -typedef u_int32_t uint32_t; -# elif SIZEOF_INT >= 4 -typedef unsigned int uint32_t; -# elif SIZEOF_LONG >= 4 -typedef unsigned long uint32_t; -# else -# error "No suitable 32bit integer type found" -# endif -#endif - -#ifndef UINT32_C -# define UINT32_C(c) c ## U -#endif - -#ifndef HAVE_INT64_T -# ifdef HAVE_INT64 -typedef int64 int64_t; -# elif SIZEOF_INT >= 8 -typedef int int64_t; -# elif SIZEOF_LONG >= 8 -typedef long int64_t; -# elif SIZEOF_LONG_LONG >= 8 -typedef long long int64_t; -# else -# error "No suitable 64bit integer type found" -# endif -#endif - -#ifndef INT64_C -# if SIZEOF_INT >= 8 -# define INT64_C(c) c -# elif SIZEOF_LONG >= 8 -# define INT64_C(c) c ## L -# elif SIZEOF_LONG_LONG >= 8 -# define INT64_C(c) c ## LL -# endif -#endif - -#ifndef HAVE_UINT64_T -# ifdef HAVE_UINT64 -typedef uint64 uint64_t -# elif HAVE_U_INT64_T -typedef u_int64_t uint64_t; -# elif SIZEOF_INT >= 8 -typedef unsigned int uint64_t; -# elif SIZEOF_LONG >= 8 -typedef unsigned long uint64_t; -# elif SIZEOF_LONG_LONG >= 8 -typedef unsigned long long uint64_t; -# else -# error "No suitable 64bit integer type found" -# endif -#endif - -#ifndef UINT64_C -# if SIZEOF_INT >= 8 -# define UINT64_C(c) c ## U -# elif SIZEOF_LONG >= 8 -# define UINT64_C(c) c ## UL -# elif SIZEOF_LONG_LONG >= 8 -# define UINT64_C(c) c ## ULL -# endif -#endif - -#endif /* !PHP_WIN32 */ -#endif /* PHP_STDINT_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/main/php_streams.h b/main/php_streams.h index c56014c62e17f..5acf942e434bb 100644 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -131,31 +131,31 @@ typedef struct _php_stream_ops { typedef struct _php_stream_wrapper_ops { /* open/create a wrapped stream */ - php_stream *(*stream_opener)(php_stream_wrapper *wrapper, const char *filename, const char *mode, + php_stream *(*stream_opener)(php_stream_wrapper *wrapper, char *filename, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); /* close/destroy a wrapped stream */ int (*stream_closer)(php_stream_wrapper *wrapper, php_stream *stream TSRMLS_DC); /* stat a wrapped stream */ int (*stream_stat)(php_stream_wrapper *wrapper, php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC); /* stat a URL */ - int (*url_stat)(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); + int (*url_stat)(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); /* open a "directory" stream */ - php_stream *(*dir_opener)(php_stream_wrapper *wrapper, const char *filename, const char *mode, + php_stream *(*dir_opener)(php_stream_wrapper *wrapper, char *filename, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); const char *label; /* delete a file */ - int (*unlink)(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC); + int (*unlink)(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); /* rename a file */ - int (*rename)(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC); + int (*rename)(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC); /* Create/Remove directory */ - int (*stream_mkdir)(php_stream_wrapper *wrapper, const char *url, int mode, int options, php_stream_context *context TSRMLS_DC); - int (*stream_rmdir)(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC); + int (*stream_mkdir)(php_stream_wrapper *wrapper, char *url, int mode, int options, php_stream_context *context TSRMLS_DC); + int (*stream_rmdir)(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); /* Metadata handling */ - int (*stream_metadata)(php_stream_wrapper *wrapper, const char *url, int options, void *value, php_stream_context *context TSRMLS_DC); + int (*stream_metadata)(php_stream_wrapper *wrapper, char *url, int options, void *value, php_stream_context *context TSRMLS_DC); } php_stream_wrapper_ops; struct _php_stream_wrapper { @@ -322,26 +322,26 @@ PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen, #define php_stream_gets(stream, buf, maxlen) _php_stream_get_line((stream), (buf), (maxlen), NULL TSRMLS_CC) #define php_stream_get_line(stream, buf, maxlen, retlen) _php_stream_get_line((stream), (buf), (maxlen), (retlen) TSRMLS_CC) -PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *returned_len, const char *delim, size_t delim_len TSRMLS_DC); +PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *returned_len, char *delim, size_t delim_len TSRMLS_DC); /* CAREFUL! this is equivalent to puts NOT fputs! */ -PHPAPI int _php_stream_puts(php_stream *stream, const char *buf TSRMLS_DC); +PHPAPI int _php_stream_puts(php_stream *stream, char *buf TSRMLS_DC); #define php_stream_puts(stream, buf) _php_stream_puts((stream), (buf) TSRMLS_CC) PHPAPI int _php_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC); #define php_stream_stat(stream, ssb) _php_stream_stat((stream), (ssb) TSRMLS_CC) -PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); +PHPAPI int _php_stream_stat_path(char *path, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); #define php_stream_stat_path(path, ssb) _php_stream_stat_path((path), 0, (ssb), NULL TSRMLS_CC) #define php_stream_stat_path_ex(path, flags, ssb, context) _php_stream_stat_path((path), (flags), (ssb), (context) TSRMLS_CC) -PHPAPI int _php_stream_mkdir(const char *path, int mode, int options, php_stream_context *context TSRMLS_DC); +PHPAPI int _php_stream_mkdir(char *path, int mode, int options, php_stream_context *context TSRMLS_DC); #define php_stream_mkdir(path, mode, options, context) _php_stream_mkdir(path, mode, options, context TSRMLS_CC) -PHPAPI int _php_stream_rmdir(const char *path, int options, php_stream_context *context TSRMLS_DC); +PHPAPI int _php_stream_rmdir(char *path, int options, php_stream_context *context TSRMLS_DC); #define php_stream_rmdir(path, options, context) _php_stream_rmdir(path, options, context TSRMLS_CC) -PHPAPI php_stream *_php_stream_opendir(const char *path, int options, php_stream_context *context STREAMS_DC TSRMLS_DC); +PHPAPI php_stream *_php_stream_opendir(char *path, int options, php_stream_context *context STREAMS_DC TSRMLS_DC); #define php_stream_opendir(path, options, context) _php_stream_opendir((path), (options), (context) STREAMS_CC TSRMLS_CC) PHPAPI php_stream_dirent *_php_stream_readdir(php_stream *dirstream, php_stream_dirent *ent TSRMLS_DC); #define php_stream_readdir(dirstream, dirent) _php_stream_readdir((dirstream), (dirent) TSRMLS_CC) @@ -351,7 +351,7 @@ PHPAPI php_stream_dirent *_php_stream_readdir(php_stream *dirstream, php_stream_ PHPAPI int php_stream_dirent_alphasort(const char **a, const char **b); PHPAPI int php_stream_dirent_alphasortr(const char **a, const char **b); -PHPAPI int _php_stream_scandir(const char *dirname, char **namelist[], int flags, php_stream_context *context, +PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_stream_context *context, int (*compare) (const char **a, const char **b) TSRMLS_DC); #define php_stream_scandir(dirname, namelist, context, compare) _php_stream_scandir((dirname), (namelist), 0, (context), (compare) TSRMLS_CC) @@ -540,13 +540,13 @@ void php_shutdown_stream_hashes(TSRMLS_D); PHP_RSHUTDOWN_FUNCTION(streams); BEGIN_EXTERN_C() -PHPAPI int php_register_url_stream_wrapper(const char *protocol, php_stream_wrapper *wrapper TSRMLS_DC); -PHPAPI int php_unregister_url_stream_wrapper(const char *protocol TSRMLS_DC); -PHPAPI int php_register_url_stream_wrapper_volatile(const char *protocol, php_stream_wrapper *wrapper TSRMLS_DC); -PHPAPI int php_unregister_url_stream_wrapper_volatile(const char *protocol TSRMLS_DC); -PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); -PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const char **path_for_open, int options TSRMLS_DC); -PHPAPI const char *php_stream_locate_eol(php_stream *stream, const char *buf, size_t buf_len TSRMLS_DC); +PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC); +PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC); +PHPAPI int php_register_url_stream_wrapper_volatile(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC); +PHPAPI int php_unregister_url_stream_wrapper_volatile(char *protocol TSRMLS_DC); +PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); +PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char **path_for_open, int options TSRMLS_DC); +PHPAPI char *php_stream_locate_eol(php_stream *stream, char *buf, size_t buf_len TSRMLS_DC); #define php_stream_open_wrapper(path, mode, options, opened) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), NULL STREAMS_CC TSRMLS_CC) #define php_stream_open_wrapper_ex(path, mode, options, opened, context) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), (context) STREAMS_CC TSRMLS_CC) diff --git a/main/php_variables.c b/main/php_variables.c index 465a79dcc219e..fd52f311d17df 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -39,14 +39,14 @@ PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_arra } /* binary-safe version */ -PHPAPI void php_register_variable_safe(char *var, char *strval, zend_str_size_int str_len, zval *track_vars_array TSRMLS_DC) +PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zval *track_vars_array TSRMLS_DC) { zval new_entry; assert(strval != NULL); /* Prepare value */ - Z_STRSIZE(new_entry) = str_len; - Z_STRVAL(new_entry) = estrndup(strval, Z_STRSIZE(new_entry)); + Z_STRLEN(new_entry) = str_len; + Z_STRVAL(new_entry) = estrndup(strval, Z_STRLEN(new_entry)); Z_TYPE(new_entry) = IS_STRING; php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC); @@ -58,7 +58,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars char *ip; /* index pointer */ char *index; char *var, *var_orig; - zend_str_size var_len, index_len; + int var_len, index_len; zval *gpc_element, **gpc_element_p; zend_bool is_array = 0; HashTable *symtable1 = NULL; @@ -124,7 +124,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars int nest_level = 0; while (1) { char *index_s; - zend_str_size new_idx_len = 0; + int new_idx_len = 0; if(++nest_level > PG(max_input_nesting_level)) { HashTable *ht; @@ -244,7 +244,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler) while (s < e && (p = memchr(s, '&', (e - s)))) { last_value: if ((val = memchr(s, '=', (p - s)))) { /* have a value */ - zend_str_size val_len, new_val_len; + unsigned int val_len, new_val_len; if (++count > PG(max_input_vars)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded %ld. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); @@ -379,7 +379,8 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) } if (val) { /* have a value */ - zend_str_size val_len, new_val_len; + int val_len; + unsigned int new_val_len; *val++ = '\0'; php_url_decode(var, strlen(var)); @@ -390,7 +391,8 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) } efree(val); } else { - zend_str_size val_len, new_val_len; + int val_len; + unsigned int new_val_len; php_url_decode(var, strlen(var)); val_len = 0; @@ -417,7 +419,7 @@ void _php_import_environment_variables(zval *array_ptr TSRMLS_DC) { char buf[128]; char **env, *p, *t = buf; - zend_str_size alloc_size = sizeof(buf); + size_t alloc_size = sizeof(buf); unsigned long nlen; /* ptrdiff_t is not portable */ for (env = environ; env != NULL && *env != NULL; env++) { @@ -439,7 +441,7 @@ void _php_import_environment_variables(zval *array_ptr TSRMLS_DC) } } -zend_bool php_std_auto_global_callback(char *name, zend_str_size_uint name_len TSRMLS_DC) +zend_bool php_std_auto_global_callback(char *name, uint name_len TSRMLS_DC) { zend_printf("%s\n", name); return 0; /* don't rearm */ @@ -466,8 +468,8 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) for (i = 0; i < SG(request_info).argc; i++) { ALLOC_ZVAL(tmp); Z_TYPE_P(tmp) = IS_STRING; - Z_STRSIZE_P(tmp) = strlen(SG(request_info).argv[i]); - Z_STRVAL_P(tmp) = estrndup(SG(request_info).argv[i], Z_STRSIZE_P(tmp)); + Z_STRLEN_P(tmp) = strlen(SG(request_info).argv[i]); + Z_STRVAL_P(tmp) = estrndup(SG(request_info).argv[i], Z_STRLEN_P(tmp)); INIT_PZVAL(tmp); if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(zval *), NULL) == FAILURE) { if (Z_TYPE_P(tmp) == IS_STRING) { @@ -485,8 +487,8 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) /* auto-type */ ALLOC_ZVAL(tmp); Z_TYPE_P(tmp) = IS_STRING; - Z_STRSIZE_P(tmp) = strlen(ss); - Z_STRVAL_P(tmp) = estrndup(ss, Z_STRSIZE_P(tmp)); + Z_STRLEN_P(tmp) = strlen(ss); + Z_STRVAL_P(tmp) = estrndup(ss, Z_STRLEN_P(tmp)); INIT_PZVAL(tmp); count++; if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(zval *), NULL) == FAILURE) { @@ -578,7 +580,7 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC) { zval **src_entry, **dest_entry; char *string_key; - zend_str_size string_key_len; + uint string_key_len; ulong num_key; HashPosition pos; int key_type; @@ -611,9 +613,9 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC) } /* }}} */ -static zend_bool php_auto_globals_create_server(const char *name, zend_str_size_uint name_len TSRMLS_DC); -static zend_bool php_auto_globals_create_env(const char *name, zend_str_size_uint name_len TSRMLS_DC); -static zend_bool php_auto_globals_create_request(const char *name, zend_str_size_uint name_len TSRMLS_DC); +static zend_bool php_auto_globals_create_server(const char *name, uint name_len TSRMLS_DC); +static zend_bool php_auto_globals_create_env(const char *name, uint name_len TSRMLS_DC); +static zend_bool php_auto_globals_create_request(const char *name, uint name_len TSRMLS_DC); /* {{{ php_hash_environment */ @@ -628,7 +630,7 @@ int php_hash_environment(TSRMLS_D) } /* }}} */ -static zend_bool php_auto_globals_create_get(const char *name, zend_str_size_uint name_len TSRMLS_DC) +static zend_bool php_auto_globals_create_get(const char *name, uint name_len TSRMLS_DC) { zval *vars; @@ -651,7 +653,7 @@ static zend_bool php_auto_globals_create_get(const char *name, zend_str_size_uin return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_post(const char *name, zend_str_size_uint name_len TSRMLS_DC) +static zend_bool php_auto_globals_create_post(const char *name, uint name_len TSRMLS_DC) { zval *vars; @@ -678,7 +680,7 @@ static zend_bool php_auto_globals_create_post(const char *name, zend_str_size_ui return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_cookie(const char *name, zend_str_size_uint name_len TSRMLS_DC) +static zend_bool php_auto_globals_create_cookie(const char *name, uint name_len TSRMLS_DC) { zval *vars; @@ -701,7 +703,7 @@ static zend_bool php_auto_globals_create_cookie(const char *name, zend_str_size_ return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_files(const char *name, zend_str_size_uint name_len TSRMLS_DC) +static zend_bool php_auto_globals_create_files(const char *name, uint name_len TSRMLS_DC) { zval *vars; @@ -720,7 +722,7 @@ static zend_bool php_auto_globals_create_files(const char *name, zend_str_size_u return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_server(const char *name, zend_str_size_uint name_len TSRMLS_DC) +static zend_bool php_auto_globals_create_server(const char *name, uint name_len TSRMLS_DC) { if (PG(variables_order) && (strchr(PG(variables_order),'S') || strchr(PG(variables_order),'s'))) { php_register_server_variables(TSRMLS_C); @@ -758,7 +760,7 @@ static zend_bool php_auto_globals_create_server(const char *name, zend_str_size_ return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_env(const char *name, zend_str_size_uint name_len TSRMLS_DC) +static zend_bool php_auto_globals_create_env(const char *name, uint name_len TSRMLS_DC) { zval *env_vars = NULL; ALLOC_ZVAL(env_vars); @@ -779,7 +781,7 @@ static zend_bool php_auto_globals_create_env(const char *name, zend_str_size_uin return 0; /* don't rearm */ } -static zend_bool php_auto_globals_create_request(const char *name, zend_str_size_uint name_len TSRMLS_DC) +static zend_bool php_auto_globals_create_request(const char *name, uint name_len TSRMLS_DC) { zval *form_variables; unsigned char _gpc_flags[3] = {0, 0, 0}; diff --git a/main/php_variables.h b/main/php_variables.h index d6d156390bf32..8f5e96aac363a 100644 --- a/main/php_variables.h +++ b/main/php_variables.h @@ -38,7 +38,7 @@ void php_startup_auto_globals(TSRMLS_D); extern PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC); PHPAPI void php_register_variable(char *var, char *val, zval *track_vars_array TSRMLS_DC); /* binary-safe version */ -PHPAPI void php_register_variable_safe(char *var, char *val, zend_str_size_int val_len, zval *track_vars_array TSRMLS_DC); +PHPAPI void php_register_variable_safe(char *var, char *val, int val_len, zval *track_vars_array TSRMLS_DC); PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_array TSRMLS_DC); int php_hash_environment(TSRMLS_D); diff --git a/main/rfc1867.c b/main/rfc1867.c index 869eb9545c916..ed7ce9c0c172b 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -34,10 +34,6 @@ #include "rfc1867.h" #include "ext/standard/php_string.h" -#if defined(PHP_WIN32) && !defined(HAVE_ATOLL) -# define atoll(s) _atoi64(s) -#endif - #define DEBUG_FILE_UPLOAD ZEND_DEBUG static int dummy_encoding_translation(TSRMLS_D) @@ -57,7 +53,7 @@ static php_rfc1867_basename_t php_rfc1867_basename = NULL; PHPAPI int (*php_rfc1867_callback)(unsigned int event, void *event_data, void **extra TSRMLS_DC) = NULL; -static void safe_php_register_variable(char *var, char *strval, zend_str_size_int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC); +static void safe_php_register_variable(char *var, char *strval, int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC); /* The longest property name we use in an uploaded file array */ #define MAX_SIZE_OF_INDEX sizeof("[tmp_name]") @@ -162,7 +158,7 @@ static zend_bool is_protected_variable(char *varname TSRMLS_DC) /* {{{ */ } /* }}} */ -static void safe_php_register_variable(char *var, char *strval, zend_str_size_int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC) /* {{{ */ +static void safe_php_register_variable(char *var, char *strval, int val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC) /* {{{ */ { if (override_protection || !is_protected_variable(var TSRMLS_CC)) { php_register_variable_safe(var, strval, val_len, track_vars_array TSRMLS_CC); @@ -214,13 +210,13 @@ typedef struct { /* read buffer */ char *buffer; char *buf_begin; - zend_str_size_int bufsize; - zend_str_size_int bytes_in_buffer; + int bufsize; + int bytes_in_buffer; /* boundary info */ char *boundary; char *boundary_next; - zend_str_size_int boundary_next_len; + int boundary_next_len; const zend_encoding *input_encoding; const zend_encoding **detect_order; @@ -236,9 +232,9 @@ typedef struct { * Fill up the buffer with client data. * Returns number of bytes added to buffer. */ -static zend_str_size_int fill_buffer(multipart_buffer *self TSRMLS_DC) +static int fill_buffer(multipart_buffer *self TSRMLS_DC) { - zend_str_size_int bytes_to_read, total_read = 0, actual_read = 0; + int bytes_to_read, total_read = 0, actual_read = 0; /* shift the existing data if necessary */ if (self->bytes_in_buffer > 0 && self->buf_begin != self->buffer) { @@ -282,11 +278,11 @@ static int multipart_buffer_eof(multipart_buffer *self TSRMLS_DC) } /* create new multipart_buffer structure */ -static multipart_buffer *multipart_buffer_new(char *boundary, zend_str_size_int boundary_len TSRMLS_DC) +static multipart_buffer *multipart_buffer_new(char *boundary, int boundary_len TSRMLS_DC) { multipart_buffer *self = (multipart_buffer *) ecalloc(1, sizeof(multipart_buffer)); - zend_str_size_int minsize = boundary_len + 6; + int minsize = boundary_len + 6; if (minsize < FILLUNIT) minsize = FILLUNIT; self->buffer = (char *) ecalloc(1, minsize + 1); @@ -403,7 +399,7 @@ static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header T { char *line; mime_header_entry prev_entry, entry; - zend_str_size_int prev_len, cur_len; + int prev_len, cur_len; /* didn't find boundary, abort */ if (!find_boundary(self, self->boundary TSRMLS_CC)) { @@ -513,11 +509,11 @@ static char *php_ap_getword(const zend_encoding *encoding, char **line, char sto return res; } -static char *substring_conf(char *start, zend_str_size_int len, char quote) +static char *substring_conf(char *start, int len, char quote) { char *result = emalloc(len + 1); char *resp = result; - zend_str_size_int i; + int i; for (i = 0; i < len && start[i] != quote; ++i) { if (start[i] == '\\' && (start[i + 1] == '\\' || (quote && start[i + 1] == quote))) { @@ -581,9 +577,9 @@ static char *php_ap_basename(const zend_encoding *encoding, char *path TSRMLS_DC * If partial is true, partial matches are allowed at the end of the buffer. * Returns NULL if not found, or a pointer to the start of the first match. */ -static void *php_ap_memstr(char *haystack, zend_str_size_int haystacklen, char *needle, zend_str_size_int needlen, int partial) +static void *php_ap_memstr(char *haystack, int haystacklen, char *needle, int needlen, int partial) { - zend_str_size_int len = haystacklen; + int len = haystacklen; char *ptr = haystack; /* iterate through first character matches */ @@ -605,9 +601,9 @@ static void *php_ap_memstr(char *haystack, zend_str_size_int haystacklen, char * } /* read until a boundary condition */ -static zend_str_size_int multipart_buffer_read(multipart_buffer *self, char *buf, zend_str_size_int bytes, int *end TSRMLS_DC) +static int multipart_buffer_read(multipart_buffer *self, char *buf, int bytes, int *end TSRMLS_DC) { - zend_str_size_int len, max; + int len, max; char *bound; /* fill buffer if needed */ @@ -651,10 +647,10 @@ static zend_str_size_int multipart_buffer_read(multipart_buffer *self, char *buf XXX: this is horrible memory-usage-wise, but we only expect to do this on small pieces of form data. */ -static char *multipart_buffer_read_body(multipart_buffer *self, zend_str_size_uint *len TSRMLS_DC) +static char *multipart_buffer_read_body(multipart_buffer *self, unsigned int *len TSRMLS_DC) { char buf[FILLUNIT], *out=NULL; - zend_str_size_int total_bytes=0, read_bytes=0; + int total_bytes=0, read_bytes=0; while((read_bytes = multipart_buffer_read(self, buf, sizeof(buf), NULL TSRMLS_CC))) { out = erealloc(out, total_bytes + read_bytes + 1); @@ -680,10 +676,8 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ { char *boundary, *s = NULL, *boundary_end = NULL, *start_arr = NULL, *array_index = NULL; char *temp_filename = NULL, *lbuf = NULL, *abuf = NULL; - zend_str_size_int boundary_len = 0, array_len = 0; - int cancel_upload = 0, is_arr_upload = 0; - int64_t total_bytes = 0, max_file_size = 0; - int skip_upload = 0, anonindex = 0, is_anonymous; + int boundary_len = 0, total_bytes = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0; + int max_file_size = 0, skip_upload = 0, anonindex = 0, is_anonymous; zval *http_post_files = NULL; HashTable *uploaded_files = NULL; multipart_buffer *mbuff; @@ -717,7 +711,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ /* Get the boundary */ boundary = strstr(content_type_dup, "boundary"); if (!boundary) { - zend_str_size_int content_type_len = strlen(content_type_dup); + int content_type_len = strlen(content_type_dup); char *content_type_lcase = estrndup(content_type_dup, content_type_len); php_strtolower(content_type_lcase, content_type_len); @@ -849,9 +843,9 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ /* Normal form variable, safe to read all data into memory */ if (!filename && param) { - zend_str_size_uint value_len; + unsigned int value_len; char *value = multipart_buffer_read_body(mbuff, &value_len TSRMLS_CC); - zend_str_size_uint new_val_len; /* Dummy variable */ + unsigned int new_val_len; /* Dummy variable */ if (!value) { value = estrdup(""); @@ -904,7 +898,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ } if (!strcasecmp(param, "MAX_FILE_SIZE")) { - max_file_size = atoll(value); + max_file_size = atol(value); } efree(param); diff --git a/main/snprintf.c b/main/snprintf.c index 26f66ca52d18e..4514bd6821fb8 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -312,7 +312,7 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c */ /* char * ap_php_conv_10() {{{ */ char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, - register bool_int * is_negative, char *buf_end, register zend_str_size_int *len) + register bool_int * is_negative, char *buf_end, register int *len) { register char *p = buf_end; register u_wide_int magnitude; @@ -370,7 +370,7 @@ char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, */ /* PHPAPI char * php_conv_fp() {{{ */ PHPAPI char * php_conv_fp(register char format, register double num, - boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, zend_str_size_int *len) + boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, int *len) { register char *s = buf; register char *p, *p_orig; @@ -438,7 +438,7 @@ PHPAPI char * php_conv_fp(register char format, register double num, if (format != 'F') { char temp[EXPONENT_LENGTH]; /* for exponent conversion */ - zend_str_size_int t_len; + int t_len; bool_int exponent_is_negative; *s++ = format; /* either e or E */ @@ -474,7 +474,7 @@ PHPAPI char * php_conv_fp(register char format, register double num, * which is a pointer to the END of the buffer + 1 (i.e. if the buffer * is declared as buf[ 100 ], buf_end should be &buf[ 100 ]) */ -char * ap_php_conv_p2(register u_wide_int num, register int nbits, char format, char *buf_end, register zend_str_size_int *len) /* {{{ */ +char * ap_php_conv_p2(register u_wide_int num, register int nbits, char format, char *buf_end, register int *len) /* {{{ */ { register int mask = (1 << nbits) - 1; register char *p = buf_end; @@ -584,11 +584,10 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / char *sp; char *bep; int cc = 0; - zend_str_size_int i; + int i; char *s = NULL; - zend_str_size_int s_len; - int free_zcopy; + int s_len, free_zcopy; zval *zvp, zcopy; int min_width = 0; @@ -788,7 +787,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / if (free_zcopy) { zvp = &zcopy; } - s_len = Z_STRSIZE_P(zvp); + s_len = Z_STRLEN_P(zvp); s = Z_STRVAL_P(zvp); if (adjust_precision && precision < s_len) { s_len = precision; diff --git a/main/snprintf.h b/main/snprintf.h index 88dbdf8a9d6c7..de03542cad225 100644 --- a/main/snprintf.h +++ b/main/snprintf.h @@ -27,7 +27,7 @@ sprintf offers the ability to make a lot of failures since it does not know the size of the buffer it uses. Therefore usage of sprintf often results in possible entries for buffer overrun attacks. So please use this version only if you are sure the call is safe. sprintf - always terminstes the buffer it writes to. + allways terminstes the buffer it writes to. snprintf knows the buffers size and will not write behind it. But you will have to use either a static buffer or allocate a dynamic buffer @@ -48,7 +48,7 @@ spprintf is the dynamical version of snprintf. It allocates the buffer in size snprintf and offers possible memory leakes if you miss freeing the buffer allocated by the function. Therfore this function should be used where either no maximum is known or the maximum is much bigger - than normal size required. spprintf always terminates the buffer. + than normal size required. spprintf allways terminates the buffer. Example: @@ -60,7 +60,7 @@ spprintf is the dynamical version of snprintf. It allocates the buffer in size sprintf(buffer, "test"); | snprintf(buffer, MAX, "test"); | spprintf(&buffer, MAX, "text"); | | if (!buffer) | | return OUT_OF_MEMORY - // sprintf always terminates | // manual termination of | // spprintf allays terminates buffer + // sprintf allways terminates | // manual termination of | // spprintf allays terminates buffer // buffer | // buffer *IS* required | | buffer[MAX-1] = 0; | action_with_buffer(buffer); | action_with_buffer(buffer); | action_with_buffer(buffer); @@ -87,7 +87,7 @@ PHPAPI int ap_php_asprintf(char **buf, const char *format, ...); PHPAPI int php_sprintf (char* s, const char* format, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3); PHPAPI char * php_gcvt(double value, int ndigit, char dec_point, char exponent, char *buf); PHPAPI char * php_conv_fp(register char format, register double num, - boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, zend_str_size_int *len); + boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, int *len); END_EXTERN_C() @@ -153,10 +153,10 @@ typedef WIDE_INT wide_int; typedef unsigned WIDE_INT u_wide_int; extern char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, - register bool_int * is_negative, char *buf_end, register zend_str_size_int *len); + register bool_int * is_negative, char *buf_end, register int *len); extern char * ap_php_conv_p2(register u_wide_int num, register int nbits, - char format, char *buf_end, register zend_str_size_int *len); + char format, char *buf_end, register int *len); /* The maximum precision that's allowed for float conversion. Does not include * decimal separator, exponent, sign, terminator. Currently does not affect diff --git a/main/spprintf.c b/main/spprintf.c index db77cc82d765f..596e1ef456b6c 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -198,8 +198,7 @@ static size_t strnlen(const char *s, size_t maxlen) { static void xbuf_format_converter(smart_str *xbuf, const char *fmt, va_list ap) /* {{{ */ { char *s = NULL; - zend_str_size_int s_len; - int free_zcopy; + int s_len, free_zcopy; zval *zvp, zcopy; int min_width = 0; @@ -396,7 +395,7 @@ static void xbuf_format_converter(smart_str *xbuf, const char *fmt, va_list ap) if (free_zcopy) { zvp = &zcopy; } - s_len = Z_STRSIZE_P(zvp); + s_len = Z_STRLEN_P(zvp); s = Z_STRVAL_P(zvp); if (adjust_precision && precision < s_len) { s_len = precision; @@ -793,7 +792,7 @@ static void xbuf_format_converter(smart_str *xbuf, const char *fmt, va_list ap) /* * This is the general purpose conversion function. */ -PHPAPI zend_str_size_int vspprintf(char **pbuf, zend_str_size_size_t max_len, const char *format, va_list ap) /* {{{ */ +PHPAPI int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) /* {{{ */ { smart_str xbuf = {0}; @@ -810,9 +809,9 @@ PHPAPI zend_str_size_int vspprintf(char **pbuf, zend_str_size_size_t max_len, co } /* }}} */ -PHPAPI zend_str_size_int spprintf(char **pbuf, size_t max_len, const char *format, ...) /* {{{ */ +PHPAPI int spprintf(char **pbuf, size_t max_len, const char *format, ...) /* {{{ */ { - zend_str_size_int cc; + int cc; va_list ap; va_start(ap, format); diff --git a/main/spprintf.h b/main/spprintf.h index 1b151d569dd7c..397928a794501 100644 --- a/main/spprintf.h +++ b/main/spprintf.h @@ -22,7 +22,7 @@ The pbuf parameter of all spprintf version receives a pointer to the allocated buffer. This buffer must be freed manually after usage using efree() function. -The buffer will always be terminated by a zero character. When pbuf is NULL +The buffer will allways be terminated by a zero character. When pbuf is NULL the function can be used to calculate the required size of the buffer but for that purpose snprintf is faster. When both pbuf and the return value are 0 than you are out of memory. @@ -37,9 +37,9 @@ There is also snprintf: See difference explained in snprintf.h #include "snprintf.h" BEGIN_EXTERN_C() -PHPAPI zend_str_size_int spprintf( char **pbuf, size_t max_len, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4); +PHPAPI int spprintf( char **pbuf, size_t max_len, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4); -PHPAPI zend_str_size_int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) PHP_ATTRIBUTE_FORMAT(printf, 3, 0); +PHPAPI int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) PHP_ATTRIBUTE_FORMAT(printf, 3, 0); END_EXTERN_C() #endif /* SNPRINTF_H */ diff --git a/main/streams/cast.c b/main/streams/cast.c index bf96d3cf806c7..da6a293e4521e 100644 --- a/main/streams/cast.c +++ b/main/streams/cast.c @@ -33,7 +33,7 @@ #if defined(HAVE_FUNOPEN) && !defined(HAVE_FOPENCOOKIE) /* NetBSD 6.0+ uses off_t instead of fpos_t in funopen */ -# if defined(__NetBSD__) && (__NetBSD_Version__ >= 600000000) +# if defined(__NetBSD__) && (__NetBSD_Version__ > 600000000) # define PHP_FPOS_T off_t # else # define PHP_FPOS_T fpos_t diff --git a/main/streams/filter.c b/main/streams/filter.c index 6f3351a3db2e8..6de3a928fe3da 100644 --- a/main/streams/filter.c +++ b/main/streams/filter.c @@ -254,7 +254,7 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval HashTable *filter_hash = (FG(stream_filters) ? FG(stream_filters) : &stream_filters_hash); php_stream_filter_factory *factory = NULL; php_stream_filter *filter = NULL; - zend_str_size_int n; + int n; char *period; n = strlen(filtername); diff --git a/main/streams/glob_wrapper.c b/main/streams/glob_wrapper.c index a9e1bb29f9e9c..9c051a59210ab 100644 --- a/main/streams/glob_wrapper.c +++ b/main/streams/glob_wrapper.c @@ -47,7 +47,7 @@ typedef struct { size_t pattern_len; } glob_s_t; -PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, zend_str_size_int *plen STREAMS_DC TSRMLS_DC) /* {{{ */ +PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC) /* {{{ */ { glob_s_t *pglob = (glob_s_t *)stream->abstract; @@ -69,7 +69,7 @@ PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, zend_str_si } /* }}} */ -PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, zend_str_size_int *plen STREAMS_DC TSRMLS_DC) /* {{{ */ +PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC) /* {{{ */ { glob_s_t *pglob = (glob_s_t *)stream->abstract; @@ -109,9 +109,9 @@ PHPAPI int _php_glob_stream_get_count(php_stream *stream, int *pflags STREAMS_DC } /* }}} */ -static void php_glob_stream_path_split(glob_s_t *pglob, const char *path, int get_path, const char **p_file TSRMLS_DC) /* {{{ */ +static void php_glob_stream_path_split(glob_s_t *pglob, char *path, int get_path, char **p_file TSRMLS_DC) /* {{{ */ { - const char *pos, *gpath = path; + char *pos, *gpath = path; if ((pos = strrchr(path, '/')) != NULL) { path = pos+1; @@ -141,7 +141,7 @@ static size_t php_glob_stream_read(php_stream *stream, char *buf, size_t count T { glob_s_t *pglob = (glob_s_t *)stream->abstract; php_stream_dirent *ent = (php_stream_dirent*)buf; - const char *path; + char *path; /* avoid problems if someone mis-uses the stream */ if (count == sizeof(php_stream_dirent) && pglob) { @@ -206,12 +206,12 @@ php_stream_ops php_glob_stream_ops = { }; /* {{{ php_glob_stream_opener */ -static php_stream *php_glob_stream_opener(php_stream_wrapper *wrapper, const char *path, const char *mode, +static php_stream *php_glob_stream_opener(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { glob_s_t *pglob; int ret; - const char *tmp, *pos; + char *tmp, *pos; if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path TSRMLS_CC)) { return NULL; diff --git a/main/streams/memory.c b/main/streams/memory.c index ac6e1ee3dbc7b..328d3be399018 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -598,9 +598,7 @@ PHPAPI php_stream_ops php_stream_rfc2397_ops = { php_stream_temp_set_option }; -static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, const char *path, - const char *mode, int options, char **opened_path, - php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ +static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ { php_stream *stream; php_stream_temp_data *ts; @@ -608,8 +606,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con size_t mlen, dlen, plen, vlen; off_t newoffs; zval *meta = NULL; - int base64 = 0; - zend_str_size_int ilen; + int base64 = 0, ilen; if (memcmp(path, "data:", 5)) { return NULL; @@ -643,11 +640,11 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con MAKE_STD_ZVAL(meta); array_init(meta); if (!semi) { /* there is only a mime type */ - add_assoc_stringl(meta, "mediatype", (char *) path, mlen, 1); + add_assoc_stringl(meta, "mediatype", path, mlen, 1); mlen = 0; } else if (sep && sep < semi) { /* there is a mime type */ plen = semi - path; - add_assoc_stringl(meta, "mediatype", (char *) path, plen, 1); + add_assoc_stringl(meta, "mediatype", path, plen, 1); mlen -= plen; path += plen; } else if (semi != path || mlen != sizeof(";base64")-1 || memcmp(path, ";base64", sizeof(";base64")-1)) { /* must be error since parameters are only allowed after mediatype */ diff --git a/main/streams/php_stream_glob_wrapper.h b/main/streams/php_stream_glob_wrapper.h index 3fe8965e746b9..330e917bda4ef 100644 --- a/main/streams/php_stream_glob_wrapper.h +++ b/main/streams/php_stream_glob_wrapper.h @@ -23,10 +23,10 @@ PHPAPI extern php_stream_ops php_glob_stream_ops; BEGIN_EXTERN_C() -PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, zend_str_size_int *plen STREAMS_DC TSRMLS_DC); +PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC); #define php_glob_stream_get_path(stream, copy, plen) _php_glob_stream_get_path((stream), (copy), (plen) STREAMS_CC TSRMLS_CC) -PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, zend_str_size_int *plen STREAMS_DC TSRMLS_DC); +PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, int *plen STREAMS_DC TSRMLS_DC); #define php_glob_stream_get_pattern(stream, copy, plen) _php_glob_stream_get_pattern((stream), (copy), (plen) STREAMS_CC TSRMLS_CC) PHPAPI int _php_glob_stream_get_count(php_stream *stream, int *pflags STREAMS_DC TSRMLS_DC); diff --git a/main/streams/php_stream_plain_wrapper.h b/main/streams/php_stream_plain_wrapper.h index 6700df0b29a03..d88b30c4791cf 100644 --- a/main/streams/php_stream_plain_wrapper.h +++ b/main/streams/php_stream_plain_wrapper.h @@ -30,7 +30,7 @@ BEGIN_EXTERN_C() PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, char **opened_path, int options STREAMS_DC TSRMLS_DC); #define php_stream_fopen(filename, mode, opened) _php_stream_fopen((filename), (mode), (opened), 0 STREAMS_CC TSRMLS_CC) -PHPAPI php_stream *_php_stream_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path, int options STREAMS_DC TSRMLS_DC); +PHPAPI php_stream *_php_stream_fopen_with_path(char *filename, char *mode, char *path, char **opened_path, int options STREAMS_DC TSRMLS_DC); #define php_stream_fopen_with_path(filename, mode, path, opened) _php_stream_fopen_with_path((filename), (mode), (path), (opened), 0 STREAMS_CC TSRMLS_CC) PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STREAMS_DC TSRMLS_DC); diff --git a/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h index 93f60165e793c..c2d911032ef8a 100644 --- a/main/streams/php_stream_transport.h +++ b/main/streams/php_stream_transport.h @@ -26,16 +26,16 @@ # include #endif -typedef php_stream *(php_stream_transport_factory_func)(const char *proto, size_t protolen, - const char *resourcename, size_t resourcenamelen, +typedef php_stream *(php_stream_transport_factory_func)(const char *proto, long protolen, + char *resourcename, long resourcenamelen, const char *persistent_id, int options, int flags, struct timeval *timeout, php_stream_context *context STREAMS_DC TSRMLS_DC); typedef php_stream_transport_factory_func *php_stream_transport_factory; BEGIN_EXTERN_C() -PHPAPI int php_stream_xport_register(const char *protocol, php_stream_transport_factory factory TSRMLS_DC); -PHPAPI int php_stream_xport_unregister(const char *protocol TSRMLS_DC); +PHPAPI int php_stream_xport_register(char *protocol, php_stream_transport_factory factory TSRMLS_DC); +PHPAPI int php_stream_xport_unregister(char *protocol TSRMLS_DC); #define STREAM_XPORT_CLIENT 0 #define STREAM_XPORT_SERVER 1 @@ -46,7 +46,7 @@ PHPAPI int php_stream_xport_unregister(const char *protocol TSRMLS_DC); #define STREAM_XPORT_CONNECT_ASYNC 16 /* Open a client or server socket connection */ -PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, int options, +PHPAPI php_stream *_php_stream_xport_create(const char *name, long namelen, int options, int flags, const char *persistent_id, struct timeval *timeout, php_stream_context *context, @@ -59,13 +59,13 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in /* Bind the stream to a local address */ PHPAPI int php_stream_xport_bind(php_stream *stream, - const char *name, size_t namelen, + const char *name, long namelen, char **error_text TSRMLS_DC); /* Connect to a remote address */ PHPAPI int php_stream_xport_connect(php_stream *stream, - const char *name, size_t namelen, + const char *name, long namelen, int asynchronous, struct timeval *timeout, char **error_text, @@ -81,7 +81,7 @@ PHPAPI int php_stream_xport_listen(php_stream *stream, /* Get the next client and their address as a string, or the underlying address * structure. You must efree either of these if you request them */ PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client, - char **textaddr, zend_str_size_int *textaddrlen, + char **textaddr, int *textaddrlen, void **addr, socklen_t *addrlen, struct timeval *timeout, char **error_text @@ -89,7 +89,7 @@ PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client, /* Get the name of either the socket or it's peer */ PHPAPI int php_stream_xport_get_name(php_stream *stream, int want_peer, - char **textaddr, zend_str_size_int *textaddrlen, + char **textaddr, int *textaddrlen, void **addr, socklen_t *addrlen TSRMLS_DC); @@ -100,13 +100,13 @@ enum php_stream_xport_send_recv_flags { /* Similar to recv() system call; read data from the stream, optionally * peeking, optionally retrieving OOB data */ -PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, zend_str_size_size_t buflen, +PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t buflen, long flags, void **addr, socklen_t *addrlen, - char **textaddr, zend_str_size_int *textaddrlen TSRMLS_DC); + char **textaddr, int *textaddrlen TSRMLS_DC); /* Similar to send() system call; send data to the stream, optionally * sending it as OOB data */ -PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, zend_str_size_size_t buflen, +PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, size_t buflen, long flags, void *addr, socklen_t addrlen TSRMLS_DC); typedef enum { @@ -141,13 +141,13 @@ typedef struct _php_stream_xport_param { struct { char *name; - size_t namelen; + long namelen; int backlog; struct timeval *timeout; struct sockaddr *addr; socklen_t addrlen; char *buf; - zend_str_size_size_t buflen; + size_t buflen; long flags; } inputs; struct { @@ -156,7 +156,7 @@ typedef struct _php_stream_xport_param { struct sockaddr *addr; socklen_t addrlen; char *textaddr; - zend_str_size_long textaddrlen; + long textaddrlen; char *error_text; int error_code; diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 63d1772763c4c..39df31a170503 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -53,12 +53,6 @@ extern int php_get_uid_by_name(const char *name, uid_t *uid TSRMLS_DC); extern int php_get_gid_by_name(const char *name, gid_t *gid TSRMLS_DC); #endif -#if defined(PHP_WIN32) -# define PLAIN_WRAP_BUF_SIZE(st) (((st) > UINT_MAX) ? UINT_MAX : (unsigned int)(st)) -#else -# define PLAIN_WRAP_BUF_SIZE(st) (st) -#endif - /* parse standard "fopen" modes into open() flags */ PHPAPI int php_stream_parse_fopen_modes(const char *mode, int *open_flags) { @@ -328,7 +322,7 @@ static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count assert(data != NULL); if (data->fd >= 0) { - ssize_t bytes_written = write(data->fd, buf, PLAIN_WRAP_BUF_SIZE(count)); + int bytes_written = write(data->fd, buf, count); if (bytes_written < 0) return 0; return (size_t) bytes_written; } else { @@ -352,13 +346,13 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count TSRMLS assert(data != NULL); if (data->fd >= 0) { - ret = read(data->fd, buf, PLAIN_WRAP_BUF_SIZE(count)); + ret = read(data->fd, buf, count); if (ret == (size_t)-1 && errno == EINTR) { /* Read was interrupted, retry once, If read still fails, giveup with feof==0 so script can retry if desired */ - ret = read(data->fd, buf, PLAIN_WRAP_BUF_SIZE(count)); + ret = read(data->fd, buf, count); } stream->eof = (ret == 0 || (ret == (size_t)-1 && errno != EWOULDBLOCK && errno != EINTR && errno != EBADF)); @@ -857,7 +851,7 @@ static php_stream_ops php_plain_files_dirstream_ops = { NULL /* set_option */ }; -static php_stream *php_plain_files_dir_opener(php_stream_wrapper *wrapper, const char *path, const char *mode, +static php_stream *php_plain_files_dir_opener(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { DIR *dir = NULL; @@ -995,7 +989,7 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, cha /* }}} */ -static php_stream *php_plain_files_stream_opener(php_stream_wrapper *wrapper, const char *path, const char *mode, +static php_stream *php_plain_files_stream_opener(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path TSRMLS_CC)) { @@ -1005,7 +999,7 @@ static php_stream *php_plain_files_stream_opener(php_stream_wrapper *wrapper, co return php_stream_fopen_rel(path, mode, opened_path, options); } -static int php_plain_files_url_stater(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) +static int php_plain_files_url_stater(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) { char *p; @@ -1035,7 +1029,7 @@ static int php_plain_files_url_stater(php_stream_wrapper *wrapper, const char *u return VCWD_STAT(url, &ssb->sb); } -static int php_plain_files_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) +static int php_plain_files_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) { char *p; int ret; @@ -1064,7 +1058,7 @@ static int php_plain_files_unlink(php_stream_wrapper *wrapper, const char *url, return 1; } -static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC) +static int php_plain_files_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC) { char *p; int ret; @@ -1153,7 +1147,7 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f return 1; } -static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, int mode, int options, php_stream_context *context TSRMLS_DC) +static int php_plain_files_mkdir(php_stream_wrapper *wrapper, char *dir, int mode, int options, php_stream_context *context TSRMLS_DC) { int ret, recursive = options & PHP_STREAM_MKDIR_RECURSIVE; char *p; @@ -1170,7 +1164,7 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i /* we look for directory separator from the end of string, thus hopefuly reducing our work load */ char *e; struct stat sb; - zend_str_size_int dir_len = strlen(dir); + int dir_len = strlen(dir); int offset = 0; char buf[MAXPATHLEN]; @@ -1241,10 +1235,10 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i } } -static int php_plain_files_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) +static int php_plain_files_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) { #if PHP_WIN32 - zend_str_size_int url_len = strlen(url); + int url_len = strlen(url); #endif if (php_check_open_basedir(url TSRMLS_CC)) { return 0; @@ -1268,7 +1262,7 @@ static int php_plain_files_rmdir(php_stream_wrapper *wrapper, const char *url, i return 1; } -static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url, int option, void *value, php_stream_context *context TSRMLS_DC) +static int php_plain_files_metadata(php_stream_wrapper *wrapper, char *url, int option, void *value, php_stream_context *context TSRMLS_DC) { struct utimbuf *newtime; char *p; @@ -1279,7 +1273,7 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url mode_t mode; int ret = 0; #if PHP_WIN32 - zend_str_size_int url_len = strlen(url); + int url_len = strlen(url); #endif #if PHP_WIN32 @@ -1377,17 +1371,16 @@ php_stream_wrapper php_plain_files_wrapper = { }; /* {{{ php_stream_fopen_with_path */ -PHPAPI php_stream *_php_stream_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path, int options STREAMS_DC TSRMLS_DC) +PHPAPI php_stream *_php_stream_fopen_with_path(char *filename, char *mode, char *path, char **opened_path, int options STREAMS_DC TSRMLS_DC) { /* code ripped off from fopen_wrappers.c */ - char *pathbuf, *end; - const char *ptr; + char *pathbuf, *ptr, *end; const char *exec_fname; char trypath[MAXPATHLEN]; php_stream *stream; - zend_str_size_int path_length; - zend_str_size_int filename_length; - zend_str_size_int exec_fname_length; + int path_length; + int filename_length; + int exec_fname_length; if (opened_path) { *opened_path = NULL; diff --git a/main/streams/streams.c b/main/streams/streams.c index bd72287ed62ae..623aabff60488 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -803,9 +803,9 @@ PHPAPI int _php_stream_getc(php_stream *stream TSRMLS_DC) return EOF; } -PHPAPI int _php_stream_puts(php_stream *stream, const char *buf TSRMLS_DC) +PHPAPI int _php_stream_puts(php_stream *stream, char *buf TSRMLS_DC) { - zend_str_size_int len; + int len; char newline[2] = "\n"; /* is this OK for Win? */ len = strlen(buf); @@ -835,11 +835,11 @@ PHPAPI int _php_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D return (stream->ops->stat)(stream, ssb TSRMLS_CC); } -PHPAPI const char *php_stream_locate_eol(php_stream *stream, const char *buf, size_t buf_len TSRMLS_DC) +PHPAPI char *php_stream_locate_eol(php_stream *stream, char *buf, size_t buf_len TSRMLS_DC) { size_t avail; - const char *cr, *lf, *eol = NULL; - const char *readptr; + char *cr, *lf, *eol = NULL; + char *readptr; if (!buf) { readptr = stream->readbuf + stream->readpos; @@ -911,7 +911,7 @@ PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen, if (avail > 0) { size_t cpysz = 0; char *readptr; - const char *eol; + char *eol; int done = 0; readptr = stream->readbuf + stream->readpos; @@ -994,11 +994,11 @@ PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen, #define STREAM_BUFFERED_AMOUNT(stream) \ ((size_t)(((stream)->writepos) - (stream)->readpos)) -static const char *_php_stream_search_delim(php_stream *stream, - size_t maxlen, - size_t skiplen, - const char *delim, /* non-empty! */ - size_t delim_len TSRMLS_DC) +static char *_php_stream_search_delim(php_stream *stream, + size_t maxlen, + size_t skiplen, + char *delim, /* non-empty! */ + size_t delim_len TSRMLS_DC) { size_t seek_len; @@ -1018,10 +1018,10 @@ static const char *_php_stream_search_delim(php_stream *stream, } } -PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *returned_len, const char *delim, size_t delim_len TSRMLS_DC) +PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *returned_len, char *delim, size_t delim_len TSRMLS_DC) { - char *ret_buf; /* returned buffer */ - const char *found_delim = NULL; + char *ret_buf, /* returned buffer */ + *found_delim = NULL; size_t buffered_len, tent_ret_len; /* tentative returned length */ int has_delim = delim_len > 0; @@ -1387,7 +1387,7 @@ PHPAPI size_t _php_stream_passthru(php_stream * stream STREAMS_DC TSRMLS_DC) { size_t bcount = 0; char buf[8192]; - zend_str_size_int b; + int b; if (php_stream_mmap_possible(stream)) { char *p; @@ -1676,9 +1676,9 @@ int php_shutdown_stream_wrappers(int module_number TSRMLS_DC) /* Validate protocol scheme names during registration * Must conform to /^[a-zA-Z0-9+.-]+$/ */ -static inline int php_stream_wrapper_scheme_validate(const char *protocol, zend_str_size_uint protocol_len) +static inline int php_stream_wrapper_scheme_validate(char *protocol, int protocol_len) { - zend_str_size_uint i; + int i; for(i = 0; i < protocol_len; i++) { if (!isalnum((int)protocol[i]) && @@ -1693,9 +1693,9 @@ static inline int php_stream_wrapper_scheme_validate(const char *protocol, zend_ } /* API for registering GLOBAL wrappers */ -PHPAPI int php_register_url_stream_wrapper(const char *protocol, php_stream_wrapper *wrapper TSRMLS_DC) +PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC) { - zend_str_size_uint protocol_len = strlen(protocol); + int protocol_len = strlen(protocol); if (php_stream_wrapper_scheme_validate(protocol, protocol_len) == FAILURE) { return FAILURE; @@ -1704,7 +1704,7 @@ PHPAPI int php_register_url_stream_wrapper(const char *protocol, php_stream_wrap return zend_hash_add(&url_stream_wrappers_hash, protocol, protocol_len + 1, &wrapper, sizeof(wrapper), NULL); } -PHPAPI int php_unregister_url_stream_wrapper(const char *protocol TSRMLS_DC) +PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC) { return zend_hash_del(&url_stream_wrappers_hash, protocol, strlen(protocol) + 1); } @@ -1719,9 +1719,9 @@ static void clone_wrapper_hash(TSRMLS_D) } /* API for registering VOLATILE wrappers */ -PHPAPI int php_register_url_stream_wrapper_volatile(const char *protocol, php_stream_wrapper *wrapper TSRMLS_DC) +PHPAPI int php_register_url_stream_wrapper_volatile(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC) { - zend_str_size_uint protocol_len = strlen(protocol); + int protocol_len = strlen(protocol); if (php_stream_wrapper_scheme_validate(protocol, protocol_len) == FAILURE) { return FAILURE; @@ -1734,7 +1734,7 @@ PHPAPI int php_register_url_stream_wrapper_volatile(const char *protocol, php_st return zend_hash_add(FG(stream_wrappers), protocol, protocol_len + 1, &wrapper, sizeof(wrapper), NULL); } -PHPAPI int php_unregister_url_stream_wrapper_volatile(const char *protocol TSRMLS_DC) +PHPAPI int php_unregister_url_stream_wrapper_volatile(char *protocol TSRMLS_DC) { if (!FG(stream_wrappers)) { clone_wrapper_hash(TSRMLS_C); @@ -1745,7 +1745,7 @@ PHPAPI int php_unregister_url_stream_wrapper_volatile(const char *protocol TSRML /* }}} */ /* {{{ php_stream_locate_url_wrapper */ -PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const char **path_for_open, int options TSRMLS_DC) +PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char **path_for_open, int options TSRMLS_DC) { HashTable *wrapper_hash = (FG(stream_wrappers) ? FG(stream_wrappers) : &url_stream_wrappers_hash); php_stream_wrapper **wrapperpp = NULL; @@ -1880,7 +1880,7 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const /* {{{ _php_stream_mkdir */ -PHPAPI int _php_stream_mkdir(const char *path, int mode, int options, php_stream_context *context TSRMLS_DC) +PHPAPI int _php_stream_mkdir(char *path, int mode, int options, php_stream_context *context TSRMLS_DC) { php_stream_wrapper *wrapper = NULL; @@ -1895,7 +1895,7 @@ PHPAPI int _php_stream_mkdir(const char *path, int mode, int options, php_stream /* {{{ _php_stream_rmdir */ -PHPAPI int _php_stream_rmdir(const char *path, int options, php_stream_context *context TSRMLS_DC) +PHPAPI int _php_stream_rmdir(char *path, int options, php_stream_context *context TSRMLS_DC) { php_stream_wrapper *wrapper = NULL; @@ -1909,10 +1909,10 @@ PHPAPI int _php_stream_rmdir(const char *path, int options, php_stream_context * /* }}} */ /* {{{ _php_stream_stat_path */ -PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) +PHPAPI int _php_stream_stat_path(char *path, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) { php_stream_wrapper *wrapper = NULL; - const char *path_to_open = path; + char *path_to_open = path; int ret; /* Try to hit the cache first */ @@ -1954,12 +1954,12 @@ PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf /* }}} */ /* {{{ php_stream_opendir */ -PHPAPI php_stream *_php_stream_opendir(const char *path, int options, +PHPAPI php_stream *_php_stream_opendir(char *path, int options, php_stream_context *context STREAMS_DC TSRMLS_DC) { php_stream *stream = NULL; php_stream_wrapper *wrapper = NULL; - const char *path_to_open; + char *path_to_open; if (!path || !*path) { return NULL; @@ -2003,12 +2003,12 @@ PHPAPI php_stream_dirent *_php_stream_readdir(php_stream *dirstream, php_stream_ /* }}} */ /* {{{ php_stream_open_wrapper_ex */ -PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mode, int options, +PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { php_stream *stream = NULL; php_stream_wrapper *wrapper = NULL; - const char *path_to_open; + char *path_to_open; int persistent = options & STREAM_OPEN_PERSISTENT; char *resolved_path = NULL; char *copy_of_path = NULL; @@ -2264,7 +2264,7 @@ PHPAPI int php_stream_dirent_alphasortr(const char **a, const char **b) /* {{{ php_stream_scandir */ -PHPAPI int _php_stream_scandir(const char *dirname, char **namelist[], int flags, php_stream_context *context, +PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_stream_context *context, int (*compare) (const char **a, const char **b) TSRMLS_DC) { php_stream *stream; @@ -2289,7 +2289,6 @@ PHPAPI int _php_stream_scandir(const char *dirname, char **namelist[], int flags } else { if(vector_size*2 < vector_size) { /* overflow */ - php_stream_closedir(stream); efree(vector); return FAILURE; } @@ -2303,7 +2302,6 @@ PHPAPI int _php_stream_scandir(const char *dirname, char **namelist[], int flags nfiles++; if(vector_size < 10 || nfiles == 0) { /* overflow */ - php_stream_closedir(stream); efree(vector); return FAILURE; } @@ -2312,7 +2310,7 @@ PHPAPI int _php_stream_scandir(const char *dirname, char **namelist[], int flags *namelist = vector; - if (nfiles > 0 && compare) { + if (compare) { qsort(*namelist, nfiles, sizeof(char *), (int(*)(const void *, const void *))compare); } return nfiles; diff --git a/main/streams/transports.c b/main/streams/transports.c index 05c28d3f8b36e..c24bf97ce6e9e 100644 --- a/main/streams/transports.c +++ b/main/streams/transports.c @@ -29,12 +29,12 @@ PHPAPI HashTable *php_stream_xport_get_hash(void) return &xport_hash; } -PHPAPI int php_stream_xport_register(const char *protocol, php_stream_transport_factory factory TSRMLS_DC) +PHPAPI int php_stream_xport_register(char *protocol, php_stream_transport_factory factory TSRMLS_DC) { return zend_hash_update(&xport_hash, protocol, strlen(protocol) + 1, &factory, sizeof(factory), NULL); } -PHPAPI int php_stream_xport_unregister(const char *protocol TSRMLS_DC) +PHPAPI int php_stream_xport_unregister(char *protocol TSRMLS_DC) { return zend_hash_del(&xport_hash, protocol, strlen(protocol) + 1); } @@ -49,7 +49,7 @@ PHPAPI int php_stream_xport_unregister(const char *protocol TSRMLS_DC) if (local_err) { efree(local_err); local_err = NULL; } \ } -PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, int options, +PHPAPI php_stream *_php_stream_xport_create(const char *name, long namelen, int options, int flags, const char *persistent_id, struct timeval *timeout, php_stream_context *context, @@ -194,7 +194,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in /* Bind the stream to a local address */ PHPAPI int php_stream_xport_bind(php_stream *stream, - const char *name, size_t namelen, + const char *name, long namelen, char **error_text TSRMLS_DC) { @@ -222,7 +222,7 @@ PHPAPI int php_stream_xport_bind(php_stream *stream, /* Connect to a remote address */ PHPAPI int php_stream_xport_connect(php_stream *stream, - const char *name, size_t namelen, + const char *name, long namelen, int asynchronous, struct timeval *timeout, char **error_text, @@ -282,7 +282,7 @@ PHPAPI int php_stream_xport_listen(php_stream *stream, int backlog, char **error /* Get the next client and their address (as a string) */ PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client, - char **textaddr, zend_str_size_int *textaddrlen, + char **textaddr, int *textaddrlen, void **addr, socklen_t *addrlen, struct timeval *timeout, char **error_text @@ -321,7 +321,7 @@ PHPAPI int php_stream_xport_accept(php_stream *stream, php_stream **client, } PHPAPI int php_stream_xport_get_name(php_stream *stream, int want_peer, - char **textaddr, zend_str_size_int *textaddrlen, + char **textaddr, int *textaddrlen, void **addr, socklen_t *addrlen TSRMLS_DC) { @@ -394,13 +394,13 @@ PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate TSRML /* Similar to recv() system call; read data from the stream, optionally * peeking, optionally retrieving OOB data */ -PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, zend_str_size_size_t buflen, - long flags, void **addr, socklen_t *addrlen, char **textaddr, zend_str_size_int *textaddrlen +PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t buflen, + long flags, void **addr, socklen_t *addrlen, char **textaddr, int *textaddrlen TSRMLS_DC) { php_stream_xport_param param; int ret = 0; - zend_str_size recvd_len = 0; + int recvd_len = 0; #if 0 int oob; @@ -464,7 +464,7 @@ PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, zend_str_siz /* Similar to send() system call; send data to the stream, optionally * sending it as OOB data */ -PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, zend_str_size_size_t buflen, +PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, size_t buflen, long flags, void *addr, socklen_t addrlen TSRMLS_DC) { php_stream_xport_param param; diff --git a/main/streams/userspace.c b/main/streams/userspace.c index 5b773926e0194..69edbaafa91d4 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -45,14 +45,14 @@ struct php_user_stream_wrapper { php_stream_wrapper wrapper; }; -static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); -static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); -static int user_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC); -static int user_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC); -static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int mode, int options, php_stream_context *context TSRMLS_DC); -static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC); -static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, int option, void *value, php_stream_context *context TSRMLS_DC); -static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char *filename, const char *mode, +static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filename, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); +static int user_wrapper_stat_url(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); +static int user_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); +static int user_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC); +static int user_wrapper_mkdir(php_stream_wrapper *wrapper, char *url, int mode, int options, php_stream_context *context TSRMLS_DC); +static int user_wrapper_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); +static int user_wrapper_metadata(php_stream_wrapper *wrapper, char *url, int option, void *value, php_stream_context *context TSRMLS_DC); +static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, char *filename, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); static php_stream_wrapper_ops user_stream_wops = { @@ -332,8 +332,7 @@ static zval *user_stream_create_object(struct php_user_stream_wrapper *uwrap, ph return object; } -static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char *filename, const char *mode, - int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) +static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filename, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; php_userstream_data_t *us; @@ -407,7 +406,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char * /* if the opened path is set, copy it out */ if (Z_TYPE_P(zopened) == IS_STRING && opened_path) { - *opened_path = estrndup(Z_STRVAL_P(zopened), Z_STRSIZE_P(zopened)); + *opened_path = estrndup(Z_STRVAL_P(zopened), Z_STRLEN_P(zopened)); } /* set wrapper data to be a reference to our object */ @@ -438,7 +437,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char * return stream; } -static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char *filename, const char *mode, +static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, char *filename, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; @@ -519,12 +518,12 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char PHP_FUNCTION(stream_wrapper_register) { char *protocol, *classname; - zend_str_size protocol_len, classname_len; + int protocol_len, classname_len; struct php_user_stream_wrapper * uwrap; int rsrc_id; long flags = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|l", &protocol, &protocol_len, &classname, &classname_len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &protocol, &protocol_len, &classname, &classname_len, &flags) == FAILURE) { RETURN_FALSE; } @@ -564,9 +563,9 @@ PHP_FUNCTION(stream_wrapper_register) PHP_FUNCTION(stream_wrapper_unregister) { char *protocol; - zend_str_size protocol_len; + int protocol_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &protocol, &protocol_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &protocol, &protocol_len) == FAILURE) { RETURN_FALSE; } @@ -585,11 +584,11 @@ PHP_FUNCTION(stream_wrapper_unregister) PHP_FUNCTION(stream_wrapper_restore) { char *protocol; - zend_str_size protocol_len; + int protocol_len; php_stream_wrapper **wrapperpp = NULL, *wrapper; HashTable *global_wrapper_hash; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &protocol, &protocol_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &protocol, &protocol_len) == FAILURE) { RETURN_FALSE; } @@ -619,7 +618,7 @@ PHP_FUNCTION(stream_wrapper_restore) } /* }}} */ -static zend_str_size_size_t php_userstreamop_write(php_stream *stream, const char *buf, zend_str_size_size_t count TSRMLS_DC) +static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) { zval func_name; zval *retval = NULL; @@ -627,7 +626,7 @@ static zend_str_size_size_t php_userstreamop_write(php_stream *stream, const cha php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract; zval **args[1]; zval *zbufptr; - zend_str_size didwrite = 0; + size_t didwrite = 0; assert(us != NULL); @@ -668,13 +667,13 @@ static zend_str_size_size_t php_userstreamop_write(php_stream *stream, const cha return didwrite; } -static zend_str_size_size_t php_userstreamop_read(php_stream *stream, char *buf, zend_str_size_size_t count TSRMLS_DC) +static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) { zval func_name; zval *retval = NULL; zval **args[1]; int call_result; - zend_str_size didread = 0; + size_t didread = 0; php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract; zval *zcount; @@ -695,7 +694,7 @@ static zend_str_size_size_t php_userstreamop_read(php_stream *stream, char *buf, if (call_result == SUCCESS && retval != NULL) { convert_to_string(retval); - didread = Z_STRSIZE_P(retval); + didread = Z_STRLEN_P(retval); if (didread > count) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_READ " - read %ld bytes more data than requested (%ld read, %ld max) - excess data will be lost", us->wrapper->classname, (long)(didread - count), (long)didread, (long)count); @@ -1152,7 +1151,7 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value } -static int user_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) +static int user_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval *zfilename, *zfuncname, *zretval; @@ -1199,8 +1198,7 @@ static int user_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int return ret; } -static int user_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, - int options, php_stream_context *context TSRMLS_DC) +static int user_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval *zold_name, *znew_name, *zfuncname, *zretval; @@ -1252,8 +1250,7 @@ static int user_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from return ret; } -static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int mode, - int options, php_stream_context *context TSRMLS_DC) +static int user_wrapper_mkdir(php_stream_wrapper *wrapper, char *url, int mode, int options, php_stream_context *context TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval *zfilename, *zmode, *zoptions, *zfuncname, *zretval; @@ -1311,8 +1308,7 @@ static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int return ret; } -static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, - int options, php_stream_context *context TSRMLS_DC) +static int user_wrapper_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval *zfilename, *zoptions, *zfuncname, *zretval; @@ -1365,8 +1361,7 @@ static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, return ret; } -static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, int option, - void *value, php_stream_context *context TSRMLS_DC) +static int user_wrapper_metadata(php_stream_wrapper *wrapper, char *url, int option, void *value, php_stream_context *context TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval *zfilename, *zoption, *zvalue, *zfuncname, *zretval; @@ -1449,8 +1444,7 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, i } -static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, int flags, - php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) +static int user_wrapper_stat_url(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval *zfilename, *zfuncname, *zretval, *zflags; @@ -1508,12 +1502,12 @@ static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, i } -static zend_str_size_size_t php_userstreamop_readdir(php_stream *stream, char *buf, zend_str_size_size_t count TSRMLS_DC) +static size_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t count TSRMLS_DC) { zval func_name; zval *retval = NULL; int call_result; - zend_str_size didread = 0; + size_t didread = 0; php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract; php_stream_dirent *ent = (php_stream_dirent*)buf; @@ -1532,7 +1526,7 @@ static zend_str_size_size_t php_userstreamop_readdir(php_stream *stream, char *b if (call_result == SUCCESS && retval != NULL && Z_TYPE_P(retval) != IS_BOOL) { convert_to_string(retval); - PHP_STRLCPY(ent->d_name, Z_STRVAL_P(retval), sizeof(ent->d_name), Z_STRSIZE_P(retval)); + PHP_STRLCPY(ent->d_name, Z_STRVAL_P(retval), sizeof(ent->d_name), Z_STRLEN_P(retval)); didread = sizeof(php_stream_dirent); } else if (call_result == FAILURE) { diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index c0f9927cc4e0e..a9c050f2672d2 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -39,13 +39,6 @@ # define MSG_PEEK 0 #endif -#ifdef PHP_WIN32 -/* send/recv family on windows expects int */ -# define XP_SOCK_BUF_SIZE(sz) (((sz) > INT_MAX) ? INT_MAX : (int)(sz)) -#else -# define XP_SOCK_BUF_SIZE(sz) (sz) -#endif - php_stream_ops php_stream_generic_socket_ops; PHPAPI php_stream_ops php_stream_socket_ops; php_stream_ops php_stream_udp_socket_ops; @@ -58,10 +51,10 @@ php_stream_ops php_stream_unixdg_socket_ops; static int php_tcp_sockop_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC); /* {{{ Generic socket stream operations */ -static zend_str_size_size_t php_sockop_write(php_stream *stream, const char *buf, zend_str_size_size_t count TSRMLS_DC) +static size_t php_sockop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) { php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; - ssize_t didwrite; + int didwrite; struct timeval *ptimeout; if (sock->socket == -1) { @@ -74,7 +67,7 @@ static zend_str_size_size_t php_sockop_write(php_stream *stream, const char *buf ptimeout = &sock->timeout; retry: - didwrite = send(sock->socket, buf, XP_SOCK_BUF_SIZE(count), (sock->is_blocked && ptimeout) ? MSG_DONTWAIT : 0); + didwrite = send(sock->socket, buf, count, (sock->is_blocked && ptimeout) ? MSG_DONTWAIT : 0); if (didwrite <= 0) { long err = php_socket_errno(); @@ -148,10 +141,10 @@ static void php_sock_stream_wait_for_data(php_stream *stream, php_netstream_data } } -static zend_str_size_size_t php_sockop_read(php_stream *stream, char *buf, zend_str_size_size_t count TSRMLS_DC) +static size_t php_sockop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) { php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; - ssize_t nr_bytes = 0; + int nr_bytes = 0; if (sock->socket == -1) { return 0; @@ -163,7 +156,7 @@ static zend_str_size_size_t php_sockop_read(php_stream *stream, char *buf, zend_ return 0; } - nr_bytes = recv(sock->socket, buf, XP_SOCK_BUF_SIZE(count), (sock->is_blocked && sock->timeout.tv_sec != -1) ? MSG_DONTWAIT : 0); + nr_bytes = recv(sock->socket, buf, count, (sock->is_blocked && sock->timeout.tv_sec != -1) ? MSG_DONTWAIT : 0); stream->eof = (nr_bytes == 0 || (nr_bytes == -1 && php_socket_errno() != EWOULDBLOCK)); @@ -237,36 +230,35 @@ static int php_sockop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC #endif } -static inline int sock_sendto(php_netstream_data_t *sock, const char *buf, size_t buflen, int flags, +static inline int sock_sendto(php_netstream_data_t *sock, char *buf, size_t buflen, int flags, struct sockaddr *addr, socklen_t addrlen TSRMLS_DC) { - ssize_t ret; + int ret; if (addr) { - ret = sendto(sock->socket, buf, XP_SOCK_BUF_SIZE(buflen), flags, addr, XP_SOCK_BUF_SIZE(addrlen)); - + ret = sendto(sock->socket, buf, buflen, flags, addr, addrlen); return (ret == SOCK_CONN_ERR) ? -1 : ret; } - return ((ret = send(sock->socket, buf, XP_SOCK_BUF_SIZE(buflen), flags)) == SOCK_CONN_ERR) ? -1 : ret; + return ((ret = send(sock->socket, buf, buflen, flags)) == SOCK_CONN_ERR) ? -1 : ret; } static inline int sock_recvfrom(php_netstream_data_t *sock, char *buf, size_t buflen, int flags, - char **textaddr, zend_str_size_long *textaddrlen, + char **textaddr, long *textaddrlen, struct sockaddr **addr, socklen_t *addrlen TSRMLS_DC) { php_sockaddr_storage sa; socklen_t sl = sizeof(sa); - ssize_t ret; + int ret; int want_addr = textaddr || addr; if (want_addr) { - ret = recvfrom(sock->socket, buf, XP_SOCK_BUF_SIZE(buflen), flags, (struct sockaddr*)&sa, &sl); + ret = recvfrom(sock->socket, buf, buflen, flags, (struct sockaddr*)&sa, &sl); ret = (ret == SOCK_CONN_ERR) ? -1 : ret; php_network_populate_name_from_sockaddr((struct sockaddr*)&sa, sl, textaddr, textaddrlen, addr, addrlen TSRMLS_CC); } else { - ret = recv(sock->socket, buf, XP_SOCK_BUF_SIZE(buflen), flags); + ret = recv(sock->socket, buf, buflen, flags); ret = (ret == SOCK_CONN_ERR) ? -1 : ret; } @@ -529,7 +521,7 @@ static inline int parse_unix_address(php_stream_xport_param *xparam, struct sock } #endif -static inline char *parse_ip_address_ex(const char *str, size_t str_len, int *portno, int get_err, char **err TSRMLS_DC) +static inline char *parse_ip_address_ex(const char *str, int str_len, int *portno, int get_err, char **err TSRMLS_DC) { char *colon; char *host = NULL; @@ -669,7 +661,7 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_ efree(host); return -1; } - bindto = parse_ip_address_ex(Z_STRVAL_PP(tmpzval), Z_STRSIZE_PP(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text TSRMLS_CC); + bindto = parse_ip_address_ex(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval), &bindport, xparam->want_errortext, &xparam->outputs.error_text TSRMLS_CC); } /* Note: the test here for php_stream_udp_socket_ops is important, because we @@ -782,8 +774,8 @@ static int php_tcp_sockop_set_option(php_stream *stream, int option, int value, } -PHPAPI php_stream *php_stream_generic_socket_factory(const char *proto, size_t protolen, - const char *resourcename, size_t resourcenamelen, +PHPAPI php_stream *php_stream_generic_socket_factory(const char *proto, long protolen, + char *resourcename, long resourcenamelen, const char *persistent_id, int options, int flags, struct timeval *timeout, php_stream_context *context STREAMS_DC TSRMLS_DC) diff --git a/php.ini-development b/php.ini-development index 5d4c54510cb96..149dec5505ad4 100644 --- a/php.ini-development +++ b/php.ini-development @@ -909,6 +909,7 @@ default_socket_timeout = 60 ;extension=php_tidy.dll ;extension=php_xmlrpc.dll ;extension=php_xsl.dll +;extension=php_zip.dll ;;;;;;;;;;;;;;;;;;; ; Module Settings ; @@ -1479,7 +1480,7 @@ session.gc_maxlifetime = 1440 ; collection through a shell script, cron entry, or some other method. ; For example, the following script would is the equivalent of ; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): -; find /path/to/sessions -cmin +24 -type f | xargs rm +; find /path/to/sessions -cmin +24 | xargs rm ; PHP 4.2 and less have an undocumented feature/bug that allows you to ; to initialize a session variable in the global scope. @@ -1641,7 +1642,7 @@ mssql.min_error_severity = 10 mssql.min_message_severity = 10 ; Compatibility mode with old versions of PHP 3.0. -mssql.compatibility_mode = Off +mssql.compatability_mode = Off ; Connect timeout ;mssql.connect_timeout = 5 @@ -1957,11 +1958,6 @@ ldap.max_links = -1 ; Useful for internal debugging only. ;opcache.protect_memory=0 -[curl] -; A default value for the CURLOPT_CAINFO option. This is required to be an -; absolute path. -;curl.cainfo = - ; Local Variables: ; tab-width: 4 ; End: diff --git a/php.ini-production b/php.ini-production index 817dd5cc4d606..63d5c5dbfb973 100644 --- a/php.ini-production +++ b/php.ini-production @@ -910,6 +910,7 @@ default_socket_timeout = 60 ;extension=php_tidy.dll ;extension=php_xmlrpc.dll ;extension=php_xsl.dll +;extension=php_zip.dll ;;;;;;;;;;;;;;;;;;; ; Module Settings ; @@ -1480,7 +1481,7 @@ session.gc_maxlifetime = 1440 ; collection through a shell script, cron entry, or some other method. ; For example, the following script would is the equivalent of ; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): -; find /path/to/sessions -cmin +24 -type f | xargs rm +; find /path/to/sessions -cmin +24 | xargs rm ; PHP 4.2 and less have an undocumented feature/bug that allows you to ; to initialize a session variable in the global scope. @@ -1642,7 +1643,7 @@ mssql.min_error_severity = 10 mssql.min_message_severity = 10 ; Compatibility mode with old versions of PHP 3.0. -mssql.compatibility_mode = Off +mssql.compatability_mode = Off ; Connect timeout ;mssql.connect_timeout = 5 @@ -1958,11 +1959,6 @@ ldap.max_links = -1 ; Useful for internal debugging only. ;opcache.protect_memory=0 -[curl] -; A default value for the CURLOPT_CAINFO option. This is required to be an -; absolute path. -;curl.cainfo = - ; Local Variables: ; tab-width: 4 ; End: diff --git a/sapi/apache/config.m4 b/sapi/apache/config.m4 index 7b0ee562eb666..af83e9bcfa2bd 100644 --- a/sapi/apache/config.m4 +++ b/sapi/apache/config.m4 @@ -20,7 +20,7 @@ fi dnl Apache 1.x shared module PHP_ARG_WITH(apxs,, -[ --with-apxs[=FILE] Build shared Apache 1.x module. FILE is the optional +[ --with-apxs[=FILE] Build shared Apache 1.x module. FILE is the optional pathname to the Apache apxs tool [apxs]], no, no) AC_MSG_CHECKING([for Apache 1.x module support via DSO through APXS]) @@ -59,7 +59,7 @@ if test "$PHP_APXS" != "no"; then # Test that we're trying to configure with apache 1.x PHP_AP_EXTRACT_VERSION($APXS_HTTPD) if test "$APACHE_VERSION" -ge 2000000; then - AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropriate switch --with-apxs2]) + AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropiate switch --with-apxs2]) fi for flag in $APXS_CFLAGS; do @@ -123,7 +123,7 @@ fi dnl Apache 1.x static module PHP_ARG_WITH(apache,, -[ --with-apache[=DIR] Build Apache 1.x module. DIR is the top-level Apache +[ --with-apache[=DIR] Build Apache 1.x module. DIR is the top-level Apache build directory [/usr/local/apache]], no, no) AC_MSG_CHECKING([for Apache 1.x module support]) @@ -237,7 +237,7 @@ if test -z "$enable_mod_charset" && test "$with_mod_charset"; then fi PHP_ARG_ENABLE(mod-charset, whether to enable Apache charset compatibility option, -[ --enable-mod-charset APACHE: Enable transfer tables for mod_charset (Rus Apache)], no, no) +[ --enable-mod-charset APACHE: Enable transfer tables for mod_charset (Rus Apache)], no, no) if test "$PHP_MOD_CHARSET" = "yes"; then AC_DEFINE(USE_TRANSFER_TABLES, 1, [ ]) diff --git a/sapi/apache2filter/config.m4 b/sapi/apache2filter/config.m4 index b6524fd874e0b..c49488d1824ff 100644 --- a/sapi/apache2filter/config.m4 +++ b/sapi/apache2filter/config.m4 @@ -62,7 +62,7 @@ if test "$PHP_APXS2FILTER" != "no"; then # Test that we're trying to configure with apache 2.x PHP_AP_EXTRACT_VERSION($APXS_HTTPD) if test "$APACHE_VERSION" -le 2000000; then - AC_MSG_ERROR([You have enabled Apache 2 support while your server is Apache 1.3. Please use the appropriate switch --with-apxs (without the 2)]) + AC_MSG_ERROR([You have enabled Apache 2 support while your server is Apache 1.3. Please use the appropiate switch --with-apxs (without the 2)]) elif test "$APACHE_VERSION" -lt 2000040; then AC_MSG_ERROR([Please note that Apache version >= 2.0.40 is required]) fi diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4 index 02f8a0b3ad86e..702f91f5d23cf 100644 --- a/sapi/apache2handler/config.m4 +++ b/sapi/apache2handler/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(apxs2,, -[ --with-apxs2[=FILE] Build shared Apache 2.0 Handler module. FILE is the optional +[ --with-apxs2[=FILE] Build shared Apache 2.0 Handler module. FILE is the optional pathname to the Apache apxs tool [apxs]], no, no) AC_MSG_CHECKING([for Apache 2.0 handler-module support via DSO through APXS]) @@ -61,7 +61,7 @@ if test "$PHP_APXS2" != "no"; then # Test that we're trying to configure with apache 2.x PHP_AP_EXTRACT_VERSION($APXS_HTTPD) if test "$APACHE_VERSION" -le 2000000; then - AC_MSG_ERROR([You have enabled Apache 2 support while your server is Apache 1.3. Please use the appropriate switch --with-apxs (without the 2)]) + AC_MSG_ERROR([You have enabled Apache 2 support while your server is Apache 1.3. Please use the appropiate switch --with-apxs (without the 2)]) elif test "$APACHE_VERSION" -lt 2000044; then AC_MSG_ERROR([Please note that Apache version >= 2.0.44 is required]) fi diff --git a/sapi/apache_hooks/config.m4 b/sapi/apache_hooks/config.m4 index e2c71b4274691..4213b7c6a6013 100644 --- a/sapi/apache_hooks/config.m4 +++ b/sapi/apache_hooks/config.m4 @@ -60,7 +60,7 @@ if test "$PHP_APACHE_HOOKS" != "no"; then # Test that we're trying to configure with apache 1.x PHP_AP_EXTRACT_VERSION($APXS_HTTPD) if test "$APACHE_VERSION" -ge 2000000; then - AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropriate switch --with-apxs2]) + AC_MSG_ERROR([You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropiate switch --with-apxs2]) fi for flag in $APXS_CFLAGS; do @@ -239,7 +239,7 @@ if test -z "$enable_mod_charset" && test "$with_mod_charset"; then fi PHP_ARG_ENABLE(mod-charset, whether to enable Apache charset compatibility option, -[ --enable-mod-charset APACHE (hooks): Enable transfer tables for mod_charset (Rus Apache)], no, no) +[ --enable-mod-charset APACHE (hooks): Enable transfer tables for mod_charset (Rus Apache)], no, no) if test "$PHP_MOD_CHARSET" = "yes"; then AC_DEFINE(USE_TRANSFER_TABLES, 1, [ ]) diff --git a/sapi/caudium/config.m4 b/sapi/caudium/config.m4 index 5ce55f3f01024..8aba33e23d203 100644 --- a/sapi/caudium/config.m4 +++ b/sapi/caudium/config.m4 @@ -4,7 +4,7 @@ dnl RESULT=no PHP_ARG_WITH(caudium,, -[ --with-caudium[=DIR] Build PHP as a Pike module for use with Caudium. +[ --with-caudium[=DIR] Build PHP as a Pike module for use with Caudium. DIR is the Caudium server dir [/usr/local/caudium/server]], no, no) AC_MSG_CHECKING([for Caudium support]) diff --git a/sapi/cgi/Makefile.frag b/sapi/cgi/Makefile.frag index d3d7cb3553ab6..505119e57288a 100644 --- a/sapi/cgi/Makefile.frag +++ b/sapi/cgi/Makefile.frag @@ -5,9 +5,5 @@ $(SAPI_CGI_PATH): $(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) $(PHP_CGI_OBJS) install-cgi: $(SAPI_CGI_PATH) @echo "Installing PHP CGI binary: $(INSTALL_ROOT)$(bindir)/" - @$(mkinstalldirs) $(INSTALL_ROOT)$(bindir) @$(INSTALL) -m 0755 $(SAPI_CGI_PATH) $(INSTALL_ROOT)$(bindir)/$(program_prefix)php-cgi$(program_suffix)$(EXEEXT) - @echo "Installing PHP CGI man page: $(INSTALL_ROOT)$(mandir)/man1/" - @$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1 - @$(INSTALL_DATA) sapi/cgi/php-cgi.1 $(INSTALL_ROOT)$(mandir)/man1/$(program_prefix)php-cgi$(program_suffix).1 diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 221b0021756dc..4c78fcafec08f 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -508,7 +508,7 @@ static int sapi_cgi_read_post(char *buffer, uint count_bytes TSRMLS_DC) uint read_bytes = 0; int tmp_read_bytes; - count_bytes = MIN(count_bytes, SG(request_info).content_length - SG(read_post_bytes)); + count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes)); while (read_bytes < count_bytes) { tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, count_bytes - read_bytes); if (tmp_read_bytes <= 0) { diff --git a/sapi/cgi/config9.m4 b/sapi/cgi/config9.m4 index 49e61c83c3da5..67251aeb588d1 100644 --- a/sapi/cgi/config9.m4 +++ b/sapi/cgi/config9.m4 @@ -71,8 +71,6 @@ if test "$PHP_CGI" != "no"; then dnl Expose to Makefile PHP_SUBST(SAPI_CGI_PATH) PHP_SUBST(BUILD_CGI) - - PHP_OUTPUT(sapi/cgi/php-cgi.1) else AC_MSG_RESULT(yes) fi diff --git a/sapi/cgi/php-cgi.1.in b/sapi/cgi/php-cgi.1.in deleted file mode 100644 index 340e6c5d6096a..0000000000000 --- a/sapi/cgi/php-cgi.1.in +++ /dev/null @@ -1 +0,0 @@ -.so man1/php.1 diff --git a/sapi/cli/cli.h b/sapi/cli/cli.h index cfbf0be8d9d4f..7686522a20ad6 100644 --- a/sapi/cli/cli.h +++ b/sapi/cli/cli.h @@ -30,11 +30,11 @@ #endif -extern PHP_CLI_API size_t sapi_cli_single_write(const char *str, zend_str_size_uint str_length TSRMLS_DC); +extern PHP_CLI_API size_t sapi_cli_single_write(const char *str, uint str_length TSRMLS_DC); typedef struct { - zend_str_size_size_t (*cli_shell_write)(const char *str, zend_str_size_uint str_length TSRMLS_DC); - zend_str_size_int (*cli_shell_ub_write)(const char *str, zend_str_size_uint str_length TSRMLS_DC); + size_t (*cli_shell_write)(const char *str, uint str_length TSRMLS_DC); + int (*cli_shell_ub_write)(const char *str, uint str_length TSRMLS_DC); int (*cli_shell_run)(TSRMLS_D); } cli_shell_callbacks_t; diff --git a/sapi/cli/php.1.in b/sapi/cli/php.1.in index c113030d14dd4..0e9d07ac771de 100644 --- a/sapi/cli/php.1.in +++ b/sapi/cli/php.1.in @@ -1,8 +1,6 @@ .TH PHP 1 "2013" "The PHP Group" "Scripting Language" .SH NAME php \- PHP Command Line Interface 'CLI' -.P -php-cgi \- PHP Common Gateway Interface 'CGI' command .SH SYNOPSIS .B php [options] [ @@ -20,21 +18,21 @@ php-cgi \- PHP Common Gateway Interface 'CGI' command .LP .B php [options] [\-B -.IR begin_code ] +.IR code ] .B \-R .IR code [\-E -.IR end_code ] +.IR code ] [[\-\-] .IR args.\|.\|. ] .LP .B php [options] [\-B -.IR begin_code ] +.IR code ] .B \-F .IR file [\-E -.IR end_code ] +.IR code ] [[\-\-] .IR args.\|.\|. ] .LP @@ -86,7 +84,7 @@ and therefore reading from .B STDIN explicitly changes the next input line or skips input lines. .LP -PHP also contains an built-in web server for application development purpose. By using the \-S option where +PHP also contains an embedded web server for application development purpose. By using the \-S option where .B addr:port point to a local address and port PHP will listen to HTTP requests on that address and port and serve files from the current working directory or the .B docroot @@ -237,9 +235,9 @@ without using script tags .B \-\-process\-begin \fIcode\fP .TP .PD 1 -.B \-B \fIbegin_code\fP +.B \-B \fIcode\fP Run PHP -.IR begin_code +.IR code before processing input lines .TP .PD 0 @@ -264,9 +262,9 @@ for every input line .B \-\-process\-end \fIcode\fP .TP .PD 1 -.B \-E \fIend_code\fP +.B \-E \fIcode\fP Run PHP -.IR end_code +.IR code after processing all input lines .TP .PD 0 @@ -281,14 +279,14 @@ Output HTML syntax highlighted source .TP .PD 1 .B \-S \fIaddr:port\fP -Start built-in web server on the given local address and port +Start embedded Webserver on the given local address and port .TP .PD 0 .B \-\-docroot \fIdocroot\fP .TP .PD 1 .B \-t \fIdocroot\fP -Specify the document root to be used by the built-in web server +Specify the document root to be used by the embedded web server .TP .PD 0 .B \-\-version diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index c343f5496e103..729052334d6c9 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -252,16 +252,16 @@ static inline int sapi_cli_select(int fd TSRMLS_DC) return ret != -1; } -PHP_CLI_API zend_str_size_size_t sapi_cli_single_write(const char *str, zend_str_size_uint str_length TSRMLS_DC) /* {{{ */ +PHP_CLI_API size_t sapi_cli_single_write(const char *str, uint str_length TSRMLS_DC) /* {{{ */ { #ifdef PHP_WRITE_STDOUT long ret; #else - zend_str_size ret; + size_t ret; #endif if (cli_shell_callbacks.cli_shell_write) { - zend_str_size shell_wrote; + size_t shell_wrote; shell_wrote = cli_shell_callbacks.cli_shell_write(str, str_length TSRMLS_CC); if (shell_wrote > -1) { return shell_wrote; @@ -285,10 +285,10 @@ PHP_CLI_API zend_str_size_size_t sapi_cli_single_write(const char *str, zend_str } /* }}} */ -static zend_str_size_int sapi_cli_ub_write(const char *str, zend_str_size_uint str_length TSRMLS_DC) /* {{{ */ +static int sapi_cli_ub_write(const char *str, uint str_length TSRMLS_DC) /* {{{ */ { const char *ptr = str; - zend_str_size remaining = str_length; + uint remaining = str_length; size_t ret; if (!str_length) { @@ -296,7 +296,7 @@ static zend_str_size_int sapi_cli_ub_write(const char *str, zend_str_size_uint s } if (cli_shell_callbacks.cli_shell_ub_write) { - zend_str_size ub_wrote; + int ub_wrote; ub_wrote = cli_shell_callbacks.cli_shell_ub_write(str, str_length TSRMLS_CC); if (ub_wrote > -1) { return ub_wrote; @@ -338,7 +338,7 @@ static char *script_filename = ""; static void sapi_cli_register_variables(zval *track_vars_array TSRMLS_DC) /* {{{ */ { - zend_str_size len; + unsigned int len; char *docroot = ""; /* In CGI mode, we consider the environment to be a part of the server @@ -503,7 +503,6 @@ static void php_cli_usage(char *argv0) " %s [options] -r [--] [args...]\n" " %s [options] [-B ] -R [-E ] [--] [args...]\n" " %s [options] [-B ] -F [-E ] [--] [args...]\n" - " %s [options] -S : [-t docroot]\n" " %s [options] -- [args...]\n" " %s [options] -a\n" "\n" @@ -545,7 +544,7 @@ static void php_cli_usage(char *argv0) " --rz Show information about Zend extension .\n" " --ri Show configuration for extension .\n" "\n" - , prog, prog, prog, prog, prog, prog, prog); + , prog, prog, prog, prog, prog, prog); } /* }}} */ @@ -619,7 +618,7 @@ static const char *param_mode_conflict = "Either execute direct code, process st /* {{{ cli_seek_file_begin */ -static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file, zend_str_size_int *lineno TSRMLS_DC) +static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file, int *lineno TSRMLS_DC) { int c; @@ -670,7 +669,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ char *arg_free=NULL, **arg_excp=&arg_free; char *script_file=NULL, *translated_path = NULL; int interactive=0; - zend_str_size lineno = 0; + int lineno = 0; const char *param_error=NULL; int hide_argv = 0; @@ -1059,7 +1058,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ } ALLOC_ZVAL(argn); Z_TYPE_P(argn) = IS_STRING; - Z_STRSIZE_P(argn) = ++len; + Z_STRLEN_P(argn) = ++len; Z_STRVAL_P(argn) = estrndup(input, len); INIT_PZVAL(argn); zend_hash_update(&EG(symbol_table), "argn", sizeof("argn"), &argn, sizeof(zval *), NULL); @@ -1143,7 +1142,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ } case PHP_MODE_REFLECTION_EXT_INFO: { - zend_str_size_int len = strlen(reflection_what); + int len = strlen(reflection_what); char *lcname = zend_str_tolower_dup(reflection_what, len); zend_module_entry *module; @@ -1214,7 +1213,7 @@ int main(int argc, char *argv[]) int php_optind = 1, use_extended_info = 0; char *ini_path_override = NULL; char *ini_entries = NULL; - zend_str_size ini_entries_len = 0; + int ini_entries_len = 0; int ini_ignore = 0; sapi_module_struct *sapi_module = &cli_sapi_module; @@ -1280,7 +1279,7 @@ int main(int argc, char *argv[]) break; case 'd': { /* define ini entries on command line */ - zend_str_size len = strlen(php_optarg); + int len = strlen(php_optarg); char *val; if ((val = strchr(php_optarg, '='))) { diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 630acc3041e28..a1bae67e745c9 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -492,7 +492,7 @@ static int sapi_cli_server_startup(sapi_module_struct *sapi_module) /* {{{ */ return SUCCESS; } /* }}} */ -static zend_str_size_int sapi_cli_server_ub_write(const char *str, zend_str_size_uint str_length TSRMLS_DC) /* {{{ */ +static int sapi_cli_server_ub_write(const char *str, uint str_length TSRMLS_DC) /* {{{ */ { php_cli_server_client *client = SG(server_context); if (!client) { @@ -574,7 +574,7 @@ static char *sapi_cli_server_read_cookies(TSRMLS_D) /* {{{ */ return *val; } /* }}} */ -static zend_str_size_int sapi_cli_server_read_post(char *buf, uint count_bytes TSRMLS_DC) /* {{{ */ +static int sapi_cli_server_read_post(char *buf, uint count_bytes TSRMLS_DC) /* {{{ */ { php_cli_server_client *client = SG(server_context); if (client->request.content) { @@ -590,7 +590,7 @@ static zend_str_size_int sapi_cli_server_read_post(char *buf, uint count_bytes T static void sapi_cli_server_register_variable(zval *track_vars_array, const char *key, const char *val TSRMLS_DC) /* {{{ */ { char *new_val = (char *)val; - zend_str_size_uint new_val_len; + uint new_val_len; if (sapi_module.input_filter(PARSE_SERVER, (char*)key, &new_val, strlen(val), &new_val_len TSRMLS_CC)) { php_register_variable_safe((char *)key, new_val, new_val_len, track_vars_array TSRMLS_CC); } @@ -987,7 +987,7 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender *sen switch (chunk->type) { case PHP_CLI_SERVER_CHUNK_HEAP: - nbytes_sent = send(fd, chunk->data.heap.p, chunk->data.heap.len, 0); /* XXX on windows len is int */ + nbytes_sent = send(fd, chunk->data.heap.p, chunk->data.heap.len, 0); if (nbytes_sent < 0) { *nbytes_sent_total = _nbytes_sent_total; return php_socket_errno(); @@ -1746,7 +1746,7 @@ static int php_cli_server_client_ctor(php_cli_server_client *client, php_cli_ser client->addr_len = addr_len; { char *addr_str = 0; - zend_str_size_long addr_str_len = 0; + long addr_str_len = 0; php_network_populate_name_from_sockaddr(addr, addr_len, &addr_str, &addr_str_len, NULL, 0 TSRMLS_CC); client->addr_str = pestrndup(addr_str, addr_str_len, 1); client->addr_str_len = addr_str_len; diff --git a/sapi/cli/php_http_parser.h b/sapi/cli/php_http_parser.h index 31502e213af7b..2bf2356725a29 100644 --- a/sapi/cli/php_http_parser.h +++ b/sapi/cli/php_http_parser.h @@ -29,13 +29,15 @@ extern "C" { #include #if defined(_WIN32) && !defined(__MINGW32__) # include +# include "win32/php_stdint.h" # include "config.w32.h" #else # include "php_config.h" +# ifdef HAVE_STDINT_H +# include +# endif #endif -#include "php_stdint.h" - /* Compile with -DPHP_HTTP_PARSER_STRICT=0 to make less checks, but run * faster */ diff --git a/sapi/cli/tests/php_cli_server.inc b/sapi/cli/tests/php_cli_server.inc index 77a79e0f0493e..40c53619957fd 100644 --- a/sapi/cli/tests/php_cli_server.inc +++ b/sapi/cli/tests/php_cli_server.inc @@ -3,7 +3,7 @@ define ("PHP_CLI_SERVER_HOSTNAME", "localhost"); define ("PHP_CLI_SERVER_PORT", 8964); define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT); -function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE, $cmd_args = null) { +function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE) { $php_executable = getenv('TEST_PHP_EXECUTABLE'); $doc_root = __DIR__; $router = "index.php"; @@ -19,14 +19,14 @@ function php_cli_server_start($code = 'echo "Hello world";', $no_router = FALSE, ); if (substr(PHP_OS, 0, 3) == 'WIN') { - $cmd = "{$php_executable} -t {$doc_root} -n {$cmd_args} -S " . PHP_CLI_SERVER_ADDRESS; + $cmd = "{$php_executable} -t {$doc_root} -n -S " . PHP_CLI_SERVER_ADDRESS; if (!$no_router) { $cmd .= " {$router}"; } $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true, "suppress_errors" => true)); } else { - $cmd = "exec {$php_executable} -t {$doc_root} -n {$cmd_args} -S " . PHP_CLI_SERVER_ADDRESS; + $cmd = "exec {$php_executable} -t {$doc_root} -n -S " . PHP_CLI_SERVER_ADDRESS; if (!$no_router) { $cmd .= " {$router}"; } diff --git a/sapi/cli/tests/upload_2G.phpt b/sapi/cli/tests/upload_2G.phpt deleted file mode 100644 index fe13d90007036..0000000000000 --- a/sapi/cli/tests/upload_2G.phpt +++ /dev/null @@ -1,99 +0,0 @@ ---TEST-- -file upload greater than 2G ---SKIPIF-- -=8"); -} - -if ($f = fopen("/proc/meminfo","r")) { - while (!feof($f)) { - if (!strncmp($line = fgets($f), "MemFree", 7)) { - if (substr($line,8)/1024/1024 > 3) { - $enough_free_ram = true; - } - } - } -} - -if (empty($enough_free_ram)) { - die("need +3G free RAM"); -} -?> ---FILE-- - -Done ---EXPECTF-- -Test - -HTTP/1.1 200 OK -Host: %s -Connection: close -X-Powered-By: PHP/%s -Content-type: text/html - -array(1) { - ["file1"]=> - array(5) { - ["name"]=> - string(9) "file1.txt" - ["type"]=> - string(10) "text/plain" - ["tmp_name"]=> - string(14) "/tmp/php%s" - ["error"]=> - int(0) - ["size"]=> - int(2150000000) - } -} -Done diff --git a/sapi/embed/config.m4 b/sapi/embed/config.m4 index 5ffb9b39bd7c1..3a61b458f03ab 100644 --- a/sapi/embed/config.m4 +++ b/sapi/embed/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_ENABLE(embed,, -[ --enable-embed[=TYPE] EXPERIMENTAL: Enable building of embedded SAPI library +[ --enable-embed[=TYPE] EXPERIMENTAL: Enable building of embedded SAPI library TYPE is either 'shared' or 'static'. [TYPE=shared]], no, no) AC_MSG_CHECKING([for embedded SAPI library support]) diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index bd6d64930b1fa..3d34c79588a31 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_ENABLE(fpm,, -[ --enable-fpm Enable building of the fpm SAPI executable], no, no) +[ --enable-fpm Enable building of the fpm SAPI executable], no, no) dnl configure checks {{{ AC_DEFUN([AC_FPM_STDLIBS], @@ -557,11 +557,11 @@ if test "$PHP_FPM" != "no"; then AC_FPM_SELECT PHP_ARG_WITH(fpm-user,, - [ --with-fpm-user[=USER] Set the user for php-fpm to run as. (default: nobody)], nobody, no) + [ --with-fpm-user[=USER] Set the user for php-fpm to run as. (default: nobody)], nobody, no) PHP_ARG_WITH(fpm-group,, - [ --with-fpm-group[=GRP] Set the group for php-fpm to run as. For a system user, this - should usually be set to match the fpm username (default: nobody)], nobody, no) + [ --with-fpm-group[=GRP] Set the group for php-fpm to run as. For a system user, this + should usually be set to match the fpm username (default: nobody)], nobody, no) PHP_ARG_WITH(fpm-systemd,, [ --with-fpm-systemd Activate systemd integration], no, no) diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c index 99905c8b605a6..cf3f098c53676 100644 --- a/sapi/fpm/fpm/fastcgi.c +++ b/sapi/fpm/fpm/fastcgi.c @@ -610,7 +610,7 @@ static int fcgi_read_request(fcgi_request *req) } zend_hash_internal_pointer_reset_ex(req->env, &pos); - while ((key_type = zend_hash_get_current_key_ex(req->env, &str_index, &str_length, &num_index, 0, &pos)) != HASH_KEY_NON_EXISTENT) { + while ((key_type = zend_hash_get_current_key_ex(req->env, &str_index, &str_length, &num_index, 0, &pos)) != HASH_KEY_NON_EXISTANT) { int zlen; zend_hash_move_forward_ex(req->env, &pos); if (key_type != HASH_KEY_IS_STRING) { diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in index af4f2fa325a3f..e0d80970af8b6 100644 --- a/sapi/fpm/php-fpm.conf.in +++ b/sapi/fpm/php-fpm.conf.in @@ -3,7 +3,7 @@ ;;;;;;;;;;;;;;;;;;;;; ; All relative paths in this configuration file are relative to PHP's install -; prefix (@prefix@). This prefix can be dynamically changed by using the +; prefix (@prefix@). This prefix can be dynamicaly changed by using the ; '-p' argument from the command line. ; Include one or more files. If glob(3) exists, it is used to include a bunch of @@ -401,7 +401,7 @@ pm.max_spare_servers = 3 ; - %{megabytes}M ; - %{mega}M ; %n: pool name -; %o: output header +; %o: ouput header ; it must be associated with embraces to specify the name of the header: ; - %{Content-Type}o ; - %{X-Powered-By}o diff --git a/sapi/isapi/config.m4 b/sapi/isapi/config.m4 index 6014bab09fce3..7c7dcf0c21064 100644 --- a/sapi/isapi/config.m4 +++ b/sapi/isapi/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(isapi, for Zeus ISAPI support, -[ --with-isapi[=DIR] Build PHP as an ISAPI module for use with Zeus], no, no) +[ --with-isapi[=DIR] Build PHP as an ISAPI module for use with Zeus], no, no) if test "$PHP_ISAPI" != "no"; then if test "$PHP_ISAPI" = "yes"; then diff --git a/sapi/litespeed/README b/sapi/litespeed/README index b5cec05aa607f..e548ec97db850 100644 --- a/sapi/litespeed/README +++ b/sapi/litespeed/README @@ -195,7 +195,7 @@ process. By default a LSAPI application check the existence of its parent process and exits automatically if the parent process died. This is to reduce -orphan process when web server is restarted. However, it is desirable +orphan process when web server is restarted. However, it is desireable to disable this feature, such as when a LSAPI process was started manually from command line. LSAPI_PPID_NO_CHECK should be set when you want to disable the checking of existence of parent process. diff --git a/sapi/milter/config.m4 b/sapi/milter/config.m4 index 4bcad80bb4ab1..48c7a5d804356 100644 --- a/sapi/milter/config.m4 +++ b/sapi/milter/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(milter, for Milter support, -[ --with-milter[=DIR] Build PHP as Milter application], no, no) +[ --with-milter[=DIR] Build PHP as Milter application], no, no) if test "$PHP_MILTER" != "no"; then if test "$PHP_MILTER" = "yes"; then diff --git a/sapi/pi3web/config.m4 b/sapi/pi3web/config.m4 index 347a74ca06173..7859481508bb0 100644 --- a/sapi/pi3web/config.m4 +++ b/sapi/pi3web/config.m4 @@ -3,7 +3,7 @@ dnl $Id$ dnl PHP_ARG_WITH(pi3web, for Pi3Web support, -[ --with-pi3web[=DIR] Build PHP as Pi3Web module], no, no) +[ --with-pi3web[=DIR] Build PHP as Pi3Web module], no, no) if test "$PHP_PI3WEB" != "no"; then if test "$PHP_PI3WEB" = "yes"; then diff --git a/sapi/roxen/config.m4 b/sapi/roxen/config.m4 index 7601b0c1ed95d..9b0bb90c35242 100644 --- a/sapi/roxen/config.m4 +++ b/sapi/roxen/config.m4 @@ -7,7 +7,7 @@ PHP_ARG_WITH(roxen,, directory, normally /usr/local/roxen/server], no, no) PHP_ARG_ENABLE(roxen-zts, whether Roxen module is build using ZTS, -[ --enable-roxen-zts ROXEN: Build the Roxen module using Zend Thread Safety], no, no) +[ --enable-roxen-zts ROXEN: Build the Roxen module using Zend Thread Safety], no, no) RESULT= AC_MSG_CHECKING([for Roxen/Pike support]) diff --git a/scripts/Makefile.frag b/scripts/Makefile.frag index 7cd78fabad073..00272b02b1a8d 100644 --- a/scripts/Makefile.frag +++ b/scripts/Makefile.frag @@ -44,7 +44,7 @@ install-programs: $(builddir)/phpize $(builddir)/php-config echo " page: $(program_prefix)$${page}$(program_suffix).1"; \ $(INSTALL_DATA) $(builddir)/man1/$${page}.1 $(INSTALL_ROOT)$(mandir)/man1/$(program_prefix)$${page}$(program_suffix).1; \ done - + $(builddir)/phpize: $(srcdir)/phpize.in $(top_builddir)/config.status (CONFIG_FILES=$@ CONFIG_HEADERS= $(top_builddir)/config.status) diff --git a/scripts/dev/conv_proto b/scripts/dev/conv_proto new file mode 100755 index 0000000000000..fad9cfaa83845 --- /dev/null +++ b/scripts/dev/conv_proto @@ -0,0 +1,30 @@ +#! /bin/sh +# +# do some automatic conversion of prototypes +# + +if test "$1" = "" ; then + echo "usage: $0 list-of-files" + exit 1 +fi + +tmpfile=`mktemp -q /tmp/asd.XXXXXX` + +if test "$?" != "0" ; then + echo "$0: cannot create temporary file" + exit 1 +fi + +for file in ${1+"$@"} ; do + echo "working on $file" + cat $file | \ + sed -e \ + 's/void php3_\(.*\)(INTERNAL_FUNCTION_PARAMETERS)/PHP_FUNCTION(\1)/' \ + -e 's/^extern void /void /' \ + -e 's/^extern PHP_FUNCTION/PHP_FUNCTION/' > $tmpfile + cp $tmpfile $file +done + +rm -f $tmpfile + +exit 0 diff --git a/scripts/dev/conv_z_macros b/scripts/dev/conv_z_macros new file mode 100755 index 0000000000000..ea45bc2ef98ba --- /dev/null +++ b/scripts/dev/conv_z_macros @@ -0,0 +1,61 @@ +#! /bin/sh +# +# +----------------------------------------------------------------------+ +# | PHP Version 5 | +# +----------------------------------------------------------------------+ +# | Copyright (c) 1997-2007 The PHP Group | +# +----------------------------------------------------------------------+ +# | This source file is subject to version 3.01 of the PHP license, | +# | that is bundled with this package in the file LICENSE, and is | +# | available through the world-wide-web at the following url: | +# | http://www.php.net/license/3_01.txt | +# | If you did not receive a copy of the PHP license and are unable to | +# | obtain it through the world-wide-web, please send a note to | +# | license@php.net so we can mail you a copy immediately. | +# +----------------------------------------------------------------------+ +# | Author: Sascha Schumann | +# +----------------------------------------------------------------------+ +# +# $Id$ + +for i in $@; do + echo -n "Processing $i... " + sed \ + -e 's/(\*\([^()]\+\))->type/Z_TYPE_PP(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)->type/Z_TYPE_P(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)\.type/Z_TYPE(\1)/g' \ + -e 's/(\*\([^()]\+\))->value\.dval/Z_DVAL_PP(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)->value\.dval/Z_DVAL_P(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)\.value\.dval/Z_DVAL(\1)/g' \ + -e 's/(\*\([^()]\+\))->value\.lval/Z_LVAL_PP(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)->value\.lval/Z_LVAL_P(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)\.value\.lval/Z_LVAL(\1)/g' \ + -e 's/(\*\([^()]\+\))->value\.ht/Z_ARRVAL_PP(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)->value\.ht/Z_ARRVAL_P(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)\.value\.ht/Z_ARRVAL(\1)/g' \ + -e 's/(\*\([^()]\+\))->value\.str\.val/Z_STRVAL_PP(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)->value\.str\.val/Z_STRVAL_P(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)\.value\.str\.val/Z_STRVAL(\1)/g' \ + -e 's/(\*\([^()]\+\))->value\.str\.len/Z_STRLEN_PP(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)->value\.str\.len/Z_STRLEN_P(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)\.value\.str\.len/Z_STRLEN(\1)/g' \ + -e 's/(\*\([^()]\+\))->value\.obj\.properties/Z_OBJPROP_PP(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)->value\.obj\.properties/Z_OBJPROP_P(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)\.value\.obj\.properties/Z_OBJPROP(\1)/g' \ + -e 's/(\*\([^()]\+\))->value\.obj\.ce/Z_OBJCE_PP(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)->value\.obj\.ce/Z_OBJCE_P(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)\.value\.obj\.ce/Z_OBJCE(\1)/g' \ + -e 's/(\*\([^()]\+\))->value\.obj/Z_OBJ_PP(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)->value\.obj/Z_OBJ_P(\1)/g' \ + -e 's/\([a-z_][]a-z_0-9\[]*\)\.value\.obj/Z_OBJ(\1)/g' \ + -e 's/\([a-zA-Z_][a-zA-Z_0-9]*\)->Z_\([A-Z_]\+\)(/Z_\2(\1->/g' \ + -e 's/\([a-zA-Z_][a-zA-Z_0-9]*\)->Z_\([A-Z_]\+\)(/Z_\2(\1->/g' \ + -e 's/\([a-zA-Z_][a-zA-Z_0-9]*\)->Z_\([A-Z_]\+\)(/Z_\2(\1->/g' \ + -e 's/\([a-zA-Z_][a-zA-Z_0-9]*\)\.Z_\([A-Z_]\+\)(/Z_\2(\1./g' \ + -e 's/\([a-zA-Z_][a-zA-Z_0-9]*\)\.Z_\([A-Z_]\+\)(/Z_\2(\1./g' \ + -e 's/\([a-zA-Z_][a-zA-Z_0-9]*\)\.Z_\([A-Z_]\+\)(/Z_\2(\1./g' \ + < $i > tmp && cp tmp $i + echo "DONE" +done + +rm -f tmp diff --git a/scripts/dev/extern_c.php b/scripts/dev/extern_c.php new file mode 100644 index 0000000000000..72c7edcd3288c --- /dev/null +++ b/scripts/dev/extern_c.php @@ -0,0 +1,45 @@ + $line) { + if (ereg("^[[:space:]]*BEGIN_EXTERN_C", $line)) { +# echo "$file:".($nr+1)." $line"; + $flag = true; + } else if (ereg("^[[:space:]]*END_EXTERN_C", $line)) { +# echo "$file:".($nr+1)." $line"; + $flag = false; + } else if ( (ereg("^[[:space:]]*PHPAPI[[:space:]]*", $line)) + ||(ereg("^[[:space:]]*ZEND_API[[:space:]]*", $line))) { + if (strstr($line,"(")) { + if (!$flag) echo "$file:".($nr+1)." $line"; + } + } + } +} + +array_shift($_SERVER["argv"]); + +if (count($_SERVER["argv"])) { + foreach ($_SERVER["argv"] as $dir) { + scan_dir($dir); + } +} else { + scan_dir("."); +} +?> \ No newline at end of file diff --git a/scripts/dev/generate-phpt.phar b/scripts/dev/generate-phpt.phar index c6268c0af3814be15272e90e705a432000cf2328..a12c040f9c93c2123c22bfdba6fef3a6df6f19c7 100644 GIT binary patch delta 32 ocmZpf$=o!Pd4to0&CV0v$W4AcTv9waZ>`Mc(DnMV0P9N)variationTests + * Constucts all possible variation testcases in array $this->variationTests * */ public function constructAll() { diff --git a/tests/basic/bug45986.phpt b/tests/basic/bug45986.phpt index 33c3f27eac816..1c30f10403dc0 100644 --- a/tests/basic/bug45986.phpt +++ b/tests/basic/bug45986.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #45986 (wrong error message for a non existent file on rename) +Bug #45986 (wrong error message for a non existant file on rename) --CREDITS-- Sebastian Schürmann sebs@php.net diff --git a/tests/classes/static_properties_004.phpt b/tests/classes/static_properties_004.phpt index e98c605eb4714..ce1d19dcc10c8 100644 --- a/tests/classes/static_properties_004.phpt +++ b/tests/classes/static_properties_004.phpt @@ -6,7 +6,7 @@ class C { public static $p = 'original'; } class D extends C { } class E extends D { } -echo "\nInherited static properties refer to the same value across classes:\n"; +echo "\nInherited static properties refer to the same value accross classes:\n"; var_dump(C::$p, D::$p, E::$p); echo "\nChanging one changes all the others:\n"; @@ -20,7 +20,7 @@ var_dump(C::$p, D::$p, E::$p); ?> ==Done== --EXPECTF-- -Inherited static properties refer to the same value across classes: +Inherited static properties refer to the same value accross classes: %unicode|string%(8) "original" %unicode|string%(8) "original" %unicode|string%(8) "original" diff --git a/travis/compile.sh b/travis/compile.sh index a56db63c127a0..b48bfe8e24eea 100755 --- a/travis/compile.sh +++ b/travis/compile.sh @@ -1,9 +1,9 @@ #!/bin/bash ./buildconf ./configure --quiet \ ---with-pdo-mysql=mysqlnd \ ---with-mysql=mysqlnd \ ---with-mysqli=mysqlnd \ +--with-pdo-mysql \ +--with-mysql \ +--with-mysqli \ --with-pgsql \ --with-pdo-pgsql \ --with-pdo-sqlite \ diff --git a/win32/build/config.w32 b/win32/build/config.w32 index ada6eba86cae4..3face08a8c2b5 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -449,9 +449,3 @@ if (PHP_STATIC_ANALYZE == "yes") { ADD_FLAG("CFLAGS", " /analyze "); ADD_FLAG("CFLAGS", " /wd6308 "); } - -ARG_ENABLE("zstrlen", "Include Z_STRLEN macros enabling size_t for string length", "no"); -if (PHP_ZSTRLEN == "yes") { - AC_DEFINE('ZEND_USE_LEGACY_STRING_TYPES', 1, ""); -} - diff --git a/win32/build/mkdist.php b/win32/build/mkdist.php index 23d26c9c53584..947af9fbe3a1c 100644 --- a/win32/build/mkdist.php +++ b/win32/build/mkdist.php @@ -238,6 +238,8 @@ function extract_file_from_tarball($pkg, $filename, $dest_dir) /* {{{ */ "php.ini-development" => "php.ini-development", "php.ini-production" => "php.ini-production", "win32/install.txt" => "install.txt", + "win32/pws-php5cgi.reg" => "pws-php5cgi.reg", + "win32/pws-php5isapi.reg" => "pws-php5isapi.reg", ); foreach ($text_files as $src => $dest) { diff --git a/win32/install.txt b/win32/install.txt index b240ad2723e4c..2883dd37f5732 100644 --- a/win32/install.txt +++ b/win32/install.txt @@ -9,7 +9,7 @@ Installing PHP Windows Installer Manual Installation Steps ActiveScript - Microsoft IIS + Microsoft IIS / PWS Apache 1.3.x on Microsoft Windows Apache 2.0.x on Microsoft Windows Sun, iPlanet and Netscape servers on Microsoft Windows @@ -211,7 +211,7 @@ Windows Installer (PHP 5.1.0 and earlier) The Windows PHP installer is available from the downloads page at http://www.php.net/downloads.php. This installs the CGI version of PHP - and for IIS and Xitami, it configures the web server as well. The + and for IIS, PWS, and Xitami, it configures the web server as well. The installer does not include any extra external PHP extensions (php_*.dll) as you'll only find those in the Windows Zip Package and PECL downloads. @@ -433,7 +433,7 @@ c:\php follow the next step. Set the doc_root to point to your web servers document_root. For example: -doc_root = c:\inetpub\wwwroot // for IIS +doc_root = c:\inetpub\wwwroot // for IIS/PWS doc_root = c:\apache\htdocs // for Apache @@ -442,6 +442,11 @@ doc_root = c:\apache\htdocs // for Apache what is already built in. Note that on a new installation it is advisable to first get PHP working and tested without any extensions before enabling them in php.ini. + * On PWS and IIS, you can set the browscap configuration setting to + point to: c:\windows\system\inetsrv\browscap.ini on Windows 9x/Me, + c:\winnt\system32\inetsrv\browscap.ini on NT/2000, and + c:\windows\system32\inetsrv\browscap.ini on XP. For an up-to-date + browscap.ini, read the following FAQ. PHP is now setup on your system. The next step is to choose a web server, and enable it to run PHP. Choose a web server from the table of @@ -494,7 +499,7 @@ ActiveScript folder, if you wish to load extensions, etc. __________________________________________________________________ -Microsoft IIS +Microsoft IIS / PWS This section contains notes and hints specific to IIS (Microsoft Internet Information Server). @@ -506,7 +511,7 @@ Microsoft IIS yourself from those attacks. __________________________________________________________________ -General considerations for all installations of PHP with IIS +General considerations for all installations of PHP with IIS or PWS * First, read the Manual Installation Instructions. Do not skip this step as it provides crucial information for installing PHP on @@ -538,7 +543,7 @@ General considerations for all installations of PHP with IIS downloaded in the "Collection of PECL modules" package. Files such as php_zip.dll and php_ssh2.dll. Download PHP files here. * When defining the executable, the 'check that file exists' box may - also be checked. For a small performance penalty, the IIS + also be checked. For a small performance penalty, the IIS (or PWS) will check that the script file exists and sort out authentication before firing up PHP. This means that the web server will provide sensible 404 style error messages instead of CGI errors complaining @@ -1574,7 +1579,7 @@ cgi error: 11. Windows: I've followed all the instructions, but still can't get PHP and IIS to work together! - 12. When running PHP as CGI with IIS, OmniHTTPD or Xitami, I get + 12. When running PHP as CGI with IIS, PWS, OmniHTTPD or Xitami, I get the following error: Security Alert! PHP CGI cannot be accessed directly.. @@ -1819,7 +1824,7 @@ cgi error: tell it that PHP is a script engine. Also, you will want to read this faq. - 12. When running PHP as CGI with IIS, OmniHTTPD or Xitami, I get + 12. When running PHP as CGI with IIS, PWS, OmniHTTPD or Xitami, I get the following error: Security Alert! PHP CGI cannot be accessed directly.. diff --git a/win32/pws-php5cgi.reg b/win32/pws-php5cgi.reg new file mode 100644 index 0000000000000..46edc77386496 --- /dev/null +++ b/win32/pws-php5cgi.reg @@ -0,0 +1,6 @@ +REGEDIT4 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map] +".php"="[PUT PATH HERE]\\php.exe" + + diff --git a/win32/pws-php5isapi.reg b/win32/pws-php5isapi.reg new file mode 100644 index 0000000000000..393604d28deed --- /dev/null +++ b/win32/pws-php5isapi.reg @@ -0,0 +1,5 @@ +REGEDIT4 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map] +".php"="[PUT PATH HERE]\\php5isapi.dll" + diff --git a/win32/registry.c b/win32/registry.c index f646a970bd6bf..685a09d084abd 100644 --- a/win32/registry.c +++ b/win32/registry.c @@ -90,7 +90,7 @@ static int LoadDirectory(HashTable *directories, HKEY key, char *path, int path_ } INIT_PZVAL(data); Z_STRVAL_P(data) = zend_strndup(value, value_len-1); - Z_STRSIZE_P(data) = value_len-1; + Z_STRLEN_P(data) = value_len-1; Z_TYPE_P(data) = IS_STRING; zend_hash_update(ht, name, name_len+1, &data, sizeof(zval*), NULL); } @@ -261,7 +261,7 @@ void UpdateIniFromRegistry(char *path TSRMLS_DC) zend_hash_get_current_data_ex(ht, (void**)&data, &pos) == SUCCESS && zend_hash_get_current_key_ex(ht, &index, &index_len, &num, 0, &pos) == HASH_KEY_IS_STRING; zend_hash_move_forward_ex(ht, &pos)) { - zend_alter_ini_entry(index, index_len, Z_STRVAL_PP(data), Z_STRSIZE_PP(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); + zend_alter_ini_entry(index, index_len, Z_STRVAL_PP(data), Z_STRLEN_PP(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); } break; } diff --git a/win32/select.c b/win32/select.c index 92af4be7b818f..d77ef3de00e10 100644 --- a/win32/select.c +++ b/win32/select.c @@ -36,7 +36,7 @@ * */ PHPAPI int php_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *tv) { - ULONGLONG ms_total, limit; + DWORD ms_total, limit; HANDLE handles[MAXIMUM_WAIT_OBJECTS]; int handle_slot_to_fd[MAXIMUM_WAIT_OBJECTS]; int n_handles = 0, i; @@ -97,7 +97,7 @@ PHPAPI int php_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, stru FD_ZERO(&awrite); FD_ZERO(&aexcept); - limit = GetTickCount64() + ms_total; + limit = GetTickCount() + ms_total; do { retcode = 0; @@ -149,7 +149,7 @@ PHPAPI int php_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, stru } } } - } while (retcode == 0 && (ms_total == INFINITE || GetTickCount64() < limit)); + } while (retcode == 0 && (ms_total == INFINITE || GetTickCount() < limit)); if (rfds) { *rfds = aread; diff --git a/win32/sendmail.c b/win32/sendmail.c index 93e68f4b1a421..3078307263601 100644 --- a/win32/sendmail.c +++ b/win32/sendmail.c @@ -409,7 +409,7 @@ static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char snprintf(Buffer, sizeof(Buffer), "HELO %s\r\n", LocalHost); - /* in the beginning of the dialog */ + /* in the beggining of the dialog */ /* attempt reconnect if the first Post fail */ if ((res = Post(Buffer)) != SUCCESS) { MailConnect(); diff --git a/win32/time.h b/win32/time.h index d5d86eb1ed781..f841a2b601fe3 100644 --- a/win32/time.h +++ b/win32/time.h @@ -50,6 +50,4 @@ PHPAPI extern int setitimer(int which, const struct itimerval *value, PHPAPI int nanosleep( const struct timespec * rqtp, struct timespec * rmtp ); -PHPAPI int usleep(unsigned int useconds); - #endif diff --git a/win32/winutil.c b/win32/winutil.c index 1f467c9864232..4afc28feca7db 100644 --- a/win32/winutil.c +++ b/win32/winutil.c @@ -34,7 +34,7 @@ PHPAPI char *php_win32_error_to_msg(int error) return (buf ? (char *) buf : ""); } -int php_win32_check_trailing_space(const char * path, const zend_str_size_int path_len) { +int php_win32_check_trailing_space(const char * path, const int path_len) { if (path_len < 1) { return 1; } diff --git a/win32/winutil.h b/win32/winutil.h index 3292174fc3868..8cf07ec286ffd 100644 --- a/win32/winutil.h +++ b/win32/winutil.h @@ -19,7 +19,7 @@ PHPAPI char *php_win32_error_to_msg(int error); #define php_win_err() php_win32_error_to_msg(GetLastError()) -int php_win32_check_trailing_space(const char * path, const zend_str_size_int path_len); +int php_win32_check_trailing_space(const char * path, const int path_len); PHPAPI php_win32_get_random_bytes(unsigned char *buf, size_t size); #ifdef ZTS