double d;
int type;
- if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), p, &d, -1)) == 0) {
+ if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), (zend_int_t *)p, &d, -1)) == 0) {
return "long";
} else if (type == IS_DOUBLE) {
if (c == 'L') {
zend_string *subject; /* String to match against */
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 */
+ php_int_t flags = 0; /* Match control flags */
+ php_int_t start_offset = 0; /* Where the new search starts */
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|z/ll", ®ex,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|z/ii", ®ex,
&subject, &subpats, &flags, &start_offset) == FAILURE) {
RETURN_FALSE;
}
*subject_entry,
*zcount = NULL;
int limit_val = -1;
- long limit = -1;
+ php_int_t limit = -1;
zend_string *result;
zend_string *string_key;
ulong num_key;
#ifndef FAST_ZPP
/* Get function parameters and do error-checking. */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz|lz/", ®ex, &replace, &subject, &limit, &zcount) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz|iz/", ®ex, &replace, &subject, &limit, &zcount) == FAILURE) {
return;
}
#else
static PHP_FUNCTION(preg_split)
{
zend_string *regex; /* Regular expression */
- zend_string *subject; /* String to match against */
- long limit_val = -1;/* Integer value of limit */
- long flags = 0; /* Match control flags */
+ zend_string *subject; /* String to match against */
+ php_int_t limit_val = -1;/* Integer value of limit */
+ php_int_t flags = 0; /* Match control flags */
pcre_cache_entry *pce; /* Compiled regular expression */
/* Get function parameters and do error checking */
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ll", ®ex,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ii", ®ex,
&subject, &subject_len, &limit_val, &flags) == FAILURE) {
RETURN_FALSE;
}
{
zend_string *regex; /* Regular expression */
zval *input; /* Input array */
- long flags = 0; /* Match control flags */
+ php_int_t flags = 0; /* Match control flags */
pcre_cache_entry *pce; /* Compiled regular expression */
/* Get arguments and do error checking */
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sa|l", ®ex,
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sa|i", ®ex,
&input, &flags) == FAILURE) {
return;
}
HashPosition pos;
zval *value;
zend_string *key;
- ulong num_index;
+ php_uint_t num_index;
zend_hash_internal_pointer_reset_ex(&ce->constants_table, &pos);
while ((prop = zend_hash_get_current_data_ptr_ex(properties, &pos)) != NULL) {
zend_string *prop_name;
- ulong index;
+ php_uint_t index;
if (zend_hash_get_current_key_ex(properties, &prop_name, &index, 0, &pos) == HASH_KEY_IS_STRING) {
if (prop_name->len && prop_name->val[0]) { /* skip all private and protected properties */
&& ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce))
{
zend_string *key;
- ulong num_index;
+ php_uint_t num_index;
uint len = mptr->common.function_name->len;
/* Do not display old-style inherited constructors */
static void _function_closure_string(string *str, zend_function *fptr, char* indent TSRMLS_DC)
{
zend_uint i, count;
- ulong num_index;
+ php_uint_t num_index;
zend_string *key;
HashTable *static_variables;
HashPosition pos;
zend_property_info *prop_info;
zval *prop, prop_copy;
zend_string *key;
- ulong num_index;
+ php_uint_t num_index;
ZEND_HASH_FOREACH_KEY_PTR(&ce->properties_info, num_index, key, prop_info) {
if (((prop_info->flags & ZEND_ACC_SHADOW) &&
zval array;
zval retval;
HashPosition pos;
- ulong pos_h;
+ php_uint_t pos_h;
int ar_flags;
int is_self;
zend_function *fptr_offset_get;
static int spl_array_skip_protected(spl_array_object *intern, HashTable *aht TSRMLS_DC) /* {{{ */
{
zend_string *string_key;
- ulong num_key;
+ php_uint_t num_key;
zval *data;
if (Z_TYPE(intern->array) == IS_OBJECT) {
PHPAPI long spl_offset_convert_to_int(zval *offset TSRMLS_DC) /* {{{ */
{
- ulong idx;
+ php_uint_t idx;
switch (Z_TYPE_P(offset)) {
case IS_STRING:
PHP_FUNCTION(count)
{
zval *array;
- long mode = COUNT_NORMAL;
+ php_int_t mode = COUNT_NORMAL;
php_int_t cnt;
zval *element;
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &array, &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &array, &mode) == FAILURE) {
return;
}
#else
*/
static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all)
{
- char *str, *hint_charset = NULL;
- int str_len, hint_charset_len = 0;
- long flags = ENT_COMPAT;
+ zend_string *str, *hint_charset = NULL;
+ php_int_t flags = ENT_COMPAT;
zend_string *replaced;
zend_bool double_encode = 1;
#ifndef FAST_ZPP
- 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|iS!b", &str, &flags, &hint_charset, &double_encode) == FAILURE) {
return;
}
#else
ZEND_PARSE_PARAMETERS_START(1, 4)
- Z_PARAM_STRING(str, str_len)
+ Z_PARAM_STR(str)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(flags)
- Z_PARAM_STRING_EX(hint_charset, hint_charset_len, 1, 0)
+ Z_PARAM_STR_EX(hint_charset, 1, 0)
Z_PARAM_BOOL(double_encode);
ZEND_PARSE_PARAMETERS_END();
#endif
if (!hint_charset) {
hint_charset = get_default_charset(TSRMLS_C);
}
- replaced = php_escape_html_entities_ex((unsigned char*)str, str_len, all, (int) flags, hint_charset, double_encode TSRMLS_CC);
+ replaced = php_escape_html_entities_ex((unsigned char*)str->val, str->len, all, (int) flags, (hint_charset ? hint_charset->val : NULL), double_encode TSRMLS_CC);
RETVAL_STR(replaced);
}
/* }}} */
Convert all HTML entities to their applicable characters */
PHP_FUNCTION(html_entity_decode)
{
- char *str, *hint_charset = NULL;
- int str_len, hint_charset_len = 0;
+ zend_string *str, *hint_charset = NULL;
size_t new_len = 0;
- long quote_style = ENT_COMPAT;
+ php_int_t quote_style = ENT_COMPAT;
zend_string *replaced;
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len,
- "e_style, &hint_charset, &hint_charset_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|iS", &str,
+ "e_style, &hint_charset) == FAILURE) {
return;
}
#else
ZEND_PARSE_PARAMETERS_START(1, 3)
- Z_PARAM_STRING(str, str_len)
+ Z_PARAM_STR(str)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(quote_style)
- Z_PARAM_STRING(hint_charset, hint_charset_len)
+ Z_PARAM_STR(hint_charset)
ZEND_PARSE_PARAMETERS_END();
#endif
if (!hint_charset) {
hint_charset = get_default_charset(TSRMLS_C);
}
- replaced = php_unescape_html_entities((unsigned char*)str, str_len, 1 /*all*/, quote_style, hint_charset TSRMLS_CC);
+ replaced = php_unescape_html_entities((unsigned char*)str->val, str->len, 1 /*all*/, quote_style, hint_charset->val TSRMLS_CC);
if (replaced) {
RETURN_STR(replaced);
PHP_FUNCTION(strpos)
{
zval *needle;
- char *haystack;
+ zend_string *haystack;
char *found = NULL;
char needle_char[2];
- long offset = 0;
- int haystack_len;
+ php_int_t offset = 0;
#ifndef FAST_ZPP
- 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|i", &haystack, &needle, &offset) == FAILURE) {
return;
}
#else
ZEND_PARSE_PARAMETERS_START(2, 3)
- Z_PARAM_STRING(haystack, haystack_len)
+ Z_PARAM_STR(haystack)
Z_PARAM_ZVAL(needle)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(offset)
ZEND_PARSE_PARAMETERS_END();
#endif
- if (offset < 0 || offset > haystack_len) {
+ if (offset < 0 || offset > haystack->len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string");
RETURN_FALSE;
}
RETURN_FALSE;
}
- found = (char*)php_memnstr(haystack + offset,
+ found = (char*)php_memnstr(haystack->val + offset,
Z_STRVAL_P(needle),
Z_STRSIZE_P(needle),
- haystack + haystack_len);
+ haystack->val + haystack->len);
} else {
if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) {
RETURN_FALSE;
}
needle_char[1] = 0;
- found = (char*)php_memnstr(haystack + offset,
+ found = (char*)php_memnstr(haystack->val + offset,
needle_char,
1,
- haystack + haystack_len);
+ haystack->val + haystack->len);
}
if (found) {
- RETURN_INT(found - haystack);
+ RETURN_INT(found - haystack->val);
} else {
RETURN_FALSE;
}
PHP_FUNCTION(strrpos)
{
zval *zneedle;
- char *needle, *haystack;
- int needle_len, haystack_len;
- long offset = 0;
+ char *needle;
+ zend_string *haystack;
+ php_size_t needle_len;
+ php_int_t offset = 0;
char *p, *e, ord_needle[2];
#ifndef FAST_ZPP
- 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|i", &haystack, &zneedle, &offset) == FAILURE) {
RETURN_FALSE;
}
#else
ZEND_PARSE_PARAMETERS_START(2, 3)
- Z_PARAM_STRING(haystack, haystack_len)
+ Z_PARAM_STR(haystack)
Z_PARAM_ZVAL(zneedle)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(offset)
needle_len = 1;
}
- if ((haystack_len == 0) || (needle_len == 0)) {
+ if ((haystack->len == 0) || (needle_len == 0)) {
RETURN_FALSE;
}
if (offset >= 0) {
- if (offset > haystack_len) {
+ if (offset > haystack->len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string");
RETURN_FALSE;
}
- p = haystack + offset;
- e = haystack + haystack_len - needle_len;
+ p = haystack->val + offset;
+ e = haystack->val + haystack->len - needle_len;
} else {
- if (offset < -INT_MAX || -offset > haystack_len) {
+ if (offset < -INT_MAX || -offset > haystack->len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string");
RETURN_FALSE;
}
- p = haystack;
+ p = haystack->val;
if (needle_len > -offset) {
- e = haystack + haystack_len - needle_len;
+ e = haystack->val + haystack->len - needle_len;
} else {
- e = haystack + haystack_len + offset;
+ e = haystack->val + haystack->len + offset;
}
}
PHP_FUNCTION(intval)
{
zval *num;
- long base = 10;
+ php_int_t base = 10;
if (ZEND_NUM_ARGS() != 1 && ZEND_NUM_ARGS() != 2) {
WRONG_PARAM_COUNT;
}
#ifndef FAST_ZPP
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &num, &base) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &num, &base) == FAILURE) {
return;
}
#else
}
/* read until a boundary condition */
-static int multipart_buffer_read(multipart_buffer *self, char *buf, int bytes, int *end TSRMLS_DC)
+static int multipart_buffer_read(multipart_buffer *self, char *buf, php_size_t bytes, int *end TSRMLS_DC)
{
- int len, max;
+ php_size_t len, max;
char *bound;
/* fill buffer if needed */
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, php_size_t *len TSRMLS_DC)
{
char buf[FILLUNIT], *out=NULL;
int total_bytes=0, read_bytes=0;