diff options
author | Anatol Belski <ab@php.net> | 2014-08-16 14:46:31 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-08-16 14:46:31 +0200 |
commit | 7534bf125a9d4f7dd31b66a1a9781b12dd749bcc (patch) | |
tree | e6c510917769d8e66ced1bba7ed6926e729a307d | |
parent | 1169de3e61975fe00fbf4768318eb095f22c63ec (diff) | |
download | php-git-7534bf125a9d4f7dd31b66a1a9781b12dd749bcc.tar.gz |
fix set_time_limit, substr and some more
-rw-r--r-- | ext/standard/array.c | 2 | ||||
-rw-r--r-- | ext/standard/html.c | 10 | ||||
-rw-r--r-- | ext/standard/string.c | 24 | ||||
-rw-r--r-- | main/main.c | 2 |
4 files changed, 20 insertions, 18 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index 6b37baaff2..72e473f26e 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -4432,7 +4432,7 @@ PHP_FUNCTION(array_map) RETVAL_NULL(); if (n_arrays == 1) { - ulong num_key; + php_uint_t num_key; zend_string *str_key; zval *zv; diff --git a/ext/standard/html.c b/ext/standard/html.c index cfc43313cf..97e121c02a 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -1443,6 +1443,7 @@ encode_amp: static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) { zend_string *str, *hint_charset = NULL; + char *default_charset; php_int_t flags = ENT_COMPAT; zend_string *replaced; zend_bool double_encode = 1; @@ -1462,9 +1463,9 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) #endif if (!hint_charset) { - hint_charset = get_default_charset(TSRMLS_C); + default_charset = get_default_charset(TSRMLS_C); } - 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); + replaced = php_escape_html_entities_ex((unsigned char*)str->val, str->len, all, (int) flags, (hint_charset ? hint_charset->val : default_charset), double_encode TSRMLS_CC); RETVAL_STR(replaced); } /* }}} */ @@ -1525,6 +1526,7 @@ PHP_FUNCTION(htmlspecialchars_decode) PHP_FUNCTION(html_entity_decode) { zend_string *str, *hint_charset = NULL; + char *default_charset; size_t new_len = 0; php_int_t quote_style = ENT_COMPAT; zend_string *replaced; @@ -1544,9 +1546,9 @@ PHP_FUNCTION(html_entity_decode) #endif if (!hint_charset) { - hint_charset = get_default_charset(TSRMLS_C); + default_charset = get_default_charset(TSRMLS_C); } - replaced = php_unescape_html_entities((unsigned char*)str->val, str->len, 1 /*all*/, quote_style, hint_charset->val TSRMLS_CC); + replaced = php_unescape_html_entities((unsigned char*)str->val, str->len, 1 /*all*/, quote_style, (hint_charset ? hint_charset->val : default_charset) TSRMLS_CC); if (replaced) { RETURN_STR(replaced); diff --git a/ext/standard/string.c b/ext/standard/string.c index f9403e9809..6dd6d5930e 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -283,10 +283,10 @@ PHP_FUNCTION(hex2bin) static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ */ { char *s11, *s22; - int len1, len2; + php_int_t len1, len2; php_int_t start = 0, len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ll", &s11, &len1, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ii", &s11, &len1, &s22, &len2, &start, &len) == FAILURE) { return; } @@ -2252,20 +2252,20 @@ PHP_FUNCTION(substr) if (argc > 2) { if ((l < 0 && -l > str->len)) { RETURN_FALSE; - } else if (l > str->len) { + } else if (l > (php_int_t)str->len) { l = str->len; } } else { l = str->len; } - if (f > str->len) { + if (f > (php_int_t)str->len) { RETURN_FALSE; } else if (f < 0 && -f > str->len) { f = 0; } - if (l < 0 && (l + str->len - f) < 0) { + if (l < 0 && (l + (php_int_t)str->len - f) < 0) { RETURN_FALSE; } @@ -2273,7 +2273,7 @@ PHP_FUNCTION(substr) * of the string */ if (f < 0) { - f = str->len + f; + f = (php_int_t)str->len + f; if (f < 0) { f = 0; } @@ -2283,17 +2283,17 @@ PHP_FUNCTION(substr) * needed to stop that many chars from the end of the string */ if (l < 0) { - l = (str->len - f) + l; + l = ((php_int_t)str->len - f) + l; if (l < 0) { l = 0; } } - if (f >= str->len) { + if (f >= (php_int_t)str->len) { RETURN_FALSE; } - if ((f + l) > str->len) { + if ((f + l) > (php_int_t)str->len) { l = str->len - f; } @@ -2418,7 +2418,7 @@ PHP_FUNCTION(substr_replace) } } else { /* str is array of strings */ zend_string *str_index = NULL; - ulong num_index; + php_uint_t num_index; int result_len; array_init(return_value); @@ -2815,7 +2815,7 @@ static int php_strtr_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ /* {{{ php_strtr_array */ static void php_strtr_array(zval *return_value, char *str, int slen, HashTable *pats TSRMLS_DC) { - ulong num_key; + php_uint_t num_key; zend_string *str_key; int len, pos, found; int num_keys = 0; @@ -3805,7 +3805,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit zval *subject, *search, *replace, *subject_entry, *zcount = NULL; zval result; zend_string *string_key; - ulong num_key; + php_uint_t num_key; int count = 0; int argc = ZEND_NUM_ARGS(); diff --git a/main/main.c b/main/main.c index 6b3f261a45..8f954706cf 100644 --- a/main/main.c +++ b/main/main.c @@ -1333,7 +1333,7 @@ PHP_FUNCTION(set_time_limit) int new_timeout_strlen; zend_string *key; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_timeout) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &new_timeout) == FAILURE) { return; } |