mirror of
https://github.com/php/php-src.git
synced 2025-08-17 14:38:49 +02:00
fix set_time_limit, substr and some more
This commit is contained in:
parent
1169de3e61
commit
7534bf125a
4 changed files with 20 additions and 18 deletions
|
@ -4432,7 +4432,7 @@ PHP_FUNCTION(array_map)
|
||||||
RETVAL_NULL();
|
RETVAL_NULL();
|
||||||
|
|
||||||
if (n_arrays == 1) {
|
if (n_arrays == 1) {
|
||||||
ulong num_key;
|
php_uint_t num_key;
|
||||||
zend_string *str_key;
|
zend_string *str_key;
|
||||||
zval *zv;
|
zval *zv;
|
||||||
|
|
||||||
|
|
|
@ -1443,6 +1443,7 @@ encode_amp:
|
||||||
static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all)
|
static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all)
|
||||||
{
|
{
|
||||||
zend_string *str, *hint_charset = NULL;
|
zend_string *str, *hint_charset = NULL;
|
||||||
|
char *default_charset;
|
||||||
php_int_t flags = ENT_COMPAT;
|
php_int_t flags = ENT_COMPAT;
|
||||||
zend_string *replaced;
|
zend_string *replaced;
|
||||||
zend_bool double_encode = 1;
|
zend_bool double_encode = 1;
|
||||||
|
@ -1462,9 +1463,9 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!hint_charset) {
|
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);
|
RETVAL_STR(replaced);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
@ -1525,6 +1526,7 @@ PHP_FUNCTION(htmlspecialchars_decode)
|
||||||
PHP_FUNCTION(html_entity_decode)
|
PHP_FUNCTION(html_entity_decode)
|
||||||
{
|
{
|
||||||
zend_string *str, *hint_charset = NULL;
|
zend_string *str, *hint_charset = NULL;
|
||||||
|
char *default_charset;
|
||||||
size_t new_len = 0;
|
size_t new_len = 0;
|
||||||
php_int_t quote_style = ENT_COMPAT;
|
php_int_t quote_style = ENT_COMPAT;
|
||||||
zend_string *replaced;
|
zend_string *replaced;
|
||||||
|
@ -1544,9 +1546,9 @@ PHP_FUNCTION(html_entity_decode)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!hint_charset) {
|
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) {
|
if (replaced) {
|
||||||
RETURN_STR(replaced);
|
RETURN_STR(replaced);
|
||||||
|
|
|
@ -283,10 +283,10 @@ PHP_FUNCTION(hex2bin)
|
||||||
static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ */
|
static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ */
|
||||||
{
|
{
|
||||||
char *s11, *s22;
|
char *s11, *s22;
|
||||||
int len1, len2;
|
php_int_t len1, len2;
|
||||||
php_int_t start = 0, len = 0;
|
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) {
|
&s22, &len2, &start, &len) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2252,20 +2252,20 @@ PHP_FUNCTION(substr)
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
if ((l < 0 && -l > str->len)) {
|
if ((l < 0 && -l > str->len)) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
} else if (l > str->len) {
|
} else if (l > (php_int_t)str->len) {
|
||||||
l = str->len;
|
l = str->len;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
l = str->len;
|
l = str->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f > str->len) {
|
if (f > (php_int_t)str->len) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
} else if (f < 0 && -f > str->len) {
|
} else if (f < 0 && -f > str->len) {
|
||||||
f = 0;
|
f = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l < 0 && (l + str->len - f) < 0) {
|
if (l < 0 && (l + (php_int_t)str->len - f) < 0) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2273,7 +2273,7 @@ PHP_FUNCTION(substr)
|
||||||
* of the string
|
* of the string
|
||||||
*/
|
*/
|
||||||
if (f < 0) {
|
if (f < 0) {
|
||||||
f = str->len + f;
|
f = (php_int_t)str->len + f;
|
||||||
if (f < 0) {
|
if (f < 0) {
|
||||||
f = 0;
|
f = 0;
|
||||||
}
|
}
|
||||||
|
@ -2283,17 +2283,17 @@ PHP_FUNCTION(substr)
|
||||||
* needed to stop that many chars from the end of the string
|
* needed to stop that many chars from the end of the string
|
||||||
*/
|
*/
|
||||||
if (l < 0) {
|
if (l < 0) {
|
||||||
l = (str->len - f) + l;
|
l = ((php_int_t)str->len - f) + l;
|
||||||
if (l < 0) {
|
if (l < 0) {
|
||||||
l = 0;
|
l = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f >= str->len) {
|
if (f >= (php_int_t)str->len) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((f + l) > str->len) {
|
if ((f + l) > (php_int_t)str->len) {
|
||||||
l = str->len - f;
|
l = str->len - f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2418,7 +2418,7 @@ PHP_FUNCTION(substr_replace)
|
||||||
}
|
}
|
||||||
} else { /* str is array of strings */
|
} else { /* str is array of strings */
|
||||||
zend_string *str_index = NULL;
|
zend_string *str_index = NULL;
|
||||||
ulong num_index;
|
php_uint_t num_index;
|
||||||
int result_len;
|
int result_len;
|
||||||
|
|
||||||
array_init(return_value);
|
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 */
|
/* {{{ php_strtr_array */
|
||||||
static void php_strtr_array(zval *return_value, char *str, int slen, HashTable *pats TSRMLS_DC)
|
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;
|
zend_string *str_key;
|
||||||
int len, pos, found;
|
int len, pos, found;
|
||||||
int num_keys = 0;
|
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 *subject, *search, *replace, *subject_entry, *zcount = NULL;
|
||||||
zval result;
|
zval result;
|
||||||
zend_string *string_key;
|
zend_string *string_key;
|
||||||
ulong num_key;
|
php_uint_t num_key;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int argc = ZEND_NUM_ARGS();
|
int argc = ZEND_NUM_ARGS();
|
||||||
|
|
||||||
|
|
|
@ -1333,7 +1333,7 @@ PHP_FUNCTION(set_time_limit)
|
||||||
int new_timeout_strlen;
|
int new_timeout_strlen;
|
||||||
zend_string *key;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue