com php-src: Better test coverage: Zend/zend_API.c Zend/z end_exceptions.c Zend/zend_exceptions.h ext/pcre/ph p_pcre.c ext/pcre/php_pcre.h
ext/standard/file.c ext/standard/link.c ext/standard/md5.c ext/standar d/proc_open.c ext/standard/type.c ext/standard/uniqid .c main/output.c
main/php_output.h
| From: | Anatol Belski | Date: | Wed, 16 Oct 2013 09:26:33 +0000 |
| Subject: | com php-src: Better test coverage: Zend/zend_API.c Zend/z end_exceptions.c Zend/zend_exceptions.h ext/pcre/ph p_pcre.c ext/pcre/php_pcre.h ext/standard/file.c ext/standard/link.c ext/standard/md5.c ext/standar d/proc_open.c ext/standard/type.c ext/standard/uniqid .c main/output.c main/php_output.h |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73523@lists.php.net to get a copy of this message | ||
Commit: 6484eaf77ee80d43297e202b113ab3976f25a708
Author: Anthony Ferrara <ircmaxell@gmail.com> Tue, 2 Jul 2013 10:20:01 -0400
Committer: Anatol Belski <ab@php.net> Wed, 16 Oct 2013 02:26:33 -0700
Parents: e6f90ecc27f5d305a0e755da67db75da786f4568
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6484eaf77ee80d43297e202b113ab3976f25a708
Log:
Better test coverage
Changed paths:
M Zend/zend_API.c
M Zend/zend_exceptions.c
M Zend/zend_exceptions.h
M ext/pcre/php_pcre.c
M ext/pcre/php_pcre.h
M ext/standard/file.c
M ext/standard/link.c
M ext/standard/md5.c
M ext/standard/proc_open.c
M ext/standard/type.c
M ext/standard/uniqid.c
M main/output.c
M main/php_output.h
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 29d71bb..3df2772 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 145b48c..32c8927 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()) { const char *classname; - zend_uint 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, const char *format, ...) /* {{{ */ +zend_str_size_int zend_spprintf(char **message, zend_str_size_int max_len, const 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, const } /* }}} */ -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 81c8a1f..b135131 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, const char *format, ...); +zend_str_size_int zend_spprintf(char **message, zend_str_size_int max_len, const char *format, ...); END_EXTERN_C() diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 0516d74..7bc5427 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 db14ce3..4c3ec35 100644 --- a/ext/pcre/php_pcre.h +++ b/ext/pcre/php_pcre.h @@ -33,7 +33,7 @@ #include <locale.h> #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 74fa9fd..6935a2e 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 8da6395..80ca52b 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 7fea069..69bc71d 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 ceeadd6..f8ba3e5 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 19e8886..12fcd64 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 eac389c..993f42f 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 b80dc4b..4f9e76c 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 833bdde..488ce5d 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()
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 29d71bb..3df2772 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 145b48c..32c8927 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()) { const char *classname; - zend_uint 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, const char *format, ...) /* {{{ */ +zend_str_size_int zend_spprintf(char **message, zend_str_size_int max_len, const 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, const } /* }}} */ -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 81c8a1f..b135131 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, const char *format, ...); +zend_str_size_int zend_spprintf(char **message, zend_str_size_int max_len, const char *format, ...); END_EXTERN_C() diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 0516d74..7bc5427 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 db14ce3..4c3ec35 100644 --- a/ext/pcre/php_pcre.h +++ b/ext/pcre/php_pcre.h @@ -33,7 +33,7 @@ #include <locale.h> #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 74fa9fd..6935a2e 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 8da6395..80ca52b 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 7fea069..69bc71d 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 ceeadd6..f8ba3e5 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 19e8886..12fcd64 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 eac389c..993f42f 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 b80dc4b..4f9e76c 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 833bdde..488ce5d 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()