version 1.1.1.2, 2012/05/29 12:34:40
|
version 1.1.1.4, 2014/06/15 20:03:49
|
Line 2
|
Line 2
|
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| PHP Version 5 | |
| PHP Version 5 | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Copyright (c) 1997-2012 The PHP Group | | | Copyright (c) 1997-2014 The PHP Group | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| This source file is subject to version 3.01 of the PHP license, | |
| This source file is subject to version 3.01 of the PHP license, | |
| that is bundled with this package in the file LICENSE, and is | |
| that is bundled with this package in the file LICENSE, and is | |
Line 2715 PHP_FUNCTION(mb_substr)
|
Line 2715 PHP_FUNCTION(mb_substr)
|
char *str, *encoding; |
char *str, *encoding; |
long from, len; |
long from, len; |
int mblen, str_len, encoding_len; |
int mblen, str_len, encoding_len; |
|
zval **z_len = NULL; |
mbfl_string string, result, *ret; |
mbfl_string string, result, *ret; |
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ls", &str, &str_len, &from, &len, &encoding, &encoding_len) == FAILURE) { | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|Zs", &str, &str_len, &from, &z_len, &encoding, &encoding_len) == FAILURE) { |
return; |
return; |
} |
} |
|
|
Line 2736 PHP_FUNCTION(mb_substr)
|
Line 2737 PHP_FUNCTION(mb_substr)
|
string.val = (unsigned char *)str; |
string.val = (unsigned char *)str; |
string.len = str_len; |
string.len = str_len; |
|
|
if (argc < 3) { | if (argc < 3 || Z_TYPE_PP(z_len) == IS_NULL) { |
len = str_len; |
len = str_len; |
|
} else { |
|
convert_to_long_ex(z_len); |
|
len = Z_LVAL_PP(z_len); |
} |
} |
|
|
/* measures length */ |
/* measures length */ |
Line 2788 PHP_FUNCTION(mb_strcut)
|
Line 2792 PHP_FUNCTION(mb_strcut)
|
char *encoding; |
char *encoding; |
long from, len; |
long from, len; |
int encoding_len; |
int encoding_len; |
|
zval **z_len = NULL; |
mbfl_string string, result, *ret; |
mbfl_string string, result, *ret; |
|
|
mbfl_string_init(&string); |
mbfl_string_init(&string); |
string.no_language = MBSTRG(language); |
string.no_language = MBSTRG(language); |
string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; |
string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; |
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ls", (char **)&string.val, (int **)&string.len, &from, &len, &encoding, &encoding_len) == FAILURE) { | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|Zs", (char **)&string.val, (int **)&string.len, &from, &z_len, &encoding, &encoding_len) == FAILURE) { |
return; |
return; |
} |
} |
|
|
Line 2806 PHP_FUNCTION(mb_strcut)
|
Line 2811 PHP_FUNCTION(mb_strcut)
|
} |
} |
} |
} |
|
|
if (argc < 3) { | if (argc < 3 || Z_TYPE_PP(z_len) == IS_NULL) { |
len = string.len; |
len = string.len; |
|
} else { |
|
convert_to_long_ex(z_len); |
|
len = Z_LVAL_PP(z_len); |
} |
} |
|
|
/* if "from" position is negative, count start position from the end |
/* if "from" position is negative, count start position from the end |