[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
tony2001Wed May 27 13:42:00 2009 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: fix compile warnings http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.322r2=1.323diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.322 php-src/ext/mbstring/mbstring.c:1.323 --- php-src/ext/mbstring/mbstring.c:1.322 Sun May 10 21:04:26 2009 +++ php-src/ext/mbstring/mbstring.c Wed May 27 13:42:00 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.322 2009/05/10 21:04:26 jani Exp $ */ +/* $Id: mbstring.c,v 1.323 2009/05/27 13:42:00 tony2001 Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -98,10 +98,12 @@ static PHP_GINIT_FUNCTION(mbstring); static PHP_GSHUTDOWN_FUNCTION(mbstring); +#ifdef ZEND_MULTIBYTE static size_t php_mb_oddlen(const unsigned char *string, size_t length, const char *encoding TSRMLS_DC); static int php_mb_encoding_converter(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const char *encoding_to, const char *encoding_from TSRMLS_DC); static char* php_mb_encoding_detector(const unsigned char *arg_string, size_t arg_length, char *arg_list TSRMLS_DC); static int php_mb_set_zend_encoding(TSRMLS_D); +#endif /* }}} */ /* {{{ php_mb_default_identify_list */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c /ext/mbstring/tests zend_multibyte-01.phpt zend_multibyte-02.phpt zend_multibyte-03.phpt zend_multibyte-04.phpt zend_multibyte-05.phpt zend_multibyte-0
janiSun May 10 21:04:26 2009 UTC Modified files: /php-src/ext/mbstring mbstring.c /php-src/ext/mbstring/tests zend_multibyte-01.phpt zend_multibyte-02.phpt zend_multibyte-03.phpt zend_multibyte-04.phpt zend_multibyte-05.phpt zend_multibyte-06.phpt zend_multibyte-07.phpt zend_multibyte-08.phpt zend_multibyte-09.phpt zend_multibyte-10.phpt zend_multibyte-11.phpt zend_multibyte-12.phpt zend_multibyte-13.phpt zend_multibyte-14.phpt Log: - Fixed bug #48200 (compile failure with mbstring.c when --enable-zend-multibyte is used) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.321r2=1.322diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.321 php-src/ext/mbstring/mbstring.c:1.322 --- php-src/ext/mbstring/mbstring.c:1.321 Mon Apr 20 17:06:00 2009 +++ php-src/ext/mbstring/mbstring.c Sun May 10 21:04:26 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.321 2009/04/20 17:06:00 jani Exp $ */ +/* $Id: mbstring.c,v 1.322 2009/05/10 21:04:26 jani Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -94,8 +94,14 @@ /* {{{ prototypes */ ZEND_DECLARE_MODULE_GLOBALS(mbstring) + static PHP_GINIT_FUNCTION(mbstring); static PHP_GSHUTDOWN_FUNCTION(mbstring); + +static size_t php_mb_oddlen(const unsigned char *string, size_t length, const char *encoding TSRMLS_DC); +static int php_mb_encoding_converter(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const char *encoding_to, const char *encoding_from TSRMLS_DC); +static char* php_mb_encoding_detector(const unsigned char *arg_string, size_t arg_length, char *arg_list TSRMLS_DC); +static int php_mb_set_zend_encoding(TSRMLS_D); /* }}} */ /* {{{ php_mb_default_identify_list */ @@ -866,7 +872,7 @@ #if HAVE_ONIG /* {{{ _php_mb_compile_regex */ -void *_php_mb_compile_regex(const char *pattern TSRMLS_DC) +static void *_php_mb_compile_regex(const char *pattern TSRMLS_DC) { php_mb_regex_t *retval; OnigErrorInfo err_info; @@ -887,7 +893,7 @@ /* }}} */ /* {{{ _php_mb_match_regex */ -int _php_mb_match_regex(void *opaque, const char *str, size_t str_len) +static int _php_mb_match_regex(void *opaque, const char *str, size_t str_len) { return onig_search((php_mb_regex_t *)opaque, (const OnigUChar *)str, (const OnigUChar*)str + str_len, (const OnigUChar *)str, @@ -896,14 +902,14 @@ /* }}} */ /* {{{ _php_mb_free_regex */ -void _php_mb_free_regex(void *opaque) +static void _php_mb_free_regex(void *opaque) { onig_free((php_mb_regex_t *)opaque); } /* }}} */ #elif HAVE_PCRE || HAVE_BUNDLED_PCRE /* {{{ _php_mb_compile_regex */ -void *_php_mb_compile_regex(const char *pattern TSRMLS_DC) +static void *_php_mb_compile_regex(const char *pattern TSRMLS_DC) { pcre *retval; const char *err_str; @@ -918,7 +924,7 @@ /* }}} */ /* {{{ _php_mb_match_regex */ -int _php_mb_match_regex(void *opaque, const char *str, size_t str_len) +static int _php_mb_match_regex(void *opaque, const char *str, size_t str_len) { return pcre_exec((pcre *)opaque, NULL, str, (int)str_len, 0, 0, NULL, 0) = 0; @@ -926,7 +932,7 @@ /* }}} */ /* {{{ _php_mb_free_regex */ -void _php_mb_free_regex(void *opaque) +static void _php_mb_free_regex(void *opaque) { pcre_free(opaque); } @@ -4714,7 +4720,6 @@ /* }}} */ #ifdef ZEND_MULTIBYTE - /* {{{ php_mb_set_zend_encoding() */ static int php_mb_set_zend_encoding(TSRMLS_D) { @@ -4806,9 +4811,7 @@ /* }}} */ /* {{{ int php_mb_encoding_converter() */ -static int php_mb_encoding_converter(unsigned char **to, size_t *to_length, - const unsigned char *from, size_t from_length, - const char *encoding_to, const char *encoding_from TSRMLS_DC) +static int php_mb_encoding_converter(unsigned char **to, size_t *to_length, const unsigned char *from, size_t from_length, const char *encoding_to, const char *encoding_from TSRMLS_DC) { mbfl_string string, result, *ret; enum mbfl_no_encoding from_encoding, to_encoding; http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/zend_multibyte-01.phpt?r1=1.1r2=1.2diff_format=u Index: php-src/ext/mbstring/tests/zend_multibyte-01.phpt diff -u /dev/null php-src/ext/mbstring/tests/zend_multibyte-01.phpt:1.2 --- /dev/null Sun May 10 21:04:26 2009 +++
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
iliaa Fri Mar 6 15:48:55 2009 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: MFB: Improve parameter parsing code http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.317r2=1.318diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.317 php-src/ext/mbstring/mbstring.c:1.318 --- php-src/ext/mbstring/mbstring.c:1.317 Tue Feb 17 16:28:33 2009 +++ php-src/ext/mbstring/mbstring.c Fri Mar 6 15:48:54 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.317 2009/02/17 16:28:33 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.318 2009/03/06 15:48:54 iliaa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2117,7 +2117,7 @@ mbfl_string haystack, needle; char *enc_name = NULL; int enc_name_len; - zval **zoffset; + zval **zoffset = NULL; long offset = 0, str_flg; char *enc_name2 = NULL; int enc_name_len2; @@ -2133,7 +2133,7 @@ RETURN_FALSE; } - if(ZEND_NUM_ARGS() = 3) { + if (zoffset) { if (Z_TYPE_PP(zoffset) == IS_STRING) { enc_name2 = Z_STRVAL_PP(zoffset); enc_name_len2 = Z_STRLEN_PP(zoffset); @@ -2161,9 +2161,9 @@ } } - if(str_flg) { - convert_to_long_ex(zoffset); - offset = Z_LVAL_PP(zoffset); + if (str_flg) { + convert_to_long_ex(zoffset); + offset = Z_LVAL_PP(zoffset); } else { enc_name = enc_name2; enc_name_len = enc_name_len2; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c /ext/mbstring/tests mb_get_info.phpt
moriyoshi Tue Feb 17 16:28:33 2009 UTC Added files: /php-src/ext/mbstring/tests mb_get_info.phpt Modified files: /php-src/ext/mbstring mbstring.c Log: - Add an entry for http_output_conv_mimetypes to the output of mb_get_info(). http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.316r2=1.317diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.316 php-src/ext/mbstring/mbstring.c:1.317 --- php-src/ext/mbstring/mbstring.c:1.316 Sun Feb 15 07:04:06 2009 +++ php-src/ext/mbstring/mbstring.c Tue Feb 17 16:28:33 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.316 2009/02/15 07:04:06 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.317 2009/02/17 16:28:33 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -4152,6 +4152,9 @@ if ((name = (char *)mbfl_no_encoding2name(MBSTRG(current_http_output_encoding))) != NULL) { add_assoc_string(return_value, http_output, name, 1); } + if ((name = (char *)zend_ini_string(mbstring.http_output_conv_mimetypes, sizeof(mbstring.http_output_conv_mimetypes), 0)) != NULL) { + add_assoc_string(return_value, http_output_conv_mimetypes, name, 1); + } add_assoc_long(return_value, func_overload, MBSTRG(func_overload)); if (MBSTRG(func_overload)){ over_func = (mb_ovld[0]); @@ -4243,6 +4246,10 @@ if ((name = (char *)mbfl_no_encoding2name(MBSTRG(current_http_output_encoding))) != NULL) { RETVAL_STRING(name, 1); } + } else if (!strcasecmp(http_output_conv_mimetypes, typ)) { + if ((name = (char *)zend_ini_string(mbstring.http_output_conv_mimetypes, sizeof(mbstring.http_output_conv_mimetypes), 0)) != NULL) { + RETVAL_STRING(name, 1); + } } else if (!strcasecmp(func_overload, typ)) { RETVAL_LONG(MBSTRG(func_overload)); } else if (!strcasecmp(func_overload_list, typ)) { http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_get_info.phpt?view=markuprev=1.1 Index: php-src/ext/mbstring/tests/mb_get_info.phpt +++ php-src/ext/mbstring/tests/mb_get_info.phpt --TEST-- Test mb_get_info() function --SKIPIF-- ?php extension_loaded('mbstring') or die('skip'); ? --INI-- mbstring.encoding_translation=1 mbstring.language=Korean mbstring.internal_encoding=UTF-8 mbstring.http_input=ISO-8859-1 mbstring.http_output=ISO-8859-15 mbstring.http_output_conv_mimetypes=abc mbstring.func_overload=2 mbstring.detect_order=UTF-8,ISO-8859-15,ISO-8859-1,ASCII mbstring.substitute_character=123 mbstring.strict_detection=1 --FILE-- ?php mb_parse_str(abc=def, $dummy); mb_convert_encoding(\xff\xff, Shift_JIS, UCS-2BE); $result = mb_get_info(); var_dump($result); foreach (array_keys($result) as $key) { var_dump($result[$key], mb_get_info($key)); } ? --EXPECT-- array(15) { [internal_encoding]= string(5) UTF-8 [http_input]= string(10) ISO-8859-1 [http_output]= string(11) ISO-8859-15 [http_output_conv_mimetypes]= string(3) abc [func_overload]= int(2) [func_overload_list]= array(12) { [strlen]= string(9) mb_strlen [strpos]= string(9) mb_strpos [strrpos]= string(10) mb_strrpos [stripos]= string(10) mb_stripos [strripos]= string(11) mb_strripos [strstr]= string(9) mb_strstr [strrchr]= string(10) mb_strrchr [stristr]= string(10) mb_stristr [substr]= string(9) mb_substr [strtolower]= string(13) mb_strtolower [strtoupper]= string(13) mb_strtoupper [substr_count]= string(15) mb_substr_count } [mail_charset]= string(11) ISO-2022-KR [mail_header_encoding]= string(6) BASE64 [mail_body_encoding]= string(4) 7bit [illegal_chars]= int(1) [encoding_translation]= string(2) On [language]= string(6) Korean [detect_order]= array(4) { [0]= string(5) UTF-8 [1]= string(11) ISO-8859-15 [2]= string(10) ISO-8859-1 [3]= string(5) ASCII } [substitute_character]= int(123) [strict_detection]= string(2) On } string(5) UTF-8 string(5) UTF-8 string(10) ISO-8859-1 string(10) ISO-8859-1 string(11) ISO-8859-15 string(11) ISO-8859-15 string(3) abc string(3) abc int(2) int(2) array(12) { [strlen]= string(9) mb_strlen [strpos]= string(9) mb_strpos [strrpos]= string(10) mb_strrpos [stripos]= string(10) mb_stripos [strripos]= string(11) mb_strripos [strstr]= string(9) mb_strstr [strrchr]= string(10) mb_strrchr [stristr]= string(10) mb_stristr [substr]= string(9) mb_substr [strtolower]= string(13) mb_strtolower [strtoupper]= string(13) mb_strtoupper [substr_count]=
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c /ext/mbstring/libmbfl/mbfl mbfilter.c /ext/mbstring/tests bug43840.phpt bug43841.phpt mb_stripos_variation2.phpt mb_stripos_variation3.phpt mb_stripos
moriyoshi Sun Feb 15 07:04:07 2009 UTC Modified files: /php-src/ext/mbstring mbstring.c /php-src/ext/mbstring/libmbfl/mbfl mbfilter.c /php-src/ext/mbstring/tests bug43840.phpt bug43841.phpt mb_stripos_variation2.phpt mb_stripos_variation3.phpt mb_stripos_variation5_Bug45923.phpt mb_stristr_variation2.phpt mb_strpos_variation2.phpt mb_strpos_variation3.phpt mb_strpos_variation5.phpt mb_strripos_variation3_Bug45923.phpt mb_strripos_variation5_Bug45923.phpt mb_strrpos_variation3.phpt mb_strrpos_variation5.phpt mb_strstr_variation2.phpt mb_substr_count_variation2.phpt Log: - Refix bug #43840. - Fix bug #43841. - Remove redundant trailing dots from the error messages. - Fix tests. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.315r2=1.316diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.315 php-src/ext/mbstring/mbstring.c:1.316 --- php-src/ext/mbstring/mbstring.c:1.315 Sat Feb 14 07:33:41 2009 +++ php-src/ext/mbstring/mbstring.c Sun Feb 15 07:04:06 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.315 2009/02/14 07:33:41 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.316 2009/02/15 07:04:06 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2080,7 +2080,7 @@ RETURN_FALSE; } if (needle.len == 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty delimiter.); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty delimiter); RETURN_FALSE; } @@ -2223,7 +2223,7 @@ RETURN_FALSE; } if (needle.len == 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty delimiter.); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty delimiter); RETURN_FALSE; } n = php_mb_stripos(0, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding TSRMLS_CC); @@ -2292,7 +2292,7 @@ } if (needle.len = 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING,Empty delimiter.); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty delimiter); RETURN_FALSE; } n = mbfl_strpos(haystack, needle, 0, 0); @@ -2402,7 +2402,7 @@ } if (!needle.len) { - php_error_docref(NULL TSRMLS_CC, E_WARNING,Empty delimiter.); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty delimiter); RETURN_FALSE; } @@ -2521,7 +2521,7 @@ } if (needle.len = 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING,Empty substring.); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty substring); RETURN_FALSE; } http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c?r1=1.18r2=1.19diff_format=u Index: php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c diff -u php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.18 php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.19 --- php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.18 Sat Feb 14 08:15:46 2009 +++ php-src/ext/mbstring/libmbfl/mbfl/mbfilter.cSun Feb 15 07:04:07 2009 @@ -778,7 +778,7 @@ for (;;) { pc-found_pos++; p = h; - m = pc-needle.buffer; + m = (int *)pc-needle.buffer; n = pc-needle_pos - 1; while (n 0 *p == *m) { n--; @@ -857,87 +857,203 @@ int offset, int reverse) { - int n, result, negative_offset = 0; - unsigned char *p; - mbfl_convert_filter *filter; - struct collector_strpos_data pc; + int result; + mbfl_string _haystack_u8, _needle_u8; + const mbfl_string *haystack_u8, *needle_u8; + const unsigned char *u8_tbl; - if (haystack == NULL || needle == NULL) { + if (haystack == NULL || haystack-val == NULL || needle == NULL || needle-val == NULL) { return -8; } - /* needle is converted into wchar */ - mbfl_wchar_device_init(pc.needle); - filter = mbfl_convert_filter_new( - needle-no_encoding, - mbfl_no_encoding_wchar, - mbfl_wchar_device_output, 0,
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h /ext/mbstring/libmbfl/mbfl mbfilter.c /ext/mbstring/tests bug45923.phpt
moriyoshi Sat Feb 14 07:33:41 2009 UTC Added files: /php-src/ext/mbstring/tests bug45923.phpt Modified files: /php-src/ext/mbstring mbstring.c mbstring.h /php-src/ext/mbstring/libmbfl/mbfl mbfilter.c Log: - Fix Bug #45923 (mb_st[r]ripos() offset not handled correctly) # test still fails because of the difference of str[r]pos() behavior between 5.3 and 6.0. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.314r2=1.315diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.314 php-src/ext/mbstring/mbstring.c:1.315 --- php-src/ext/mbstring/mbstring.c:1.314 Wed Feb 11 14:26:53 2009 +++ php-src/ext/mbstring/mbstring.c Sat Feb 14 07:33:41 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.314 2009/02/11 14:26:53 iliaa Exp $ */ +/* $Id: mbstring.c,v 1.315 2009/02/14 07:33:41 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2075,8 +2075,8 @@ } } - if (offset 0 || (unsigned long)offset haystack.len) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Offset not contained in string.); + if (offset 0 || offset mbfl_strlen(haystack)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Offset not contained in string); RETURN_FALSE; } if (needle.len == 0) { @@ -2092,17 +2092,17 @@ case 1: break; case 2: - php_error_docref(NULL TSRMLS_CC, E_WARNING, Needle has not positive length.); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Needle has not positive length); break; case 4: - php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown encoding or conversion error.); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown encoding or conversion error); break; case 8: - php_error_docref(NULL TSRMLS_CC, E_NOTICE, Argument is empty.); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, Argument is empty); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown error in mb_strpos.); - break; + php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown error in mb_strpos); + break; } RETVAL_FALSE; } @@ -2188,6 +2188,16 @@ if (needle.len = 0) { RETURN_FALSE; } + + { + int haystack_char_len = mbfl_strlen(haystack); + if ((offset 0 offset haystack_char_len) || + (offset 0 -offset haystack_char_len)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Offset is greater than the length of haystack string); + RETURN_FALSE; + } + } + n = mbfl_strpos(haystack, needle, offset, 1); if (n = 0) { RETVAL_LONG(n); @@ -2242,10 +2252,6 @@ RETURN_FALSE; } - if ((unsigned int)offset haystack.len) { - RETURN_FALSE; - } - n = php_mb_stripos(1, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding TSRMLS_CC); if (n = 0) { @@ -4636,7 +4642,7 @@ /* {{{ MBSTRING_API int php_mb_stripos() */ -MBSTRING_API int php_mb_stripos(int mode, const char *old_haystack, unsigned int old_haystack_len, const char *old_needle, unsigned int old_needle_len, unsigned int offset, const char *from_encoding TSRMLS_DC) +MBSTRING_API int php_mb_stripos(int mode, const char *old_haystack, unsigned int old_haystack_len, const char *old_needle, unsigned int old_needle_len, long offset, const char *from_encoding TSRMLS_DC) { int n; mbfl_string haystack, needle; @@ -4679,9 +4685,21 @@ break; } - if (offset 0 || offset haystack.len) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Offset not contained in string.); - break; + { + int haystack_char_len = mbfl_strlen(haystack); + + if (mode) { + if ((offset 0 offset haystack_char_len) || + (offset 0 -offset haystack_char_len)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Offset is greater than the length of haystack string); + break; + } + } else { +
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
iliaa Wed Feb 11 14:26:53 2009 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: MFB: Improved param parsing http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.313r2=1.314diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.313 php-src/ext/mbstring/mbstring.c:1.314 --- php-src/ext/mbstring/mbstring.c:1.313 Mon Feb 9 15:34:23 2009 +++ php-src/ext/mbstring/mbstring.c Wed Feb 11 14:26:53 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.313 2009/02/09 15:34:23 iliaa Exp $ */ +/* $Id: mbstring.c,v 1.314 2009/02/11 14:26:53 iliaa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1721,17 +1721,16 @@ Sets the current detect_order or Return the current detect_order as a array */ PHP_FUNCTION(mb_detect_order) { - size_t argc = ZEND_NUM_ARGS(); - zval **arg1; + zval **arg1 = NULL; int n, size; enum mbfl_no_encoding *list, *entry; char *name; - if (zend_parse_parameters(argc TSRMLS_CC, |Z, arg1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |Z, arg1) == FAILURE) { return; } - if (argc == 0) { + if (!arg1) { array_init(return_value); entry = MBSTRG(current_detect_order_list); n = MBSTRG(current_detect_order_list_size); @@ -1784,13 +1783,13 @@ Sets the current substitute_character or returns the current substitute_character */ PHP_FUNCTION(mb_substitute_character) { - zval **arg1; + zval **arg1 = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |Z, arg1) == FAILURE) { return; } - if (ZEND_NUM_ARGS() == 0) { + if (!arg1) { if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { RETURN_STRING(none, 1); } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
iliaa Mon Feb 9 15:34:23 2009 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: MFB: Initialize optional var http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.312r2=1.313diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.312 php-src/ext/mbstring/mbstring.c:1.313 --- php-src/ext/mbstring/mbstring.c:1.312 Thu Jan 29 23:01:40 2009 +++ php-src/ext/mbstring/mbstring.c Mon Feb 9 15:34:23 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.312 2009/01/29 23:01:40 scottmac Exp $ */ +/* $Id: mbstring.c,v 1.313 2009/02/09 15:34:23 iliaa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1873,7 +1873,7 @@ Parses GET/POST/COOKIE data and sets global variables */ PHP_FUNCTION(mb_parse_str) { - zval *track_vars_array; + zval *track_vars_array = NULL; char *encstr = NULL; int encstr_len; php_mb_encoding_handler_info_t info; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
scottmacThu Jan 29 23:01:49 2009 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: MFB Fix bug #47245 - Double free in mb_detect_encoding() http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.311r2=1.312diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.311 php-src/ext/mbstring/mbstring.c:1.312 --- php-src/ext/mbstring/mbstring.c:1.311 Mon Jan 5 09:16:38 2009 +++ php-src/ext/mbstring/mbstring.c Thu Jan 29 23:01:40 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.311 2009/01/05 09:16:38 tony2001 Exp $ */ +/* $Id: mbstring.c,v 1.312 2009/01/29 23:01:40 scottmac Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3018,6 +3018,7 @@ if (!php_mb_parse_encoding_array(encoding_list, list, size, 0 TSRMLS_CC)) { if (list) { efree(list); + list = NULL; size = 0; } } @@ -3027,6 +3028,7 @@ if (!php_mb_parse_encoding_list(Z_STRVAL_P(encoding_list), Z_STRLEN_P(encoding_list), list, size, 0 TSRMLS_CC)) { if (list) { efree(list); + list = NULL; size = 0; } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
tony2001Mon Jan 5 09:16:38 2009 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: MFB: fix memleaks correctly and make valgrind happy http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.310r2=1.311diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.310 php-src/ext/mbstring/mbstring.c:1.311 --- php-src/ext/mbstring/mbstring.c:1.310 Wed Dec 31 11:12:32 2008 +++ php-src/ext/mbstring/mbstring.c Mon Jan 5 09:16:38 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.310 2008/12/31 11:12:32 sebastian Exp $ */ +/* $Id: mbstring.c,v 1.311 2009/01/05 09:16:38 tony2001 Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1722,12 +1722,12 @@ PHP_FUNCTION(mb_detect_order) { size_t argc = ZEND_NUM_ARGS(); - zval *arg1; + zval **arg1; int n, size; enum mbfl_no_encoding *list, *entry; char *name; - if (zend_parse_parameters(argc TSRMLS_CC, |z, arg1) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, |Z, arg1) == FAILURE) { return; } @@ -1746,9 +1746,9 @@ } else { list = NULL; size = 0; - switch (Z_TYPE_P(arg1)) { + switch (Z_TYPE_PP(arg1)) { case IS_ARRAY: - if (!php_mb_parse_encoding_array(arg1, list, size, 0 TSRMLS_CC)) { + if (!php_mb_parse_encoding_array(*arg1, list, size, 0 TSRMLS_CC)) { if (list) { efree(list); } @@ -1756,15 +1756,13 @@ } break; default: - convert_to_string_ex(arg1); - if (!php_mb_parse_encoding_list(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), list, size, 0 TSRMLS_CC)) { + convert_to_string_ex(arg1); + if (!php_mb_parse_encoding_list(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1), list, size, 0 TSRMLS_CC)) { if (list) { efree(list); } - zval_ptr_dtor(arg1); RETURN_FALSE; } - zval_ptr_dtor(arg1); break; } @@ -1786,9 +1784,9 @@ Sets the current substitute_character or returns the current substitute_character */ PHP_FUNCTION(mb_substitute_character) { - zval *arg1; + zval **arg1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |z, arg1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |Z, arg1) == FAILURE) { return; } @@ -1805,36 +1803,32 @@ } else { RETVAL_TRUE; - switch (Z_TYPE_P(arg1)) { + switch (Z_TYPE_PP(arg1)) { case IS_STRING: - if (strncasecmp(none, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) { + if (strncasecmp(none, Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1)) == 0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE; - } else if (strncasecmp(long, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) { + } else if (strncasecmp(long, Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1)) == 0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG; - } else if (strncasecmp(entity, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) { + } else if (strncasecmp(entity, Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1)) == 0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY; } else { - convert_to_long_ex(arg1); + convert_to_long_ex(arg1); - if (Z_LVAL_P(arg1) 0x Z_LVAL_P(arg1) 0x0) { + if (Z_LVAL_PP(arg1) 0x Z_LVAL_PP(arg1) 0x0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; - MBSTRG(current_filter_illegal_substchar) = Z_LVAL_P(arg1); - zval_ptr_dtor(arg1); + MBSTRG(current_filter_illegal_substchar) = Z_LVAL_PP(arg1); } else { - zval_ptr_dtor(arg1); php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown character.);
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c /ext/mbstring/tests mb_stristr_variation1.phpt mb_stristr_variation2.phpt
felipe Tue Dec 30 02:12:45 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c /php-src/ext/mbstring/tests mb_stristr_variation1.phpt mb_stristr_variation2.phpt Log: - Bug #46763 (mb_stristr() wrong output when needle does not exist) (patch by Henrique M. Decaria) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.308r2=1.309diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.308 php-src/ext/mbstring/mbstring.c:1.309 --- php-src/ext/mbstring/mbstring.c:1.308 Sat Dec 27 13:31:07 2008 +++ php-src/ext/mbstring/mbstring.c Tue Dec 30 02:12:43 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.308 2008/12/27 13:31:07 felipe Exp $ */ +/* $Id: mbstring.c,v 1.309 2008/12/30 02:12:43 felipe Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2386,7 +2386,8 @@ PHP_FUNCTION(mb_stristr) { zend_bool part = 0; - unsigned int n, from_encoding_len, len, mblen; + unsigned int from_encoding_len, len, mblen; + int n; mbfl_string haystack, needle, result, *ret = NULL; const char *from_encoding = mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); mbfl_string_init(haystack); http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_stristr_variation1.phpt?r1=1.2r2=1.3diff_format=u Index: php-src/ext/mbstring/tests/mb_stristr_variation1.phpt diff -u php-src/ext/mbstring/tests/mb_stristr_variation1.phpt:1.2 php-src/ext/mbstring/tests/mb_stristr_variation1.phpt:1.3 --- php-src/ext/mbstring/tests/mb_stristr_variation1.phpt:1.2 Fri Dec 5 13:13:14 2008 +++ php-src/ext/mbstring/tests/mb_stristr_variation1.phpt Tue Dec 30 02:12:44 2008 @@ -122,31 +122,31 @@ *** Testing mb_stristr() : usage variation *** --int 0-- -string(0) +bool(false) --int 1-- -string(0) +bool(false) --int 12345-- -string(0) +bool(false) --int -12345-- -string(0) +bool(false) --float 10.5-- -string(0) +bool(false) --float -10.5-- -string(0) +bool(false) --float 12.3456789000e10-- -string(0) +bool(false) --float -12.3456789000e10-- -string(0) +bool(false) --float .5-- -string(0) +bool(false) --empty array-- Error: 2 - mb_stristr() expects parameter 1 to be binary string, array given, %s(%d) @@ -165,41 +165,41 @@ bool(false) --uppercase NULL-- -string(0) +bool(false) --lowercase null-- -string(0) +bool(false) --lowercase true-- -string(0) +bool(false) --lowercase false-- -string(0) +bool(false) --uppercase TRUE-- -string(0) +bool(false) --uppercase FALSE-- -string(0) +bool(false) --empty string DQ-- -string(0) +bool(false) --empty string SQ-- -string(0) +bool(false) --instance of classWithToString-- -string(0) +bool(false) --instance of classWithoutToString-- Error: 2 - mb_stristr() expects parameter 1 to be binary string, object given, %s(%d) bool(false) --undefined var-- -string(0) +bool(false) --unset var-- -string(0) +bool(false) --resource-- Error: 2 - mb_stristr() expects parameter 1 to be binary string, resource given, %s(%d) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_stristr_variation2.phpt?r1=1.2r2=1.3diff_format=u Index: php-src/ext/mbstring/tests/mb_stristr_variation2.phpt diff -u php-src/ext/mbstring/tests/mb_stristr_variation2.phpt:1.2 php-src/ext/mbstring/tests/mb_stristr_variation2.phpt:1.3 --- php-src/ext/mbstring/tests/mb_stristr_variation2.phpt:1.2 Fri Dec 5 13:13:14 2008 +++ php-src/ext/mbstring/tests/mb_stristr_variation2.phpt Tue Dec 30 02:12:44 2008 @@ -122,31 +122,31 @@ *** Testing mb_stristr() : usage variation *** --int 0-- -string(0) +bool(false) --int 1-- -string(0) +bool(false) --int 12345-- -string(0) +bool(false) --int -12345-- -string(0) +bool(false) --float 10.5-- -string(0) +bool(false) --float -10.5-- -string(0) +bool(false) --float 12.3456789000e10-- -string(0) +bool(false) --float -12.3456789000e10-- -string(0) +bool(false) --float .5-- -string(0) +bool(false) --empty array-- Error: 2 - mb_stristr() expects parameter 2 to be binary string, array given, %s(%d) @@ -173,14 +173,14 @@ bool(false) --lowercase true-- -string(0) +bool(false) --lowercase false-- Error: 2 - mb_stristr(): Empty delimiter., %s(%d) bool(false) --uppercase TRUE-- -string(0) +bool(false) --uppercase FALSE-- Error: 2 - mb_stristr(): Empty delimiter., %s(%d) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
felipe Sat Dec 27 13:31:07 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: - Fixed memory leaks http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.307r2=1.308diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.307 php-src/ext/mbstring/mbstring.c:1.308 --- php-src/ext/mbstring/mbstring.c:1.307 Thu Dec 25 19:30:28 2008 +++ php-src/ext/mbstring/mbstring.c Sat Dec 27 13:31:07 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.307 2008/12/25 19:30:28 felipe Exp $ */ +/* $Id: mbstring.c,v 1.308 2008/12/27 13:31:07 felipe Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1761,8 +1761,10 @@ if (list) { efree(list); } + zval_ptr_dtor(arg1); RETURN_FALSE; } + zval_ptr_dtor(arg1); break; } @@ -1817,7 +1819,9 @@ if (Z_LVAL_P(arg1) 0x Z_LVAL_P(arg1) 0x0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; MBSTRG(current_filter_illegal_substchar) = Z_LVAL_P(arg1); + zval_ptr_dtor(arg1); } else { + zval_ptr_dtor(arg1); php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown character.); RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
felipe Thu Dec 25 19:30:28 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: - Fixed memory leak http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.306r2=1.307diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.306 php-src/ext/mbstring/mbstring.c:1.307 --- php-src/ext/mbstring/mbstring.c:1.306 Thu Dec 11 02:56:08 2008 +++ php-src/ext/mbstring/mbstring.c Thu Dec 25 19:30:28 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.306 2008/12/11 02:56:08 scottmac Exp $ */ +/* $Id: mbstring.c,v 1.307 2008/12/25 19:30:28 felipe Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1828,7 +1828,9 @@ if (Z_LVAL_P(arg1) 0x Z_LVAL_P(arg1) 0x0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; MBSTRG(current_filter_illegal_substchar) = Z_LVAL_P(arg1); + zval_ptr_dtor(arg1); } else { + zval_ptr_dtor(arg1); php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown character.); RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
scottmacThu Dec 11 02:56:09 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: Fix bug #46738 - Segfault when mb_detect_encoding() fails. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.305r2=1.306diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.305 php-src/ext/mbstring/mbstring.c:1.306 --- php-src/ext/mbstring/mbstring.c:1.305 Mon Nov 17 11:26:21 2008 +++ php-src/ext/mbstring/mbstring.c Thu Dec 11 02:56:08 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.305 2008/11/17 11:26:21 felipe Exp $ */ +/* $Id: mbstring.c,v 1.306 2008/12/11 02:56:08 scottmac Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3058,7 +3058,7 @@ } if (ret == NULL) { - RETVAL_FALSE; + RETURN_FALSE; } RETVAL_STRING((char *)ret, 1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
moriyoshi Sat Sep 13 19:50:26 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: - Reenable ini_set(mbstring.internal_encoding, VALUE) to work on runtime. (noticed by Antony. Thanks!) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.301r2=1.302diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.301 php-src/ext/mbstring/mbstring.c:1.302 --- php-src/ext/mbstring/mbstring.c:1.301 Sat Sep 13 00:22:10 2008 +++ php-src/ext/mbstring/mbstring.c Sat Sep 13 19:50:26 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.301 2008/09/13 00:22:10 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.302 2008/09/13 19:50:26 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1165,7 +1165,8 @@ /* {{{ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) */ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) { - if (stage == PHP_INI_STAGE_STARTUP || stage == PHP_INI_STAGE_SHUTDOWN) { + if (stage == PHP_INI_STAGE_STARTUP || stage == PHP_INI_STAGE_SHUTDOWN + || stage == PHP_INI_STAGE_RUNTIME) { return _php_mb_ini_mbstring_internal_encoding_set(new_value, new_value_length TSRMLS_CC); } else { /* the corresponding mbstring globals needs to be set according to the -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
moriyoshi Fri Sep 12 23:34:45 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: * Use memcmp() for binary safety. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.298r2=1.299diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.298 php-src/ext/mbstring/mbstring.c:1.299 --- php-src/ext/mbstring/mbstring.c:1.298 Wed Sep 10 23:19:50 2008 +++ php-src/ext/mbstring/mbstring.c Fri Sep 12 23:34:45 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.298 2008/09/10 23:19:50 iliaa Exp $ */ +/* $Id: mbstring.c,v 1.299 2008/09/12 23:34:45 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -4527,14 +4527,12 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to create converter); RETURN_FALSE; } - mbfl_buffer_converter_illegal_mode(convd, MBSTRG(current_filter_illegal_mode)); - mbfl_buffer_converter_illegal_substchar(convd, MBSTRG(current_filter_illegal_substchar)); + mbfl_buffer_converter_illegal_mode(convd, MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE); + mbfl_buffer_converter_illegal_substchar(convd, 0); /* initialize string */ - mbfl_string_init(string); + mbfl_string_init_set(string, mbfl_no_language_neutral, no_encoding); mbfl_string_init(result); - string.no_encoding = no_encoding; - string.no_language = MBSTRG(language); string.val = (unsigned char *)var; string.len = var_len; @@ -4542,17 +4540,12 @@ illegalchars = mbfl_buffer_illegalchars(convd); mbfl_buffer_converter_delete(convd); + RETVAL_FALSE; if (ret != NULL) { - MBSTRG(illegalchars) += illegalchars; - if (illegalchars == 0 strncmp((char *)string.val, (char *)ret-val, string.len) == 0) { - efree(ret-val); - RETURN_TRUE; - } else { - efree(ret-val); - RETURN_FALSE; + if (illegalchars == 0 string.len == result.len memcmp(string.val, result.val, string.len) == 0) { + RETVAL_TRUE; } - } else { - RETURN_FALSE; + mbfl_string_clear(result); } } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
moriyoshi Fri Sep 12 23:59:51 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: - The mb_list_* issue has been resolved in the following way: - Keep the same prototype as 5.2 for mb_list_encodings(). - Add mb_list_encoding_aliases() with the mandatory parameter. - Remove mb_list_mime_names() as the list can be made from iteration on mb_list_encodings() with mb_preferred_mime_name(). http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.299r2=1.300diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.299 php-src/ext/mbstring/mbstring.c:1.300 --- php-src/ext/mbstring/mbstring.c:1.299 Fri Sep 12 23:34:45 2008 +++ php-src/ext/mbstring/mbstring.c Fri Sep 12 23:59:51 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.299 2008/09/12 23:34:45 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.300 2008/09/12 23:59:51 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -390,16 +390,10 @@ static ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_list_encodings, 0, 0, 0) - ZEND_ARG_INFO(0, alias_encoding) ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_list_encodings_alias_names, 0, 0, 0) - ZEND_ARG_INFO(0, encoding) -ZEND_END_ARG_INFO() - -static -ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_list_mime_names, 0, 0, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_list_encoding_aliases, 0, 0, 1) ZEND_ARG_INFO(0, encoding) ZEND_END_ARG_INFO() @@ -588,8 +582,7 @@ PHP_FE(mb_convert_encoding, arginfo_mb_convert_encoding) PHP_FE(mb_detect_encoding, arginfo_mb_detect_encoding) PHP_FE(mb_list_encodings, arginfo_mb_list_encodings) - PHP_FE(mb_list_encodings_alias_names, arginfo_mb_list_encodings_alias_names) - PHP_FE(mb_list_mime_names, arginfo_mb_list_mime_names) + PHP_FE(mb_list_encoding_aliases, arginfo_mb_list_encoding_aliases) PHP_FE(mb_convert_kana, arginfo_mb_convert_kana) PHP_FE(mb_encode_mimeheader,arginfo_mb_encode_mimeheader) PHP_FE(mb_decode_mimeheader,arginfo_mb_decode_mimeheader) @@ -3125,156 +3118,51 @@ } /* }}} */ -/* {{{ proto mixed mb_list_encodings([string alias_encoding]) +/* {{{ proto mixed mb_list_encodings() Returns an array of all supported entity encodings or Returns the entity encoding as a string */ PHP_FUNCTION(mb_list_encodings) { const mbfl_encoding **encodings; const mbfl_encoding *encoding; - enum mbfl_no_encoding no_encoding; int i; - char *name = NULL; - int name_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |s, name, name_len) == FAILURE) { - RETURN_FALSE; + if (ZEND_NUM_ARGS() != 0) { + RETVAL_FALSE; + ZEND_WRONG_PARAM_COUNT(); } - if (name == NULL) { - array_init(return_value); - i = 0; - encodings = mbfl_get_supported_encodings(); - while ((encoding = encodings[i++]) != NULL) { - add_next_index_string(return_value, (char *) encoding-name, 1); - } - } else { - no_encoding = mbfl_name2no_encoding(name); - if (no_encoding == mbfl_no_encoding_invalid) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown encoding \%s\, name); - RETURN_FALSE; - } - - name = (char *)mbfl_no_encoding2name(no_encoding); - if (name != NULL) { - RETURN_STRING(name, 1); - } else { - RETURN_FALSE; - } + array_init(return_value); + i = 0; + encodings = mbfl_get_supported_encodings(); + while ((encoding = encodings[i++]) != NULL) { + add_next_index_string(return_value, (char *) encoding-name, 1); } } /* }}} */ -/* {{{ proto array mb_list_encodings_alias_names([string encoding]) - Returns an array of all supported alias encodings */ -PHP_FUNCTION(mb_list_encodings_alias_names) +/* {{{ proto array mb_list_encoding_aliases(string encoding) + Returns an array of the aliases of a given encoding name */ +PHP_FUNCTION(mb_list_encoding_aliases) { - const mbfl_encoding **encodings; const mbfl_encoding *encoding; - enum mbfl_no_encoding no_encoding; - int i, j; - zval *row; char *name = NULL; int name_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |s, name, name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, name, name_len) == FAILURE) { RETURN_FALSE; } - if (name == NULL) { -
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
Moriyoshi Koizumi wrote: moriyoshi Fri Sep 12 23:59:51 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: - The mb_list_* issue has been resolved in the following way: - Keep the same prototype as 5.2 for mb_list_encodings(). - Add mb_list_encoding_aliases() with the mandatory parameter. - Remove mb_list_mime_names() as the list can be made from iteration on mb_list_encodings() with mb_preferred_mime_name(). Just to note I already discussed this with the other mbstring developers. Thanks Nuno for reminding me. Regards, Moriyoshi -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h
moriyoshi Sat Sep 13 00:22:10 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c mbstring.h Log: - mb_encoding_aliases() is more consistent with mb_preferred_mime_name() despite the unconformance with the naming convention. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.300r2=1.301diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.300 php-src/ext/mbstring/mbstring.c:1.301 --- php-src/ext/mbstring/mbstring.c:1.300 Fri Sep 12 23:59:51 2008 +++ php-src/ext/mbstring/mbstring.c Sat Sep 13 00:22:10 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.300 2008/09/12 23:59:51 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.301 2008/09/13 00:22:10 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -393,7 +393,7 @@ ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_list_encoding_aliases, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_encoding_aliases, 0, 0, 1) ZEND_ARG_INFO(0, encoding) ZEND_END_ARG_INFO() @@ -582,7 +582,7 @@ PHP_FE(mb_convert_encoding, arginfo_mb_convert_encoding) PHP_FE(mb_detect_encoding, arginfo_mb_detect_encoding) PHP_FE(mb_list_encodings, arginfo_mb_list_encodings) - PHP_FE(mb_list_encoding_aliases, arginfo_mb_list_encoding_aliases) + PHP_FE(mb_encoding_aliases, arginfo_mb_encoding_aliases) PHP_FE(mb_convert_kana, arginfo_mb_convert_kana) PHP_FE(mb_encode_mimeheader,arginfo_mb_encode_mimeheader) PHP_FE(mb_decode_mimeheader,arginfo_mb_decode_mimeheader) @@ -3140,9 +3140,9 @@ } /* }}} */ -/* {{{ proto array mb_list_encoding_aliases(string encoding) +/* {{{ proto array mb_encoding_aliases(string encoding) Returns an array of the aliases of a given encoding name */ -PHP_FUNCTION(mb_list_encoding_aliases) +PHP_FUNCTION(mb_encoding_aliases) { const mbfl_encoding *encoding; char *name = NULL; http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.h?r1=1.83r2=1.84diff_format=u Index: php-src/ext/mbstring/mbstring.h diff -u php-src/ext/mbstring/mbstring.h:1.83 php-src/ext/mbstring/mbstring.h:1.84 --- php-src/ext/mbstring/mbstring.h:1.83Sat Aug 2 20:48:30 2008 +++ php-src/ext/mbstring/mbstring.h Sat Sep 13 00:22:10 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mbstring.h,v 1.83 2008/08/02 20:48:30 moriyoshi Exp $ */ +/* $Id: mbstring.h,v 1.84 2008/09/13 00:22:10 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring (currently only for Japanese) @@ -117,8 +117,7 @@ PHP_FUNCTION(mb_convert_encoding); PHP_FUNCTION(mb_detect_encoding); PHP_FUNCTION(mb_list_encodings); -PHP_FUNCTION(mb_list_encodings_alias_names); -PHP_FUNCTION(mb_list_mime_names); +PHP_FUNCTION(mb_encoding_aliases); PHP_FUNCTION(mb_convert_kana); PHP_FUNCTION(mb_encode_mimeheader); PHP_FUNCTION(mb_decode_mimeheader); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
iliaa Wed Sep 10 23:19:50 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: MFB: Fixed bug #46042 (memory leaks with reflection of mb_convert_encoding()) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.297r2=1.298diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.297 php-src/ext/mbstring/mbstring.c:1.298 --- php-src/ext/mbstring/mbstring.c:1.297 Mon Aug 18 00:36:03 2008 +++ php-src/ext/mbstring/mbstring.c Wed Sep 10 23:19:50 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.297 2008/08/18 00:36:03 felipe Exp $ */ +/* $Id: mbstring.c,v 1.298 2008/09/10 23:19:50 iliaa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2961,7 +2961,7 @@ s_free = _from_encodings; break; default: - convert_to_string_ex(arg_old); + convert_to_string(arg_old); _from_encodings = Z_STRVAL_P(arg_old); break; } @@ -3082,7 +3082,7 @@ } break; default: - convert_to_string_ex(encoding_list); + convert_to_string(encoding_list); if (!php_mb_parse_encoding_list(Z_STRVAL_P(encoding_list), Z_STRLEN_P(encoding_list), list, size, 0 TSRMLS_CC)) { if (list) { efree(list); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c php_mbregex.c /ext/mbstring/tests ini_language.phpt mb_output_handler_pattern-01.phpt mb_output_handler_pattern-02.phpt mb_output_handler_pattern-03.ph
felipe Mon Aug 18 00:36:04 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c php_mbregex.c /php-src/ext/mbstring/tests ini_language.phpt mb_output_handler_pattern-01.phpt mb_output_handler_pattern-02.phpt mb_output_handler_pattern-03.phpt mb_output_handler_pattern-04.phpt mb_output_handler_pattern-05.phpt mb_output_handler_pattern-06.phpt mb_output_handler_pattern-07.phpt mb_output_handler_pattern-08.phpt mb_output_handler_pattern-09.phpt mb_output_handler_pattern-10.phpt mb_output_handler_pattern-11.phpt mb_output_handler_pattern-12.phpt mb_parse_str.phpt mb_regex_encoding_error1.phpt mb_regex_encoding_variation1.phpt mb_strtolower_basic.phpt mb_substr_error1.phpt mb_substr_variation1.phpt mb_substr_variation2.phpt Log: - New parameter parsing API - Fixed tests http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.296r2=1.297diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.296 php-src/ext/mbstring/mbstring.c:1.297 --- php-src/ext/mbstring/mbstring.c:1.296 Mon Aug 11 15:40:41 2008 +++ php-src/ext/mbstring/mbstring.c Mon Aug 18 00:36:03 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.296 2008/08/11 15:40:41 nlopess Exp $ */ +/* $Id: mbstring.c,v 1.297 2008/08/18 00:36:03 felipe Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3466,37 +3466,30 @@ #define PHP_MBSTR_STACK_BLOCK_SIZE 32 -/* {{{ proto string mb_convert_variables(string to-encoding, mixed from-encoding [, mixed ...]) +/* {{{ proto string mb_convert_variables(string to-encoding, mixed from-encoding, mixed vars [, ...]) Converts the string resource in variables to desired encoding */ PHP_FUNCTION(mb_convert_variables) { - zval ***args, ***stack, **var, **hash_entry; + zval ***args, ***stack, **var, **hash_entry, **zfrom_enc; HashTable *target_hash; mbfl_string string, result, *ret; enum mbfl_no_encoding from_encoding, to_encoding; mbfl_encoding_detector *identd; mbfl_buffer_converter *convd; - int n, argc, stack_level, stack_max, elistsz; + int n, to_enc_len, argc, stack_level, stack_max, elistsz; enum mbfl_no_encoding *elist; - char *name; + char *name, *to_enc; void *ptmp; - argc = ZEND_NUM_ARGS(); - if (argc 3) { - WRONG_PARAM_COUNT; - } - args = (zval ***)ecalloc(argc, sizeof(zval **)); - if (zend_get_parameters_array_ex(argc, args) == FAILURE) { - efree((void *)args); - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sZ+, to_enc, to_enc_len, zfrom_enc, args, argc) == FAILURE) { + return; } /* new encoding */ - convert_to_string_ex(args[0]); - to_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(args[0])); + to_encoding = mbfl_name2no_encoding(to_enc); if (to_encoding == mbfl_no_encoding_invalid) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown encoding \%s\, Z_STRVAL_PP(args[0])); - efree((void *)args); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown encoding \%s\, to_enc); + efree(args); RETURN_FALSE; } @@ -3510,13 +3503,13 @@ /* pre-conversion encoding */ elist = NULL; elistsz = 0; - switch (Z_TYPE_PP(args[1])) { + switch (Z_TYPE_PP(zfrom_enc)) { case IS_ARRAY: - php_mb_parse_encoding_array(*args[1], elist, elistsz, 0 TSRMLS_CC); + php_mb_parse_encoding_array(*zfrom_enc, elist, elistsz, 0 TSRMLS_CC); break; default: - convert_to_string_ex(args[1]); - php_mb_parse_encoding_list(Z_STRVAL_PP(args[1]), Z_STRLEN_PP(args[1]), elist, elistsz, 0 TSRMLS_CC); + convert_to_string_ex(zfrom_enc); + php_mb_parse_encoding_list(Z_STRVAL_PP(zfrom_enc), Z_STRLEN_PP(zfrom_enc), elist, elistsz, 0 TSRMLS_CC); break; } if (elistsz = 0) { @@ -3531,7 +3524,7 @@ stack_level = 0; identd = mbfl_encoding_detector_new(elist, elistsz,
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
nlopess Mon Aug 11 15:40:41 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: fix build when host machine doest has pcre installed http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.295r2=1.296diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.295 php-src/ext/mbstring/mbstring.c:1.296 --- php-src/ext/mbstring/mbstring.c:1.295 Mon Aug 4 21:10:17 2008 +++ php-src/ext/mbstring/mbstring.c Mon Aug 11 15:40:41 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.295 2008/08/04 21:10:17 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.296 2008/08/11 15:40:41 nlopess Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -86,7 +86,7 @@ #include oniguruma.h #undef UChar #elif HAVE_PCRE || HAVE_BUNDLED_PCRE -#include pcre.h +#include ext/pcre/php_pcre.h #endif /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
On 11.08.2008 19:40, Nuno Lopes wrote: #include oniguruma.h #undef UChar #elif HAVE_PCRE || HAVE_BUNDLED_PCRE -#include pcre.h +#include ext/pcre/php_pcre.h #endif Right, I didn't notice that =) Thanks. -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
moriyoshi Mon Aug 4 21:10:18 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: - More fixes for bug #45691 http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.294r2=1.295diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.294 php-src/ext/mbstring/mbstring.c:1.295 --- php-src/ext/mbstring/mbstring.c:1.294 Sun Aug 3 11:56:45 2008 +++ php-src/ext/mbstring/mbstring.c Mon Aug 4 21:10:17 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.294 2008/08/03 11:56:45 jani Exp $ */ +/* $Id: mbstring.c,v 1.295 2008/08/04 21:10:17 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1239,6 +1239,11 @@ } } } + } else { + MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; + MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; + MBSTRG(filter_illegal_substchar) = 0x3f;/* '?' */ + MBSTRG(current_filter_illegal_substchar) = 0x3f;/* '?' */ } return SUCCESS; @@ -1274,7 +1279,8 @@ void *re = NULL; if (!new_value) { - return SUCCESS; + new_value = entry-orig_value; + new_value_length = entry-orig_value_length; } php_trim(new_value, new_value_length, NULL, 0, tmp, 3 TSRMLS_CC); @@ -1457,9 +1463,7 @@ MBSTRG(current_filter_illegal_mode) = MBSTRG(filter_illegal_mode); MBSTRG(current_filter_illegal_substchar) = MBSTRG(filter_illegal_substchar); - if (!MBSTRG(encoding_translation)) { - MBSTRG(illegalchars) = 0; - } + MBSTRG(illegalchars) = 0; n = 0; if (MBSTRG(detect_order_list)) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
janiSun Aug 3 11:56:45 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: - No C++ comments in C files! http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.293r2=1.294diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.293 php-src/ext/mbstring/mbstring.c:1.294 --- php-src/ext/mbstring/mbstring.c:1.293 Sun Aug 3 00:04:06 2008 +++ php-src/ext/mbstring/mbstring.c Sun Aug 3 11:56:45 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.293 2008/08/03 00:04:06 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.294 2008/08/03 11:56:45 jani Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1175,12 +1175,12 @@ if (stage == PHP_INI_STAGE_STARTUP || stage == PHP_INI_STAGE_SHUTDOWN) { return _php_mb_ini_mbstring_internal_encoding_set(new_value, new_value_length TSRMLS_CC); } else { - // the corresponding mbstring globals needs to be set according to the - // ini value in the later stage because it never falls back to the - // default value if 1. no value for mbstring.internal_encoding is given, - // 2. mbstring.language directive is processed in per-dir or runtime - // context and 3. call to the handler for mbstring.language is done - // after mbstring.internal_encoding is handled. + /* the corresponding mbstring globals needs to be set according to the +* ini value in the later stage because it never falls back to the +* default value if 1. no value for mbstring.internal_encoding is given, +* 2. mbstring.language directive is processed in per-dir or runtime +* context and 3. call to the handler for mbstring.language is done +* after mbstring.internal_encoding is handled. */ return SUCCESS; } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h
moriyoshi Sat Aug 2 20:48:30 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c mbstring.h Log: - Fixed bug #45691 (Some per-dir or runtime settings may leak into other requests). http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.291r2=1.292diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.291 php-src/ext/mbstring/mbstring.c:1.292 --- php-src/ext/mbstring/mbstring.c:1.291 Fri Jul 25 14:04:39 2008 +++ php-src/ext/mbstring/mbstring.c Sat Aug 2 20:48:30 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.291 2008/07/25 14:04:39 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.292 2008/08/02 20:48:30 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1013,6 +1013,7 @@ no_language = mbfl_name2no_language(new_value); if (no_language == mbfl_no_language_invalid) { + MBSTRG(language) = mbfl_no_language_neutral; return FAILURE; } MBSTRG(language) = no_language; @@ -1028,12 +1029,16 @@ int size; if (php_mb_parse_encoding_list(new_value, new_value_length, list, size, 1 TSRMLS_CC)) { - if (MBSTRG(detect_order_list) != NULL) { + if (MBSTRG(detect_order_list)) { free(MBSTRG(detect_order_list)); } MBSTRG(detect_order_list) = list; MBSTRG(detect_order_list_size) = size; } else { + if (MBSTRG(detect_order_list)) { + free(MBSTRG(detect_order_list)); + MBSTRG(detect_order_list) = NULL; + } return FAILURE; } @@ -1048,12 +1053,17 @@ int size; if (php_mb_parse_encoding_list(new_value, new_value_length, list, size, 1 TSRMLS_CC)) { - if (MBSTRG(http_input_list) != NULL) { + if (MBSTRG(http_input_list)) { free(MBSTRG(http_input_list)); } MBSTRG(http_input_list) = list; MBSTRG(http_input_list_size) = size; } else { + if (MBSTRG(http_input_list)) { + free(MBSTRG(http_input_list)); + MBSTRG(http_input_list) = NULL; + } + MBSTRG(http_input_list_size) = 0; return FAILURE; } @@ -1071,6 +1081,8 @@ MBSTRG(http_output_encoding) = no_encoding; MBSTRG(current_http_output_encoding) = no_encoding; } else { + MBSTRG(http_output_encoding) = mbfl_no_encoding_pass; + MBSTRG(current_http_output_encoding) = mbfl_no_encoding_pass; if (new_value != NULL new_value_length 0) { return FAILURE; } @@ -1084,34 +1096,75 @@ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) { enum mbfl_no_encoding no_encoding; - if (new_value == NULL) { - return SUCCESS; - } - - no_encoding = mbfl_name2no_encoding(new_value); + const char *enc_name = NULL; + uint enc_name_len = 0; + + no_encoding = new_value ? mbfl_name2no_encoding(new_value): + mbfl_no_encoding_invalid; if (no_encoding != mbfl_no_encoding_invalid) { - MBSTRG(internal_encoding) = no_encoding; - MBSTRG(current_internal_encoding) = no_encoding; + enc_name = new_value; + enc_name_len = new_value_length; + } else { + switch (MBSTRG(language)) { + case mbfl_no_language_uni: + enc_name = UTF-8; + enc_name_len = sizeof(UTF-8) - 1; + break; + case mbfl_no_language_japanese: + enc_name = EUC-JP; + enc_name_len = sizeof(EUC-JP) - 1; + break; + case mbfl_no_language_korean: + enc_name = EUC-KR; + enc_name_len = sizeof(EUC-KR) - 1; + break; + case mbfl_no_language_simplified_chinese: + enc_name = EUC-CN; + enc_name_len = sizeof(EUC-CN) - 1; + break; + case mbfl_no_language_traditional_chinese: + enc_name = EUC-TW; + enc_name_len = sizeof(EUC-TW) - 1; + break; + case mbfl_no_language_russian: + enc_name = KOI8-R; + enc_name_len = sizeof(KOI8-R) - 1;
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
moriyoshi Sun Aug 3 00:04:06 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: - Forgot to take account of the case when mbstring.language is processed afterwards. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.292r2=1.293diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.292 php-src/ext/mbstring/mbstring.c:1.293 --- php-src/ext/mbstring/mbstring.c:1.292 Sat Aug 2 20:48:30 2008 +++ php-src/ext/mbstring/mbstring.c Sun Aug 3 00:04:06 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.292 2008/08/02 20:48:30 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.293 2008/08/03 00:04:06 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1092,8 +1092,8 @@ } /* }}} */ -/* {{{ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) */ -static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) +/* {{{ static _php_mb_ini_mbstring_internal_encoding_set */ +static int _php_mb_ini_mbstring_internal_encoding_set(const char *new_value, uint new_value_length TSRMLS_DC) { enum mbfl_no_encoding no_encoding; const char *enc_name = NULL; @@ -1169,6 +1169,23 @@ } /* }}} */ +/* {{{ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) */ +static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) +{ + if (stage == PHP_INI_STAGE_STARTUP || stage == PHP_INI_STAGE_SHUTDOWN) { + return _php_mb_ini_mbstring_internal_encoding_set(new_value, new_value_length TSRMLS_CC); + } else { + // the corresponding mbstring globals needs to be set according to the + // ini value in the later stage because it never falls back to the + // default value if 1. no value for mbstring.internal_encoding is given, + // 2. mbstring.language directive is processed in per-dir or runtime + // context and 3. call to the handler for mbstring.language is done + // after mbstring.internal_encoding is handled. + return SUCCESS; + } +} +/* }}} */ + #ifdef ZEND_MULTIBYTE /* {{{ static PHP_INI_MH(OnUpdate_mbstring_script_encoding) */ static PHP_INI_MH(OnUpdate_mbstring_script_encoding) @@ -1430,8 +1447,10 @@ zend_function *func, *orig; const struct mb_overload_def *p; - php_mb_nls_get_default_detect_order_list(MBSTRG(language), -MBSTRG(default_detect_order_list), MBSTRG(default_detect_order_list_size)); + { + char *value = zend_ini_string(mbstring.internal_encoding, sizeof(mbstring.internal_encoding), 0); + _php_mb_ini_mbstring_internal_encoding_set(value, value ? strlen(value): 0 TSRMLS_CC); + } MBSTRG(current_internal_encoding) = MBSTRG(internal_encoding); MBSTRG(current_http_output_encoding) = MBSTRG(http_output_encoding); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c /ext/mbstring/tests mb_stripos.phpt mb_stripos_basic.phpt mb_stripos_error1.phpt mb_stripos_error2.phpt mb_stripos_variation1.phpt mb_stripos_variation
moriyoshi Fri Jul 25 12:50:14 2008 UTC Added files: /php-src/ext/mbstring/tests mb_stripos.phpt mb_stripos_basic.phpt mb_stripos_error1.phpt mb_stripos_error2.phpt mb_stripos_variation1.phpt mb_stripos_variation2.phpt mb_stripos_variation3.phpt mb_stripos_variation4.phpt Modified files: /php-src/ext/mbstring mbstring.c Log: - fix a typo in mb_stripos() that caused segfault. (noticed by [EMAIL PROTECTED], thanks). http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.288r2=1.289diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.288 php-src/ext/mbstring/mbstring.c:1.289 --- php-src/ext/mbstring/mbstring.c:1.288 Thu Jul 24 13:46:35 2008 +++ php-src/ext/mbstring/mbstring.c Fri Jul 25 12:50:14 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.288 2008/07/24 13:46:35 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.289 2008/07/25 12:50:14 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2236,10 +2236,13 @@ n = -1; offset = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|ls, (char **)haystack.val, (int *)haystack.len, (char **)needle.val, (int *)needle.len, offset, from_encoding, from_encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|ls, (char **)haystack.val, (int *)haystack.len, (char **)needle.val, (int *)needle.len, offset, from_encoding, from_encoding_len) == FAILURE) { + RETURN_FALSE; + } + if (needle.len == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty delimiter.); RETURN_FALSE; } - n = php_mb_stripos(0, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding TSRMLS_CC); if (n = 0) { http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_stripos.phpt?view=markuprev=1.1 Index: php-src/ext/mbstring/tests/mb_stripos.phpt +++ php-src/ext/mbstring/tests/mb_stripos.phpt --TEST-- mb_stripos() --SKIPIF-- ?php extension_loaded('mbstring') or die('skip mbstring not available'); ? --FILE-- ?php // TODO: Add more encodings //$debug=true; ini_set('include_path', dirname(__FILE__)); include_once('common.inc'); // Test string $euc_jp = '0123¤³¤Îʸ»úÎó¤ÏÆüËܸì¤Ç¤¹¡£EUC-JP¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£0123ÆüËܸì¤ÏÌÌÅݽ¤¤¡£'; // EUC-JP - With encoding parameter mb_internal_encoding('UTF-8') or print(mb_internal_encoding() failed\n); echo == POSITIVE OFFSET ==\n; print mb_stripos($euc_jp,'ÆüËܸì', 0, 'EUC-JP') . \n; print mb_stripos($euc_jp, '0', 0, 'EUC-JP') . \n; print mb_stripos($euc_jp, 3, 0, 'EUC-JP') . \n; print mb_stripos($euc_jp, 0, 0, 'EUC-JP') . \n; print mb_stripos($euc_jp,'ÆüËܸì', 15, 'EUC-JP') . \n; print mb_stripos($euc_jp, '0', 15, 'EUC-JP') . \n; print mb_stripos($euc_jp, 3, 15, 'EUC-JP') . \n; print mb_stripos($euc_jp, 0, 15, 'EUC-JP') . \n; // Negative offset // Note: PHP Warning - offset is negative. // Note: For offset(-15). It does not return position of latter string. (ie the same result as -50) echo == NEGATIVE OFFSET ==\n; $r = mb_stripos($euc_jp,'ÆüËܸì', -15, 'EUC-JP'); ($r === FALSE) ? print OK_NEGATIVE_OFFSET\n : print NG_NEGATIVE_OFFSET\n; $r = mb_stripos($euc_jp, '0', -15, 'EUC-JP'); ($r === FALSE) ? print OK_NEGATIVE_OFFSET\n : print NG_NEGATIVE_OFFSET\n; $r = mb_stripos($euc_jp, 3, -15, 'EUC-JP'); ($r === FALSE) ? print OK_NEGATIVE_OFFSET\n : print NG_NEGATIVE_OFFSET\n; $r = mb_stripos($euc_jp, 0, -15, 'EUC-JP'); ($r === FALSE) ? print OK_NEGATIVE_OFFSET\n : print NG_NEGATIVE_OFFSET\n; $r = mb_stripos($euc_jp,'ÆüËܸì', -50, 'EUC-JP'); ($r === FALSE) ? print OK_NEGATIVE_OFFSET\n : print NG_NEGATIVE_OFFSET\n; $r = mb_stripos($euc_jp, '0', -50, 'EUC-JP'); ($r === FALSE) ? print OK_NEGATIVE_OFFSET\n : print NG_NEGATIVE_OFFSET\n; $r = mb_stripos($euc_jp, 3, -50, 'EUC-JP'); ($r === FALSE) ? print OK_NEGATIVE_OFFSET\n : print NG_NEGATIVE_OFFSET\n; $r = mb_stripos($euc_jp, 0, -50, 'EUC-JP'); ($r === FALSE) ? print OK_NEGATIVE_OFFSET\n : print NG_NEGATIVE_OFFSET\n; // Out of range - should return false print (== OUT OF RANGE ==\n); $r = mb_stripos($euc_jp,'ÆüËܸì', 40, 'EUC-JP'); ($r === FALSE) ? print OK_OUT_RANGE\n : print NG_OUT_RANGE\n; $r = mb_stripos($euc_jp, '0', 40, 'EUC-JP'); ($r === FALSE) ? print OK_OUT_RANGE\n : print NG_OUT_RANGE\n; $r = mb_stripos($euc_jp, 3, 40, 'EUC-JP'); ($r === FALSE) ? print OK_OUT_RANGE\n : print NG_OUT_RANGE\n; $r = mb_stripos($euc_jp, 0, 40, 'EUC-JP'); ($r === FALSE) ? print OK_OUT_RANGE\n : print
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
moriyoshi Fri Jul 25 13:56:50 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: - Fix wrong cast http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.289r2=1.290diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.289 php-src/ext/mbstring/mbstring.c:1.290 --- php-src/ext/mbstring/mbstring.c:1.289 Fri Jul 25 12:50:14 2008 +++ php-src/ext/mbstring/mbstring.c Fri Jul 25 13:56:50 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.289 2008/07/25 12:50:14 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.290 2008/07/25 13:56:50 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -4862,7 +4862,7 @@ list_size += strlen(name) + 1; if (!list) { list = (char*)emalloc(list_size); - *list = (char)NULL; + *list = '\0'; } else { list = (char*)erealloc(list, list_size); strcat(list, ,); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c php_mbregex.c
moriyoshi Fri Jul 25 14:04:39 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c php_mbregex.c Log: - Fix warnings http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.290r2=1.291diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.290 php-src/ext/mbstring/mbstring.c:1.291 --- php-src/ext/mbstring/mbstring.c:1.290 Fri Jul 25 13:56:50 2008 +++ php-src/ext/mbstring/mbstring.c Fri Jul 25 14:04:39 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.290 2008/07/25 13:56:50 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.291 2008/07/25 14:04:39 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2269,7 +2269,7 @@ RETURN_FALSE; } - if (offset haystack.len) { + if ((unsigned int)offset haystack.len) { RETURN_FALSE; } @@ -2677,11 +2677,11 @@ } } - if (from string.len) { + if ((unsigned int)from string.len) { RETURN_FALSE; } - if (((unsigned) from + (unsigned) len) string.len) { + if (((unsigned int)from + (unsigned int)len) string.len) { len = string.len - from; } @@ -3063,7 +3063,7 @@ } if (ZEND_NUM_ARGS() 3) { - strict = MBSTRG(strict_detection); + strict = (zend_bool)MBSTRG(strict_detection); } if (size 0 list != NULL) { http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/php_mbregex.c?r1=1.63r2=1.64diff_format=u Index: php-src/ext/mbstring/php_mbregex.c diff -u php-src/ext/mbstring/php_mbregex.c:1.63 php-src/ext/mbstring/php_mbregex.c:1.64 --- php-src/ext/mbstring/php_mbregex.c:1.63 Thu Jul 17 16:08:08 2008 +++ php-src/ext/mbstring/php_mbregex.c Fri Jul 25 14:04:39 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_mbregex.c,v 1.63 2008/07/17 16:08:08 moriyoshi Exp $ */ +/* $Id: php_mbregex.c,v 1.64 2008/07/25 14:04:39 moriyoshi Exp $ */ #ifdef HAVE_CONFIG_H @@ -921,7 +921,7 @@ zval_dtor(v); } n = regs-end[0]; - if ((size_t)(pos - (OnigUChar *)string) n) { + if ((pos - (OnigUChar *)string) n) { pos = (OnigUChar *)string + n; } else { if (pos string_lim) { @@ -1014,7 +1014,7 @@ } /* add it to the array */ - if (regs-beg[0] string_len regs-beg[0] = (size_t)(pos - (OnigUChar *)string)) { + if (regs-beg[0] string_len regs-beg[0] = (pos - (OnigUChar *)string)) { add_next_index_stringl(return_value, (char *)pos, ((OnigUChar *)(string + regs-beg[0]) - pos), 1); } else { err = -2; @@ -1246,7 +1246,7 @@ { zval **arg_str, **arg_pattern, **arg_options; OnigSyntaxType *syntax = NULL; - int option; + OnigOptionType option; option = MBREX(regex_default_options); syntax = MBREX(regex_default_syntax); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h php_unicode.c php_unicode.h
moriyoshi Thu Jul 24 13:46:35 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c mbstring.h php_unicode.c php_unicode.h Log: - Fixed warnings. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.287r2=1.288diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.287 php-src/ext/mbstring/mbstring.c:1.288 --- php-src/ext/mbstring/mbstring.c:1.287 Thu Jul 24 12:58:37 2008 +++ php-src/ext/mbstring/mbstring.c Thu Jul 24 13:46:35 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.287 2008/07/24 12:58:37 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.288 2008/07/24 13:46:35 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2230,17 +2230,17 @@ { int n; long offset; - char *old_haystack, *old_needle; + mbfl_string haystack, needle; char *from_encoding = (char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); - int old_haystack_len, old_needle_len, from_encoding_len; + int from_encoding_len; n = -1; offset = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|ls, old_haystack, old_haystack_len, old_needle, old_needle_len, offset, from_encoding, from_encoding_len ) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|ls, (char **)haystack.val, (int *)haystack.len, (char **)needle.val, (int *)needle.len, offset, from_encoding, from_encoding_len) == FAILURE) { RETURN_FALSE; } - n = php_mb_stripos(0, old_haystack, old_haystack_len, old_needle, old_needle_len, offset, from_encoding TSRMLS_CC); + n = php_mb_stripos(0, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding TSRMLS_CC); if (n = 0) { RETVAL_LONG(n); @@ -2256,21 +2256,21 @@ { int n; long offset; - char *old_haystack, *old_needle; - char *from_encoding = (char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); - int old_haystack_len, old_needle_len, from_encoding_len; + mbfl_string haystack, needle; + const char *from_encoding = mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); + int from_encoding_len; n = -1; offset = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|ls, old_haystack, old_haystack_len, old_needle, old_needle_len, offset, from_encoding, from_encoding_len ) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|ls, (char **)haystack.val, (int *)haystack.len, (char **)needle.val, (int *)needle.len, offset, from_encoding, from_encoding_len) == FAILURE) { RETURN_FALSE; } - if(offset old_haystack_len){ + if (offset haystack.len) { RETURN_FALSE; } - n = php_mb_stripos(1, old_haystack, old_haystack_len, old_needle, old_needle_len, offset, from_encoding TSRMLS_CC); + n = php_mb_stripos(1, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding TSRMLS_CC); if (n = 0) { RETVAL_LONG(n); @@ -2297,7 +2297,7 @@ needle.no_language = MBSTRG(current_language); needle.no_encoding = MBSTRG(current_internal_encoding); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|bs, (char **)haystack.val, haystack.len, (char **)needle.val, needle.len, part, enc_name, enc_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|bs, (char **)haystack.val, (int *)haystack.len, (char **)needle.val, (int *)needle.len, part, enc_name, enc_name_len) == FAILURE) { RETURN_FALSE; } @@ -2403,9 +2403,9 @@ PHP_FUNCTION(mb_stristr) { zend_bool part = 0; - int n, from_encoding_len, len, mblen; + unsigned int n, from_encoding_len, len, mblen; mbfl_string haystack, needle, result, *ret = NULL; - char *from_encoding = (char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); + const char *from_encoding = mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); mbfl_string_init(haystack); mbfl_string_init(needle); haystack.no_language = MBSTRG(current_language); @@ -2418,7 +2418,7 @@ RETURN_FALSE; } - if(!needle.len){ + if (!needle.len) { php_error_docref(NULL TSRMLS_CC, E_WARNING,Empty delimiter.); RETURN_FALSE; } @@ -2429,7 +2429,7 @@ RETURN_FALSE; } - n = php_mb_stripos(0, haystack.val, haystack.len, needle.val, needle.len, 0, from_encoding TSRMLS_CC); + n = php_mb_stripos(0, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, 0,
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h php_mbregex.c php_mbregex.h
moriyoshi Thu Jul 17 16:08:09 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c mbstring.h php_mbregex.c php_mbregex.h Log: - Removed dependencies from php_mbregex to oniguruma types http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.284r2=1.285diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.284 php-src/ext/mbstring/mbstring.c:1.285 --- php-src/ext/mbstring/mbstring.c:1.284 Wed Jul 16 02:29:14 2008 +++ php-src/ext/mbstring/mbstring.c Thu Jul 17 16:08:08 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.284 2008/07/16 02:29:14 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.285 2008/07/17 16:08:08 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -73,6 +73,10 @@ #include mb_gpc.h +#if HAVE_MBREGEX +#include php_mbregex.h +#endif + #ifdef ZEND_MULTIBYTE #include zend_multibyte.h #endif /* ZEND_MULTIBYTE */ @@ -89,7 +93,7 @@ /* {{{ php_mb_default_identify_list */ typedef struct _php_mb_nls_ident_list { enum mbfl_no_language lang; - enum mbfl_no_encoding* list; + const enum mbfl_no_encoding* list; int list_size; } php_mb_nls_ident_list; @@ -911,7 +915,7 @@ for (i = 0; i sizeof(php_mb_default_identify_list) / sizeof(php_mb_default_identify_list[0]); i++) { if (php_mb_default_identify_list[i].lang == lang) { - *plist = php_mb_default_identify_list[i].list; + *plist = (enum mbfl_no_encoding *)php_mb_default_identify_list[i].list; *plist_size = php_mb_default_identify_list[i].list_size; return 1; } @@ -1008,12 +1012,13 @@ MBSTRG(current_internal_encoding) = no_encoding; #if HAVE_MBREGEX { - OnigEncoding mbctype; - mbctype = php_mb_regex_name2mbctype(new_value); - if (mbctype == ONIG_ENCODING_UNDEF) { - mbctype = ONIG_ENCODING_EUC_JP; - } - MBSTRG(current_mbctype) = MBSTRG(default_mbctype) = mbctype; + const char *enc_name = new_value; + if (FAILURE == php_mb_regex_set_default_mbctype(enc_name)) { + /* falls back to EUC-JP if an unknown encoding name is given */ + enc_name = EUC-JP; + php_mb_regex_set_default_mbctype(enc_name); + } + php_mb_regex_set_mbctype(new_value); } #endif #ifdef ZEND_MULTIBYTE @@ -1164,7 +1169,7 @@ mbstring_globals-strict_detection = 0; mbstring_globals-outconv = NULL; #if HAVE_MBREGEX - _php_mb_regex_globals_ctor(mbstring_globals TSRMLS_CC); + mbstring_globals-mb_regex_globals = php_mb_regex_globals_alloc(TSRMLS_C); #endif } /* }}} */ @@ -1173,7 +1178,7 @@ static PHP_GSHUTDOWN_FUNCTION(mbstring) { #if HAVE_MBREGEX - _php_mb_regex_globals_dtor(mbstring_globals TSRMLS_CC); + php_mb_regex_globals_free(mbstring_globals-mb_regex_globals TSRMLS_CC); #endif } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.h?r1=1.79r2=1.80diff_format=u Index: php-src/ext/mbstring/mbstring.h diff -u php-src/ext/mbstring/mbstring.h:1.79 php-src/ext/mbstring/mbstring.h:1.80 --- php-src/ext/mbstring/mbstring.h:1.79Wed Jan 30 09:56:21 2008 +++ php-src/ext/mbstring/mbstring.h Thu Jul 17 16:08:08 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mbstring.h,v 1.79 2008/01/30 09:56:21 dmitry Exp $ */ +/* $Id: mbstring.h,v 1.80 2008/07/17 16:08:08 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring (currently only for Japanese) @@ -76,10 +76,6 @@ #define PHP_MBSTRING_API 20021024 -#if HAVE_MBREGEX -#include php_mbregex.h -#endif - extern zend_module_entry mbstring_module_entry; #define mbstring_module_ptr mbstring_module_entry @@ -197,8 +193,8 @@ long strict_detection; long illegalchars; mbfl_buffer_converter *outconv; -#if HAVE_MBREGEX defined(PHP_MBREGEX_GLOBALS) - PHP_MBREGEX_GLOBALS +#if HAVE_MBREGEX +struct _zend_mb_regex_globals *mb_regex_globals; #endif ZEND_END_MODULE_GLOBALS(mbstring) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/php_mbregex.c?r1=1.62r2=1.63diff_format=u Index: php-src/ext/mbstring/php_mbregex.c diff -u php-src/ext/mbstring/php_mbregex.c:1.62 php-src/ext/mbstring/php_mbregex.c:1.63 --- php-src/ext/mbstring/php_mbregex.c:1.62 Wed Jul 16 02:29:14 2008 +++ php-src/ext/mbstring/php_mbregex.c Thu Jul 17 16:08:08 2008 @@ -16,7 +16,7 @@
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c php_mbregex.h
moriyoshi Thu Jul 17 20:03:50 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c php_mbregex.h Log: - Fix ZTS build http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.285r2=1.286diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.285 php-src/ext/mbstring/mbstring.c:1.286 --- php-src/ext/mbstring/mbstring.c:1.285 Thu Jul 17 16:08:08 2008 +++ php-src/ext/mbstring/mbstring.c Thu Jul 17 20:03:50 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.285 2008/07/17 16:08:08 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.286 2008/07/17 20:03:50 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1013,12 +1013,12 @@ #if HAVE_MBREGEX { const char *enc_name = new_value; - if (FAILURE == php_mb_regex_set_default_mbctype(enc_name)) { + if (FAILURE == php_mb_regex_set_default_mbctype(enc_name TSRMLS_CC)) { /* falls back to EUC-JP if an unknown encoding name is given */ enc_name = EUC-JP; - php_mb_regex_set_default_mbctype(enc_name); + php_mb_regex_set_default_mbctype(enc_name TSRMLS_CC); } - php_mb_regex_set_mbctype(new_value); + php_mb_regex_set_mbctype(new_value TSRMLS_CC); } #endif #ifdef ZEND_MULTIBYTE http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/php_mbregex.h?r1=1.18r2=1.19diff_format=u Index: php-src/ext/mbstring/php_mbregex.h diff -u php-src/ext/mbstring/php_mbregex.h:1.18 php-src/ext/mbstring/php_mbregex.h:1.19 --- php-src/ext/mbstring/php_mbregex.h:1.18 Thu Jul 17 16:08:08 2008 +++ php-src/ext/mbstring/php_mbregex.h Thu Jul 17 20:03:50 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_mbregex.h,v 1.18 2008/07/17 16:08:08 moriyoshi Exp $ */ +/* $Id: php_mbregex.h,v 1.19 2008/07/17 20:03:50 moriyoshi Exp $ */ #ifndef _PHP_MBREGEX_H #define _PHP_MBREGEX_H @@ -69,7 +69,7 @@ typedef struct _zend_mb_regex_globals zend_mb_regex_globals; -zend_mb_regex_globals *php_mb_regex_globals_new(TSRMLS_D); +zend_mb_regex_globals *php_mb_regex_globals_alloc(TSRMLS_D); void php_mb_regex_globals_free(zend_mb_regex_globals *pglobals TSRMLS_DC); int php_mb_regex_set_mbctype(const char *enc TSRMLS_DC); int php_mb_regex_set_default_mbctype(const char *encname TSRMLS_DC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
indeyetsMon Jul 7 09:47:03 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: MFB: added arginfo (fixes #45388) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.277r2=1.278diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.277 php-src/ext/mbstring/mbstring.c:1.278 --- php-src/ext/mbstring/mbstring.c:1.277 Fri Jun 13 14:47:48 2008 +++ php-src/ext/mbstring/mbstring.c Mon Jul 7 09:47:02 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.277 2008/06/13 14:47:48 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.278 2008/07/07 09:47:02 indeyets Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -169,6 +169,26 @@ ZEND_ARG_PASS_INFO(0) ZEND_END_ARG_INFO() +static + ZEND_BEGIN_ARG_INFO_EX(mb_parse_str_arginfo, 0, 0, 1) + ZEND_ARG_INFO(0, encoded_string) + ZEND_ARG_ARRAY_INFO(1, result, 1) + ZEND_END_ARG_INFO() + +static + ZEND_BEGIN_ARG_INFO_EX(mb_convert_variables_arginfo, 1, 0, 3) + ZEND_ARG_INFO(0, to_encoding) + ZEND_ARG_INFO(0, from_encoding) + ZEND_ARG_INFO(1, vars) + ZEND_END_ARG_INFO() + +static + ZEND_BEGIN_ARG_INFO_EX(mb_ereg_arginfo, 0, 0, 2) + ZEND_ARG_INFO(0, pattern) + ZEND_ARG_INFO(0, string) + ZEND_ARG_INFO(1, regs) + ZEND_END_ARG_INFO() + /* {{{ mb_overload_def mb_ovld[] */ static const struct mb_overload_def mb_ovld[] = { {MB_OVERLOAD_MAIL, mail, mb_send_mail, mb_orig_mail}, @@ -206,7 +226,7 @@ PHP_FE(mb_http_output, NULL) PHP_FE(mb_detect_order, NULL) PHP_FE(mb_substitute_character, NULL) - PHP_FE(mb_parse_str,second_arg_force_ref) + PHP_FE(mb_parse_str,mb_parse_str_arginfo) PHP_FE(mb_output_handler, NULL) PHP_FE(mb_preferred_mime_name, NULL) PHP_FE(mb_strlen, NULL) @@ -231,7 +251,7 @@ PHP_FE(mb_convert_kana, NULL) PHP_FE(mb_encode_mimeheader,NULL) PHP_FE(mb_decode_mimeheader,NULL) - PHP_FE(mb_convert_variables,third_and_rest_force_ref) + PHP_FE(mb_convert_variables,mb_convert_variables_arginfo) PHP_FE(mb_encode_numericentity, NULL) PHP_FE(mb_decode_numericentity, NULL) PHP_FE(mb_send_mail,NULL) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
indeyetsMon Jul 7 09:57:12 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: MFB: updated to the new parameter-parsing api http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.278r2=1.279diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.278 php-src/ext/mbstring/mbstring.c:1.279 --- php-src/ext/mbstring/mbstring.c:1.278 Mon Jul 7 09:47:02 2008 +++ php-src/ext/mbstring/mbstring.c Mon Jul 7 09:57:12 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.278 2008/07/07 09:47:02 indeyets Exp $ */ +/* $Id: mbstring.c,v 1.279 2008/07/07 09:57:12 indeyets Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1292,12 +1292,17 @@ Sets the current detect_order or Return the current detect_order as a array */ PHP_FUNCTION(mb_detect_order) { - zval **arg1; + size_t argc = ZEND_NUM_ARGS(); + zval *arg1; int n, size; enum mbfl_no_encoding *list, *entry; char *name; - if (ZEND_NUM_ARGS() == 0) { + if (zend_parse_parameters(argc TSRMLS_CC, |z, arg1) == FAILURE) { + return; + } + + if (argc == 0) { array_init(return_value); entry = MBSTRG(current_detect_order_list); n = MBSTRG(current_detect_order_list_size); @@ -1309,12 +1314,12 @@ entry++; n--; } - } else if (ZEND_NUM_ARGS() == 1 zend_get_parameters_ex(1, arg1) != FAILURE) { + } else { list = NULL; size = 0; - switch (Z_TYPE_PP(arg1)) { + switch (Z_TYPE_P(arg1)) { case IS_ARRAY: - if (!php_mb_parse_encoding_array(*arg1, list, size, 0 TSRMLS_CC)) { + if (!php_mb_parse_encoding_array(arg1, list, size, 0 TSRMLS_CC)) { if (list) { efree(list); } @@ -1322,8 +1327,8 @@ } break; default: - convert_to_string_ex(arg1); - if (!php_mb_parse_encoding_list(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1), list, size, 0 TSRMLS_CC)) { + convert_to_string_ex(arg1); + if (!php_mb_parse_encoding_list(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), list, size, 0 TSRMLS_CC)) { if (list) { efree(list); } @@ -1331,18 +1336,17 @@ } break; } + if (list == NULL) { - RETVAL_FALSE; - } else { - if (MBSTRG(current_detect_order_list)) { - efree(MBSTRG(current_detect_order_list)); - } - MBSTRG(current_detect_order_list) = list; - MBSTRG(current_detect_order_list_size) = size; - RETVAL_TRUE; + RETURN_FALSE; } - } else { - WRONG_PARAM_COUNT; + + if (MBSTRG(current_detect_order_list)) { + efree(MBSTRG(current_detect_order_list)); + } + MBSTRG(current_detect_order_list) = list; + MBSTRG(current_detect_order_list_size) = size; + RETURN_TRUE; } } /* }}} */ @@ -1351,52 +1355,56 @@ Sets the current substitute_character or returns the current substitute_character */ PHP_FUNCTION(mb_substitute_character) { - zval **arg1; + zval *arg1; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |z, arg1) == FAILURE) { + return; + } if (ZEND_NUM_ARGS() == 0) { if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { - RETVAL_STRING(none, 1); + RETURN_STRING(none, 1); } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) { - RETVAL_STRING(long, 1); + RETURN_STRING(long, 1); } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) { - RETVAL_STRING(entity, 1); + RETURN_STRING(entity, 1); } else { - RETVAL_LONG(MBSTRG(current_filter_illegal_substchar)); + RETURN_LONG(MBSTRG(current_filter_illegal_substchar)); } - } else if (ZEND_NUM_ARGS() == 1 zend_get_parameters_ex(1, arg1) != FAILURE) { + } else {
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
indeyetsMon Jul 7 10:00:31 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: MFB: string length - int http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.279r2=1.280diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.279 php-src/ext/mbstring/mbstring.c:1.280 --- php-src/ext/mbstring/mbstring.c:1.279 Mon Jul 7 09:57:12 2008 +++ php-src/ext/mbstring/mbstring.c Mon Jul 7 10:00:30 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.279 2008/07/07 09:57:12 indeyets Exp $ */ +/* $Id: mbstring.c,v 1.280 2008/07/07 10:00:30 indeyets Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2099,8 +2099,8 @@ { size_t argc = ZEND_NUM_ARGS(); char *str, *encoding; - long str_len, from, len, encoding_len; - int mblen; + long from, len; + int mblen, str_len, encoding_len; 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) { @@ -2172,7 +2172,8 @@ { size_t argc = ZEND_NUM_ARGS(); char *str, *encoding; - long str_len, from, len, encoding_len; + long from, len; + int str_len, encoding_len; 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) { @@ -2276,7 +2277,8 @@ { zval **arg1, **arg2, **arg3, **arg4, **arg5; char *str, *trimmarker, *encoding; - long str_len, from, width, trimmarker_len, encoding_len; + long from, width; + int str_len, trimmarker_len, encoding_len; mbfl_string string, result, marker, *ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sll|ss, str, str_len, from, width, trimmarker, trimmarker_len, encoding, encoding_len) == FAILURE) { @@ -2419,7 +2421,7 @@ PHP_FUNCTION(mb_convert_encoding) { char *arg_str, *arg_new; - long str_len, new_len; + int str_len, new_len; zval *arg_old; int i; size_t size, l, n; @@ -2562,7 +2564,7 @@ PHP_FUNCTION(mb_detect_encoding) { char *str; - long str_len; + int str_len; zend_bool strict=0; zval *encoding_list; @@ -3202,7 +3204,7 @@ php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type) { char *str, *encoding; - long str_len, encoding_len; + int str_len, encoding_len; zval *zconvmap, **hash_entry; HashTable *target_hash; size_t argc = ZEND_NUM_ARGS(); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c php_mbregex.h
felipe Mon Jul 7 13:52:44 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c php_mbregex.h Log: MFB: - Added arginfo - Removed unnecessary #include zend_arg_defs.c http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.280r2=1.281diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.280 php-src/ext/mbstring/mbstring.c:1.281 --- php-src/ext/mbstring/mbstring.c:1.280 Mon Jul 7 10:00:30 2008 +++ php-src/ext/mbstring/mbstring.c Mon Jul 7 13:52:44 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.280 2008/07/07 10:00:30 indeyets Exp $ */ +/* $Id: mbstring.c,v 1.281 2008/07/07 13:52:44 felipe Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -163,32 +163,6 @@ /* }}} */ -static - ZEND_BEGIN_ARG_INFO(third_and_rest_force_ref, 1) - ZEND_ARG_PASS_INFO(0) - ZEND_ARG_PASS_INFO(0) - ZEND_END_ARG_INFO() - -static - ZEND_BEGIN_ARG_INFO_EX(mb_parse_str_arginfo, 0, 0, 1) - ZEND_ARG_INFO(0, encoded_string) - ZEND_ARG_ARRAY_INFO(1, result, 1) - ZEND_END_ARG_INFO() - -static - ZEND_BEGIN_ARG_INFO_EX(mb_convert_variables_arginfo, 1, 0, 3) - ZEND_ARG_INFO(0, to_encoding) - ZEND_ARG_INFO(0, from_encoding) - ZEND_ARG_INFO(1, vars) - ZEND_END_ARG_INFO() - -static - ZEND_BEGIN_ARG_INFO_EX(mb_ereg_arginfo, 0, 0, 2) - ZEND_ARG_INFO(0, pattern) - ZEND_ARG_INFO(0, string) - ZEND_ARG_INFO(1, regs) - ZEND_END_ARG_INFO() - /* {{{ mb_overload_def mb_ovld[] */ static const struct mb_overload_def mb_ovld[] = { {MB_OVERLOAD_MAIL, mail, mb_send_mail, mb_orig_mail}, @@ -215,48 +189,406 @@ }; /* }}} */ +/* {{{ arginfo */ +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_language, 0, 0, 0) + ZEND_ARG_INFO(0, language) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_internal_encoding, 0, 0, 0) + ZEND_ARG_INFO(0, encoding) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_http_input, 0, 0, 0) + ZEND_ARG_INFO(0, type) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_http_output, 0, 0, 0) + ZEND_ARG_INFO(0, encoding) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_detect_order, 0, 0, 0) + ZEND_ARG_INFO(0, encoding) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_substitute_character, 0, 0, 0) + ZEND_ARG_INFO(0, substchar) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_preferred_mime_name, 0, 0, 1) + ZEND_ARG_INFO(0, encoding) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_parse_str, 0, 0, 1) + ZEND_ARG_INFO(0, encoded_string) + ZEND_ARG_INFO(1, result) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_output_handler, 0, 0, 2) + ZEND_ARG_INFO(0, contents) + ZEND_ARG_INFO(0, status) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strlen, 0, 0, 1) + ZEND_ARG_INFO(0, str) + ZEND_ARG_INFO(0, encoding) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strpos, 0, 0, 2) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, encoding) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strrpos, 0, 0, 2) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, encoding) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_stripos, 0, 0, 2) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, encoding) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strripos, 0, 0, 2) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, encoding) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strstr, 0, 0, 2) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, part) + ZEND_ARG_INFO(0, encoding) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strrchr, 0, 0, 2) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, part) + ZEND_ARG_INFO(0, encoding) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_stristr, 0, 0, 2) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, part) + ZEND_ARG_INFO(0, encoding) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strrichr, 0, 0, 2) + ZEND_ARG_INFO(0, haystack) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_INFO(0, part) + ZEND_ARG_INFO(0,
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
felipe Mon Jul 7 13:55:42 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: - MFB: Removed unused variables http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.281r2=1.282diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.281 php-src/ext/mbstring/mbstring.c:1.282 --- php-src/ext/mbstring/mbstring.c:1.281 Mon Jul 7 13:52:44 2008 +++ php-src/ext/mbstring/mbstring.c Mon Jul 7 13:55:42 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.281 2008/07/07 13:52:44 felipe Exp $ */ +/* $Id: mbstring.c,v 1.282 2008/07/07 13:55:42 felipe Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2604,7 +2604,6 @@ Trim the string in terminal width */ PHP_FUNCTION(mb_strimwidth) { - zval **arg1, **arg2, **arg3, **arg4, **arg5; char *str, *trimmarker, *encoding; long from, width; int str_len, trimmarker_len, encoding_len; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
hirokawaFri Jun 13 14:47:48 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: fixed bug #27421 (by david at dfoerster dot de) mbstring.func_overload set in .htaccess becomes global http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.276r2=1.277diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.276 php-src/ext/mbstring/mbstring.c:1.277 --- php-src/ext/mbstring/mbstring.c:1.276 Sat Feb 16 08:49:07 2008 +++ php-src/ext/mbstring/mbstring.c Fri Jun 13 14:47:48 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.276 2008/02/16 08:49:07 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.277 2008/06/13 14:47:48 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1029,9 +1029,14 @@ /* clear overloaded function. */ if (MBSTRG(func_overload)){ p = (mb_ovld[0]); - while (p-type 0 zend_hash_find(EG(function_table), p-save_func, strlen(p-save_func)+1 , (void **)orig) == SUCCESS) { - zend_hash_update(EG(function_table), p-orig_func, strlen(p-orig_func)+1, orig, sizeof(zend_function), NULL); - zend_hash_del(EG(function_table), p-save_func, strlen(p-save_func)+1); + while (p-type 0) { + if ((MBSTRG(func_overload) p-type) == p-type + zend_hash_find(EG(function_table), p-save_func, + strlen(p-save_func)+1, (void **)orig) == SUCCESS) { + + zend_hash_update(EG(function_table), p-orig_func, strlen(p-orig_func)+1, orig, sizeof(zend_function), NULL); + zend_hash_del(EG(function_table), p-save_func, strlen(p-save_func)+1); + } p++; } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
hirokawaSat Feb 16 08:49:07 2008 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: MFB http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.275r2=1.276diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.275 php-src/ext/mbstring/mbstring.c:1.276 --- php-src/ext/mbstring/mbstring.c:1.275 Mon Dec 31 07:12:11 2007 +++ php-src/ext/mbstring/mbstring.c Sat Feb 16 08:49:07 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.275 2007/12/31 07:12:11 sebastian Exp $ */ +/* $Id: mbstring.c,v 1.276 2008/02/16 08:49:07 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -892,6 +892,8 @@ const struct mb_overload_def *p; MBSTRG(current_language) = MBSTRG(language); + php_mb_nls_get_default_detect_order_list(MBSTRG(language), +MBSTRG(default_detect_order_list), MBSTRG(default_detect_order_list_size)); if (MBSTRG(internal_encoding) == mbfl_no_encoding_invalid) { char *default_enc = NULL; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
bjori Wed Dec 26 21:01:15 2007 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: Fix typo (TAKAGI Masahiro) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.273r2=1.274diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.273 php-src/ext/mbstring/mbstring.c:1.274 --- php-src/ext/mbstring/mbstring.c:1.273 Sun Oct 7 05:15:04 2007 +++ php-src/ext/mbstring/mbstring.c Wed Dec 26 21:01:15 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.273 2007/10/07 05:15:04 davidw Exp $ */ +/* $Id: mbstring.c,v 1.274 2007/12/26 21:01:15 bjori Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2323,7 +2323,7 @@ convert_to_long_ex(arg2); from = Z_LVAL_PP(arg2); if (from 0 || from Z_STRLEN_PP(arg1)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Start position is out of reange); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Start position is out of range); RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c /ext/mbstring/libmbfl/mbfl mbfilter.h mbfl_convert.c
hirokawaMon Sep 24 11:50:55 2007 UTC Modified files: /php-src/ext/mbstring/libmbfl/mbfl mbfilter.h mbfl_convert.c /php-src/ext/mbstring mbstring.c Log: added support entity as substitute_character settin accoding to bug #39404 http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h?r1=1.6r2=1.7diff_format=u Index: php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h diff -u php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h:1.6 php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h:1.7 --- php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h:1.6Tue Mar 21 02:11:55 2006 +++ php-src/ext/mbstring/libmbfl/mbfl/mbfilter.hMon Sep 24 11:50:54 2007 @@ -104,6 +104,7 @@ #define MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE 0 #define MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR 1 #define MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG 2 +#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY 3 /* * buffering converter http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c?r1=1.7r2=1.8diff_format=u Index: php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c diff -u php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c:1.7 php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c:1.8 --- php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c:1.7Thu Dec 21 17:37:53 2006 +++ php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.cMon Sep 24 11:50:54 2007 @@ -386,9 +386,14 @@ ret = (*filter-filter_function)(filter-illegal_substchar, filter); break; case MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG: + case MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY: if (c = 0) { if (c MBFL_WCSGROUP_UCS4MAX) {/* unicode */ - ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)U+); + if (mode_backup == MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) { + ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)U+); + } else { /* entity */ + ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)#); + } } else { if (c MBFL_WCSGROUP_WCHARMAX) { m = c ~MBFL_WCSPLANE_MASK; @@ -432,6 +437,9 @@ if (m == 0 ret = 0) { ret = (*filter-filter_function)(mbfl_hexchar_table[0], filter); } + if (mode_backup == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) { + ret = mbfl_convert_filter_strcat(filter, (const unsigned char *);); + } } } break; http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.270r2=1.271diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.270 php-src/ext/mbstring/mbstring.c:1.271 --- php-src/ext/mbstring/mbstring.c:1.270 Thu Jul 12 15:28:37 2007 +++ php-src/ext/mbstring/mbstring.c Mon Sep 24 11:50:54 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.270 2007/07/12 15:28:37 masugata Exp $ */ +/* $Id: mbstring.c,v 1.271 2007/09/24 11:50:54 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -716,6 +716,9 @@ } else if (strcasecmp(long, new_value) == 0) { MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG; MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG; + } else if (strcasecmp(entity, new_value) == 0) { + MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY; + MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY; } else { MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; @@ -1328,6 +1331,8 @@ RETVAL_STRING(none, 1); } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) { RETVAL_STRING(long, 1); + } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) { + RETVAL_STRING(entity, 1); } else { RETVAL_LONG(MBSTRG(current_filter_illegal_substchar)); } @@ -1339,6 +1344,8 @@ MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE; } else if (strcasecmp(long, Z_STRVAL_PP(arg1)) == 0) {
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
masugataThu Jul 12 15:28:37 2007 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: Synced mail function in mb_send_mail function(Escape mail.force_extra_parameters value). http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.269r2=1.270diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.269 php-src/ext/mbstring/mbstring.c:1.270 --- php-src/ext/mbstring/mbstring.c:1.269 Wed Jul 11 17:39:04 2007 +++ php-src/ext/mbstring/mbstring.c Thu Jul 12 15:28:37 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.269 2007/07/11 17:39:04 johannes Exp $ */ +/* $Id: mbstring.c,v 1.270 2007/07/12 15:28:37 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3785,7 +3785,7 @@ headers = (char *)device.buffer; if (force_extra_parameters) { - extra_cmd = estrdup(force_extra_parameters); + extra_cmd = php_escape_shell_cmd(force_extra_parameters); } else if (extra_cmd) { extra_cmd = php_escape_shell_cmd(extra_cmd); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
masugataWed Apr 4 15:23:09 2007 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: Sync with mail function in mb_send_mail function(problem MOPB-33-2007:PHP and MOPB-34-2007:PHP). http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.267r2=1.268diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.267 php-src/ext/mbstring/mbstring.c:1.268 --- php-src/ext/mbstring/mbstring.c:1.267 Sat Feb 24 16:25:54 2007 +++ php-src/ext/mbstring/mbstring.c Wed Apr 4 15:23:09 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.267 2007/02/24 16:25:54 helly Exp $ */ +/* $Id: mbstring.c,v 1.268 2007/04/04 15:23:09 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3321,13 +3321,20 @@ #define SKIP_LONG_HEADER_SEP_MBSTRING(str, pos) \ if (str[pos] == '\r' str[pos + 1] == '\n' (str[pos + 2] == ' ' || str[pos + 2] == '\t')) {\ - pos += 3; \ - while (str[pos] == ' ' || str[pos] == '\t') { \ + pos += 2; \ + while (str[pos + 1] == ' ' || str[pos + 1] == '\t') { \ pos++; \ } \ continue; \ } +#define MAIL_ASCIIZ_CHECK_MBSTRING(str, len) \ + pp = str; \ + ee = pp + len; \ + while ((pp = memchr(pp, '\0', (ee - pp {\ + *pp = ' '; \ + } \ + #define APPEND_ONE_CHAR(ch) do { \ if (token.a 0) { \ smart_str_appendc(token, ch); \ @@ -3560,6 +3567,7 @@ HashTable ht_headers; smart_str *s; extern void mbfl_memory_device_unput(mbfl_memory_device *device); + char *pp, *ee; /* initialize */ mbfl_memory_device_init(device, 0, 0); @@ -3581,6 +3589,17 @@ return; } + /* ASCIIZ check */ + MAIL_ASCIIZ_CHECK_MBSTRING(to, to_len); + MAIL_ASCIIZ_CHECK_MBSTRING(subject, subject_len); + MAIL_ASCIIZ_CHECK_MBSTRING(message, message_len); + if (headers) { + MAIL_ASCIIZ_CHECK_MBSTRING(headers, headers_len); + } + if (extra_cmd) { + MAIL_ASCIIZ_CHECK_MBSTRING(extra_cmd, extra_cmd_len); + } + zend_hash_init(ht_headers, 0, NULL, (dtor_func_t) my_smart_str_dtor, 0); if (headers != NULL) { @@ -3795,6 +3814,7 @@ } #undef SKIP_LONG_HEADER_SEP_MBSTRING +#undef MAIL_ASCIIZ_CHECK_MBSTRING #undef APPEND_ONE_CHAR #undef SEPARATE_SMART_STR #undef PHP_MBSTR_MAIL_MIME_HEADER1 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
tony2001Fri Jan 12 12:06:34 2007 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: fix folding and ws http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.265r2=1.266diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.265 php-src/ext/mbstring/mbstring.c:1.266 --- php-src/ext/mbstring/mbstring.c:1.265 Mon Jan 1 09:29:25 2007 +++ php-src/ext/mbstring/mbstring.c Fri Jan 12 12:06:33 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.265 2007/01/01 09:29:25 sebastian Exp $ */ +/* $Id: mbstring.c,v 1.266 2007/01/12 12:06:33 tony2001 Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1740,7 +1740,7 @@ RETURN_FALSE; } - n = php_mb_stripos(0, old_haystack, old_haystack_len, old_needle, old_needle_len, offset, from_encoding TSRMLS_CC); + n = php_mb_stripos(0, old_haystack, old_haystack_len, old_needle, old_needle_len, offset, from_encoding TSRMLS_CC); if (n = 0) { RETVAL_LONG(n); @@ -1770,7 +1770,7 @@ RETURN_FALSE; } - n = php_mb_stripos(1, old_haystack, old_haystack_len, old_needle, old_needle_len, offset, from_encoding TSRMLS_CC); + n = php_mb_stripos(1, old_haystack, old_haystack_len, old_needle, old_needle_len, offset, from_encoding TSRMLS_CC); if (n = 0) { RETVAL_LONG(n); @@ -1954,6 +1954,7 @@ } } } +/* }}} */ /* {{{ proto string mb_strrichr(string haystack, string needle[, bool part[, string encoding]]) Finds the last occurrence of a character in a string within another, case insensitive */ @@ -1981,7 +1982,7 @@ RETURN_FALSE; } - n = php_mb_stripos(1, haystack.val, haystack.len, needle.val, needle.len, 0, from_encoding TSRMLS_CC); + n = php_mb_stripos(1, haystack.val, haystack.len, needle.val, needle.len, 0, from_encoding TSRMLS_CC); if (n 0) { RETURN_FALSE; @@ -2006,6 +2007,7 @@ } } } +/* }}} */ /* {{{ proto int mb_substr_count(string haystack, string needle [, string encoding]) Count the number of substring occurrences */ @@ -4252,6 +4254,7 @@ return ret ? 0 : -1; } +/* }}} */ /* {{{ MBSTRING_API int php_mb_gpc_encoding_detector() */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
iliaa Fri Nov 3 19:56:07 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: MFB: Fixed bug #39361 (Removed warning on empty haystack inside mb_strstr()). http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.262r2=1.263diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.262 php-src/ext/mbstring/mbstring.c:1.263 --- php-src/ext/mbstring/mbstring.c:1.262 Sun Oct 8 13:34:22 2006 +++ php-src/ext/mbstring/mbstring.c Fri Nov 3 19:56:07 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.262 2006/10/08 13:34:22 bjori Exp $ */ +/* $Id: mbstring.c,v 1.263 2006/11/03 19:56:07 iliaa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1821,10 +1821,6 @@ } } - if (haystack.len = 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty haystack); - RETURN_FALSE; - } if (needle.len = 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING,Empty needle); RETURN_FALSE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
nlopess Tue Sep 5 12:32:13 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: MFB (int-long) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.260r2=1.261diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.260 php-src/ext/mbstring/mbstring.c:1.261 --- php-src/ext/mbstring/mbstring.c:1.260 Thu Aug 24 16:51:00 2006 +++ php-src/ext/mbstring/mbstring.c Tue Sep 5 12:32:13 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.260 2006/08/24 16:51:00 masugata Exp $ */ +/* $Id: mbstring.c,v 1.261 2006/09/05 12:32:13 nlopess Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2775,7 +2775,7 @@ int trans_enc_name_len; char *linefeed = \r\n; int linefeed_len; - int indent = 0; + long indent = 0; mbfl_string_init(string); string.no_language = MBSTRG(current_language); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
masugataThu Aug 24 16:51:00 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: added returned value in mb_get_info( ). http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.259r2=1.260diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.259 php-src/ext/mbstring/mbstring.c:1.260 --- php-src/ext/mbstring/mbstring.c:1.259 Mon Jul 17 04:44:06 2006 +++ php-src/ext/mbstring/mbstring.c Thu Aug 24 16:51:00 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.259 2006/07/17 04:44:06 masugata Exp $ */ +/* $Id: mbstring.c,v 1.260 2006/08/24 16:51:00 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3792,6 +3792,7 @@ if ((name = (char *)mbfl_no_encoding2name(MBSTRG(current_http_output_encoding))) != NULL) { add_assoc_string(return_value, http_output, name, 1); } + add_assoc_long(return_value, func_overload, MBSTRG(func_overload)); if (MBSTRG(func_overload)){ over_func = (mb_ovld[0]); MAKE_STD_ZVAL(row1); @@ -3802,9 +3803,9 @@ } over_func++; } - add_assoc_zval(return_value, func_overload, row1); + add_assoc_zval(return_value, func_overload_list, row1); } else { - add_assoc_string(return_value, func_overload, no overload, 1); + add_assoc_string(return_value, func_overload_list, no overload, 1); } if (lang != NULL) { if ((name = (char *)mbfl_no_encoding2name(lang-mail_charset)) != NULL) { @@ -3881,6 +3882,8 @@ RETVAL_STRING(name, 1); } } else if (!strcasecmp(func_overload, typ)) { + RETVAL_LONG(MBSTRG(func_overload)); + } else if (!strcasecmp(func_overload_list, typ)) { if (MBSTRG(func_overload)){ over_func = (mb_ovld[0]); array_init(return_value); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
masugataMon Jul 17 04:44:06 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: added option parameter mb_strrpos( ). http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.258r2=1.259diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.258 php-src/ext/mbstring/mbstring.c:1.259 --- php-src/ext/mbstring/mbstring.c:1.258 Thu Jun 15 15:44:05 2006 +++ php-src/ext/mbstring/mbstring.c Mon Jul 17 04:44:06 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.258 2006/06/15 15:44:05 masugata Exp $ */ +/* $Id: mbstring.c,v 1.259 2006/07/17 04:44:06 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1632,11 +1632,12 @@ } /* }}} */ -/* {{{ proto int mb_strrpos(string haystack, string needle [, string encoding]) +/* {{{ proto int mb_strrpos(string haystack, string needle [, int offset [, string encoding]]) Find position of last occurrence of a string within another */ PHP_FUNCTION(mb_strrpos) { int n; + long offset = 0; mbfl_string haystack, needle; char *enc_name = NULL; int enc_name_len; @@ -1648,7 +1649,7 @@ needle.no_language = MBSTRG(current_language); needle.no_encoding = MBSTRG(current_internal_encoding); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|s, (char **)haystack.val, haystack.len, (char **)needle.val, needle.len, enc_name, enc_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|ls, (char **)haystack.val, haystack.len, (char **)needle.val, needle.len, offset, enc_name, enc_name_len) == FAILURE) { RETURN_FALSE; } @@ -1668,7 +1669,7 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING,Empty needle); RETURN_FALSE; } - n = mbfl_strpos(haystack, needle, 0, 1); + n = mbfl_strpos(haystack, needle, offset, 1); if (n = 0) { RETVAL_LONG(n); } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
masugataThu Jun 15 15:44:05 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: changed GINIT definition. http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.257r2=1.258diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.257 php-src/ext/mbstring/mbstring.c:1.258 --- php-src/ext/mbstring/mbstring.c:1.257 Tue Jun 13 13:12:18 2006 +++ php-src/ext/mbstring/mbstring.c Thu Jun 15 15:44:05 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.257 2006/06/13 13:12:18 dmitry Exp $ */ +/* $Id: mbstring.c,v 1.258 2006/06/15 15:44:05 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -780,37 +780,37 @@ /* {{{ module global initialize handler */ static PHP_GINIT_FUNCTION(mbstring) { - MBSTRG(language) = mbfl_no_language_uni; - MBSTRG(current_language) = MBSTRG(language); - MBSTRG(internal_encoding) = mbfl_no_encoding_invalid; - MBSTRG(current_internal_encoding) = MBSTRG(internal_encoding); + mbstring_globals-language = mbfl_no_language_uni; + mbstring_globals-current_language = mbstring_globals-language; + mbstring_globals-internal_encoding = mbfl_no_encoding_invalid; + mbstring_globals-current_internal_encoding = mbstring_globals-internal_encoding; #ifdef ZEND_MULTIBYTE - MBSTRG(script_encoding_list) = NULL; - MBSTRG(script_encoding_list_size) = 0; + mbstring_globals-script_encoding_list = NULL; + mbstring_globals-script_encoding_list_size = 0; #endif /* ZEND_MULTIBYTE */ - MBSTRG(http_output_encoding) = mbfl_no_encoding_pass; - MBSTRG(current_http_output_encoding) = mbfl_no_encoding_pass; - MBSTRG(http_input_identify) = mbfl_no_encoding_invalid; - MBSTRG(http_input_identify_get) = mbfl_no_encoding_invalid; - MBSTRG(http_input_identify_post) = mbfl_no_encoding_invalid; - MBSTRG(http_input_identify_cookie) = mbfl_no_encoding_invalid; - MBSTRG(http_input_identify_string) = mbfl_no_encoding_invalid; - MBSTRG(http_input_list) = NULL; - MBSTRG(http_input_list_size) = 0; - MBSTRG(detect_order_list) = NULL; - MBSTRG(detect_order_list_size) = 0; - MBSTRG(current_detect_order_list) = NULL; - MBSTRG(current_detect_order_list_size) = 0; - MBSTRG(default_detect_order_list) = (enum mbfl_no_encoding *) php_mb_default_identify_list_neut; - MBSTRG(default_detect_order_list_size) = sizeof(php_mb_default_identify_list_neut) / sizeof(php_mb_default_identify_list_neut[0]); - MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; - MBSTRG(filter_illegal_substchar) = 0x3f;/* '?' */ - MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; - MBSTRG(current_filter_illegal_substchar) = 0x3f;/* '?' */ - MBSTRG(illegalchars) = 0; - MBSTRG(func_overload) = 0; - MBSTRG(encoding_translation) = 0; - MBSTRG(strict_detection) = 0; + mbstring_globals-http_output_encoding = mbfl_no_encoding_pass; + mbstring_globals-current_http_output_encoding = mbfl_no_encoding_pass; + mbstring_globals-http_input_identify = mbfl_no_encoding_invalid; + mbstring_globals-http_input_identify_get = mbfl_no_encoding_invalid; + mbstring_globals-http_input_identify_post = mbfl_no_encoding_invalid; + mbstring_globals-http_input_identify_cookie = mbfl_no_encoding_invalid; + mbstring_globals-http_input_identify_string = mbfl_no_encoding_invalid; + mbstring_globals-http_input_list = NULL; + mbstring_globals-http_input_list_size = 0; + mbstring_globals-detect_order_list = NULL; + mbstring_globals-detect_order_list_size = 0; + mbstring_globals-current_detect_order_list = NULL; + mbstring_globals-current_detect_order_list_size = 0; + mbstring_globals-default_detect_order_list = (enum mbfl_no_encoding *) php_mb_default_identify_list_neut; + mbstring_globals-default_detect_order_list_size = sizeof(php_mb_default_identify_list_neut) / sizeof(php_mb_default_identify_list_neut[0]); + mbstring_globals-filter_illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; + mbstring_globals-filter_illegal_substchar = 0x3f; /* '?' */ + mbstring_globals-current_filter_illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; + mbstring_globals-current_filter_illegal_substchar = 0x3f; /* '?' */ + mbstring_globals-illegalchars = 0; + mbstring_globals-func_overload = 0; + mbstring_globals-encoding_translation = 0; + mbstring_globals-strict_detection = 0; mbstring_globals-outconv = NULL; #if HAVE_MBREGEX _php_mb_regex_globals_ctor(mbstring_globals TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
masugataThu May 11 14:37:42 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: fixed all mbstring setting information doesn't return in mb_get_info( ). http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.255r2=1.256diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.255 php-src/ext/mbstring/mbstring.c:1.256 --- php-src/ext/mbstring/mbstring.c:1.255 Tue Apr 4 15:14:28 2006 +++ php-src/ext/mbstring/mbstring.c Thu May 11 14:37:42 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.255 2006/04/04 15:14:28 masugata Exp $ */ +/* $Id: mbstring.c,v 1.256 2006/05/11 14:37:42 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -708,14 +708,18 @@ if (new_value != NULL) { if (strcasecmp(none, new_value) == 0) { MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE; + MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE; } else if (strcasecmp(long, new_value) == 0) { MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG; + MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG; } else { MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; + MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; if (new_value_length 0) { c = strtol(new_value, endptr, 0); if (*endptr == '\0') { MBSTRG(filter_illegal_substchar) = c; + MBSTRG(current_filter_illegal_substchar) = c; } } } @@ -3773,11 +3777,15 @@ PHP_FUNCTION(mb_get_info) { char *typ = NULL; - int typ_len; + int typ_len, n; char *name; const struct mb_overload_def *over_func; - zval *row; + zval *row1, *row2; const mbfl_language *lang = mbfl_no2language(MBSTRG(current_language)); + enum mbfl_no_encoding *entry; +#ifdef ZEND_MULTIBYTE + zval *row3; +#endif /* ZEND_MULTIBYTE */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |s, typ, typ_len) == FAILURE) { RETURN_FALSE; @@ -3796,15 +3804,15 @@ } if (MBSTRG(func_overload)){ over_func = (mb_ovld[0]); - MAKE_STD_ZVAL(row); - array_init(row); + MAKE_STD_ZVAL(row1); + array_init(row1); while (over_func-type 0) { if ((MBSTRG(func_overload) over_func-type) == over_func-type ) { - add_assoc_string(row, over_func-orig_func, over_func-ovld_func, 1); + add_assoc_string(row1, over_func-orig_func, over_func-ovld_func, 1); } over_func++; } - add_assoc_zval(return_value, func_overload, row); + add_assoc_zval(return_value, func_overload, row1); } else { add_assoc_string(return_value, func_overload, no overload, 1); } @@ -3819,6 +3827,57 @@ add_assoc_string(return_value, mail_body_encoding, name, 1); } } + add_assoc_long(return_value, illegal_chars, MBSTRG(illegalchars)); + if (MBSTRG(encoding_translation)) { + add_assoc_string(return_value, encoding_translation, On, 1); + } else { + add_assoc_string(return_value, encoding_translation, Off, 1); + } + if ((name = (char *)mbfl_no_language2name(MBSTRG(current_language))) != NULL) { + add_assoc_string(return_value, language, name, 1); + } + n = MBSTRG(current_detect_order_list_size); + entry = MBSTRG(current_detect_order_list); + if(n 0) { + MAKE_STD_ZVAL(row2); + array_init(row2); + while (n 0) { + if ((name = (char *)mbfl_no_encoding2name(*entry)) != NULL) { + add_next_index_string(row2, name, 1); + } + entry++; + n--; + } +
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
masugataTue Apr 4 15:14:28 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: fixed commnet typo, and duplicate logic. http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.254r2=1.255diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.254 php-src/ext/mbstring/mbstring.c:1.255 --- php-src/ext/mbstring/mbstring.c:1.254 Mon Apr 3 15:32:43 2006 +++ php-src/ext/mbstring/mbstring.c Tue Apr 4 15:14:28 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.254 2006/04/03 15:32:43 masugata Exp $ */ +/* $Id: mbstring.c,v 1.255 2006/04/04 15:14:28 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1640,7 +1640,7 @@ /* }}} */ /* {{{ proto int mb_strrpos(string haystack, string needle [, string encoding]) - Find the last occurrence of a character in a string within another */ + Find position of last occurrence of a string within another */ PHP_FUNCTION(mb_strrpos) { int n; @@ -1741,7 +1741,7 @@ PHP_FUNCTION(mb_strstr) { int n, len, mblen; - mbfl_string haystack, needle, result, *ret = NULL;; + mbfl_string haystack, needle, result, *ret = NULL; char *enc_name = NULL; int enc_name_len; zend_bool part = 0; @@ -1775,8 +1775,8 @@ } n = mbfl_strpos(haystack, needle, 0, 0); if (n = 0) { + mblen = mbfl_strlen(haystack); if (part) { - mblen = mbfl_strlen(haystack); ret = mbfl_substr(haystack, result, 0, n); if (ret != NULL) { RETVAL_STRINGL((char *)ret-val, ret-len, 0); @@ -1784,7 +1784,6 @@ RETVAL_FALSE; } } else { - mblen = mbfl_strlen(haystack); len = (mblen - n); ret = mbfl_substr(haystack, result, n, len); if (ret != NULL) { @@ -1804,7 +1803,7 @@ PHP_FUNCTION(mb_strrchr) { int n, len, mblen; - mbfl_string haystack, needle, result, *ret = NULL;; + mbfl_string haystack, needle, result, *ret = NULL; char *enc_name = NULL; int enc_name_len; zend_bool part = 0; @@ -1838,8 +1837,8 @@ } n = mbfl_strpos(haystack, needle, 0, 1); if (n = 0) { + mblen = mbfl_strlen(haystack); if (part) { - mblen = mbfl_strlen(haystack); ret = mbfl_substr(haystack, result, 0, n); if (ret != NULL) { RETVAL_STRINGL((char *)ret-val, ret-len, 0); @@ -1847,7 +1846,6 @@ RETVAL_FALSE; } } else { - mblen = mbfl_strlen(haystack); len = (mblen - n); ret = mbfl_substr(haystack, result, n, len); if (ret != NULL) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h
masugataMon Apr 3 15:32:43 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c mbstring.h Log: added mb_stristr( ), mb_strrichr( ). http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.253r2=1.254diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.253 php-src/ext/mbstring/mbstring.c:1.254 --- php-src/ext/mbstring/mbstring.c:1.253 Thu Mar 30 15:43:54 2006 +++ php-src/ext/mbstring/mbstring.c Mon Apr 3 15:32:43 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.253 2006/03/30 15:43:54 masugata Exp $ */ +/* $Id: mbstring.c,v 1.254 2006/04/03 15:32:43 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -177,6 +177,7 @@ {MB_OVERLOAD_STRING, strripos, mb_strripos, mb_orig_stripos}, {MB_OVERLOAD_STRING, strstr, mb_strstr, mb_orig_strstr}, {MB_OVERLOAD_STRING, strrchr, mb_strrchr, mb_orig_strrchr}, + {MB_OVERLOAD_STRING, stristr, mb_stristr, mb_orig_stristr}, {MB_OVERLOAD_STRING, substr, mb_substr, mb_orig_substr}, {MB_OVERLOAD_STRING, strtolower, mb_strtolower, mb_orig_strtolower}, {MB_OVERLOAD_STRING, strtoupper, mb_strtoupper, mb_orig_strtoupper}, @@ -213,6 +214,8 @@ PHP_FE(mb_strripos, NULL) PHP_FE(mb_strstr, NULL) PHP_FE(mb_strrchr, NULL) + PHP_FE(mb_stristr, NULL) + PHP_FE(mb_strrichr, NULL) PHP_FE(mb_substr_count, NULL) PHP_FE(mb_substr, NULL) PHP_FE(mb_strcut, NULL) @@ -1859,6 +1862,110 @@ } /* }}} */ +/* {{{ proto string mb_stristr(string haystack, string needle[, bool part[, string encoding]]) + Finds first occurrence of a string within another, case insensitive */ +PHP_FUNCTION(mb_stristr) +{ + zend_bool part = 0; + int n, from_encoding_len, len, mblen; + mbfl_string haystack, needle, result, *ret = NULL; + char *from_encoding = (char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); + mbfl_string_init(haystack); + mbfl_string_init(needle); + haystack.no_language = MBSTRG(current_language); + haystack.no_encoding = MBSTRG(current_internal_encoding); + needle.no_language = MBSTRG(current_language); + needle.no_encoding = MBSTRG(current_internal_encoding); + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|bs, (char **)haystack.val, haystack.len, (char **)needle.val, needle.len, part, from_encoding, from_encoding_len) == FAILURE) { + RETURN_FALSE; + } + + haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(from_encoding); + if (haystack.no_encoding == mbfl_no_encoding_invalid) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown encoding \%s\, from_encoding); + RETURN_FALSE; + } + + n = php_mb_stripos(0, haystack.val, haystack.len, needle.val, needle.len, 0, from_encoding TSRMLS_CC); + + if (n 0) { + RETURN_FALSE; + } + + mblen = mbfl_strlen(haystack); + + if (part) { + ret = mbfl_substr(haystack, result, 0, n); + if (ret != NULL) { + RETVAL_STRINGL((char *)ret-val, ret-len, 0); + } else { + RETVAL_FALSE; + } + } else { + len = (mblen - n); + ret = mbfl_substr(haystack, result, n, len); + if (ret != NULL) { + RETVAL_STRINGL((char *)ret-val, ret-len, 0); + } else { + RETVAL_FALSE; + } + } +} + +/* {{{ proto string mb_strrichr(string haystack, string needle[, bool part[, string encoding]]) + Finds the last occurrence of a character in a string within another, case insensitive */ +PHP_FUNCTION(mb_strrichr) +{ + zend_bool part = 0; + int n, from_encoding_len, len, mblen; + mbfl_string haystack, needle, result, *ret = NULL; + char *from_encoding = (char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); + mbfl_string_init(haystack); + mbfl_string_init(needle); + haystack.no_language = MBSTRG(current_language); + haystack.no_encoding = MBSTRG(current_internal_encoding); + needle.no_language = MBSTRG(current_language); + needle.no_encoding = MBSTRG(current_internal_encoding); + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|bs, (char **)haystack.val, haystack.len, (char **)needle.val, needle.len, part, from_encoding, from_encoding_len) == FAILURE) { + RETURN_FALSE; + } + + haystack.no_encoding
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h
masugataThu Mar 30 15:43:54 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c mbstring.h Log: added mb_stripos( ), mb_strripos( ). http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.252r2=1.253diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.252 php-src/ext/mbstring/mbstring.c:1.253 --- php-src/ext/mbstring/mbstring.c:1.252 Wed Mar 29 15:47:07 2006 +++ php-src/ext/mbstring/mbstring.c Thu Mar 30 15:43:54 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.252 2006/03/29 15:47:07 masugata Exp $ */ +/* $Id: mbstring.c,v 1.253 2006/03/30 15:43:54 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -173,6 +173,8 @@ {MB_OVERLOAD_STRING, strlen, mb_strlen, mb_orig_strlen}, {MB_OVERLOAD_STRING, strpos, mb_strpos, mb_orig_strpos}, {MB_OVERLOAD_STRING, strrpos, mb_strrpos, mb_orig_strrpos}, + {MB_OVERLOAD_STRING, stripos, mb_stripos, mb_orig_stripos}, + {MB_OVERLOAD_STRING, strripos, mb_strripos, mb_orig_stripos}, {MB_OVERLOAD_STRING, strstr, mb_strstr, mb_orig_strstr}, {MB_OVERLOAD_STRING, strrchr, mb_strrchr, mb_orig_strrchr}, {MB_OVERLOAD_STRING, substr, mb_substr, mb_orig_substr}, @@ -207,6 +209,8 @@ PHP_FE(mb_strlen, NULL) PHP_FE(mb_strpos, NULL) PHP_FE(mb_strrpos, NULL) + PHP_FE(mb_stripos, NULL) + PHP_FE(mb_strripos, NULL) PHP_FE(mb_strstr, NULL) PHP_FE(mb_strrchr, NULL) PHP_FE(mb_substr_count, NULL) @@ -1677,6 +1681,58 @@ } /* }}} */ +/* {{{ proto int mb_stripos(string haystack, string needle [, int offset [, string encoding]]) + Finds position of first occurrence of a string within another, case insensitive */ +PHP_FUNCTION(mb_stripos) +{ + int n; + long offset; + char *old_haystack, *old_needle; + char *from_encoding = (char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); + int old_haystack_len, old_needle_len, from_encoding_len; + n = -1; + offset = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|ls, old_haystack, old_haystack_len, old_needle, old_needle_len, offset, from_encoding, from_encoding_len ) == FAILURE) { + RETURN_FALSE; + } + + n = php_mb_stripos(0, old_haystack, old_haystack_len, old_needle, old_needle_len, offset, from_encoding TSRMLS_CC); + + if (n = 0) { + RETVAL_LONG(n); + } else { + RETVAL_FALSE; + } +} +/* }}} */ + +/* {{{ proto int mb_strripos(string haystack, string needle [, int offset [, string encoding]]) + Finds position of last occurrence of a string within another, case insensitive */ +PHP_FUNCTION(mb_strripos) +{ + int n; + long offset; + char *old_haystack, *old_needle; + char *from_encoding = (char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); + int old_haystack_len, old_needle_len, from_encoding_len; + n = -1; + offset = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|ls, old_haystack, old_haystack_len, old_needle, old_needle_len, offset, from_encoding, from_encoding_len ) == FAILURE) { + RETURN_FALSE; + } + + n = php_mb_stripos(1, old_haystack, old_haystack_len, old_needle, old_needle_len, offset, from_encoding TSRMLS_CC); + + if (n = 0) { + RETVAL_LONG(n); + } else { + RETVAL_FALSE; + } +} +/* }}} */ + /* {{{ proto string mb_strstr(string haystack, string needle[, bool part[, string encoding]]) Finds first occurrence of a string within another */ PHP_FUNCTION(mb_strstr) @@ -4008,6 +4064,71 @@ } /* }}} */ +/* {{{ MBSTRING_API int php_mb_stripos() + */ + +MBSTRING_API int php_mb_stripos(int mode, char *old_haystack, int old_haystack_len, char *old_needle, int old_needle_len, long offset, char *from_encoding TSRMLS_DC) +{ + int n; + mbfl_string haystack, needle; + n = -1; + + mbfl_string_init(haystack); + mbfl_string_init(needle); + haystack.no_language = MBSTRG(current_language); + haystack.no_encoding = MBSTRG(current_internal_encoding); + needle.no_language = MBSTRG(current_language); + needle.no_encoding = MBSTRG(current_internal_encoding); + + do { + haystack.val = php_unicode_convert_case(PHP_UNICODE_CASE_UPPER, old_haystack, (size_t) old_haystack_len, haystack.len, from_encoding TSRMLS_CC); + + if (!haystack.val) { + break; + } + + if (haystack.len =
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h
On Thu, 30 Mar 2006, Seiji Masugata wrote: masugata Thu Mar 30 15:43:54 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c mbstring.h Log: added mb_stripos( ), mb_strripos( ). Just wondering... but why are you adding mb_String functions to HEAD? PHP in HEAD has full unicode support which makes the mbstring extension obsolete. regards, Derick -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h
Hi, Derick. Just wondering... but why are you adding mb_String functions to HEAD? PHP in HEAD has full unicode support which makes the mbstring extension obsolete. PHP_5_1 Branch is release process. If PHP5.1.3 is released, it will be applied to PHP_5_1 Branch. Can't think that all application can shift to the Unicode at once. Thank you. -- Seiji Masugata -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h
masugataWed Mar 29 15:47:07 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c mbstring.h Log: added mb_strrchr( ). http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.251r2=1.252diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.251 php-src/ext/mbstring/mbstring.c:1.252 --- php-src/ext/mbstring/mbstring.c:1.251 Tue Mar 28 16:05:16 2006 +++ php-src/ext/mbstring/mbstring.c Wed Mar 29 15:47:07 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.251 2006/03/28 16:05:16 masugata Exp $ */ +/* $Id: mbstring.c,v 1.252 2006/03/29 15:47:07 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -174,6 +174,7 @@ {MB_OVERLOAD_STRING, strpos, mb_strpos, mb_orig_strpos}, {MB_OVERLOAD_STRING, strrpos, mb_strrpos, mb_orig_strrpos}, {MB_OVERLOAD_STRING, strstr, mb_strstr, mb_orig_strstr}, + {MB_OVERLOAD_STRING, strrchr, mb_strrchr, mb_orig_strrchr}, {MB_OVERLOAD_STRING, substr, mb_substr, mb_orig_substr}, {MB_OVERLOAD_STRING, strtolower, mb_strtolower, mb_orig_strtolower}, {MB_OVERLOAD_STRING, strtoupper, mb_strtoupper, mb_orig_strtoupper}, @@ -207,6 +208,7 @@ PHP_FE(mb_strpos, NULL) PHP_FE(mb_strrpos, NULL) PHP_FE(mb_strstr, NULL) + PHP_FE(mb_strrchr, NULL) PHP_FE(mb_substr_count, NULL) PHP_FE(mb_substr, NULL) PHP_FE(mb_strcut, NULL) @@ -1738,6 +1740,69 @@ } /* }}} */ +/* {{{ proto string mb_strrchr(string haystack, string needle[, bool part[, string encoding]]) + Finds the last occurrence of a character in a string within another */ +PHP_FUNCTION(mb_strrchr) +{ + int n, len, mblen; + mbfl_string haystack, needle, result, *ret = NULL;; + char *enc_name = NULL; + int enc_name_len; + zend_bool part = 0; + + mbfl_string_init(haystack); + mbfl_string_init(needle); + haystack.no_language = MBSTRG(current_language); + haystack.no_encoding = MBSTRG(current_internal_encoding); + needle.no_language = MBSTRG(current_language); + needle.no_encoding = MBSTRG(current_internal_encoding); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|bs, (char **)haystack.val, haystack.len, (char **)needle.val, needle.len, part, enc_name, enc_name_len) == FAILURE) { + RETURN_FALSE; + } + + if (enc_name != NULL) { + haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(enc_name); + if (haystack.no_encoding == mbfl_no_encoding_invalid) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown encoding \%s\, enc_name); + RETURN_FALSE; + } + } + + if (haystack.len = 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty haystack); + RETURN_FALSE; + } + if (needle.len = 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING,Empty needle); + RETURN_FALSE; + } + n = mbfl_strpos(haystack, needle, 0, 1); + if (n = 0) { + if (part) { + mblen = mbfl_strlen(haystack); + ret = mbfl_substr(haystack, result, 0, n); + if (ret != NULL) { + RETVAL_STRINGL((char *)ret-val, ret-len, 0); + } else { + RETVAL_FALSE; + } + } else { + mblen = mbfl_strlen(haystack); + len = (mblen - n); + ret = mbfl_substr(haystack, result, n, len); + if (ret != NULL) { + RETVAL_STRINGL((char *)ret-val, ret-len, 0); + } else { + RETVAL_FALSE; + } + } + } else { + RETVAL_FALSE; + } +} +/* }}} */ + /* {{{ proto int mb_substr_count(string haystack, string needle [, string encoding]) Count the number of substring occurrences */ PHP_FUNCTION(mb_substr_count) http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.h?r1=1.73r2=1.74diff_format=u Index: php-src/ext/mbstring/mbstring.h diff -u php-src/ext/mbstring/mbstring.h:1.73 php-src/ext/mbstring/mbstring.h:1.74 --- php-src/ext/mbstring/mbstring.h:1.73Tue Mar 28 16:05:16 2006 +++ php-src/ext/mbstring/mbstring.h Wed Mar 29 15:47:07 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mbstring.h,v 1.73 2006/03/28
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h
masugataTue Mar 28 16:05:16 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c mbstring.h Log: added mb_strstr( ). http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.250r2=1.251diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.250 php-src/ext/mbstring/mbstring.c:1.251 --- php-src/ext/mbstring/mbstring.c:1.250 Mon Mar 27 15:20:02 2006 +++ php-src/ext/mbstring/mbstring.c Tue Mar 28 16:05:16 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.250 2006/03/27 15:20:02 masugata Exp $ */ +/* $Id: mbstring.c,v 1.251 2006/03/28 16:05:16 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -173,6 +173,7 @@ {MB_OVERLOAD_STRING, strlen, mb_strlen, mb_orig_strlen}, {MB_OVERLOAD_STRING, strpos, mb_strpos, mb_orig_strpos}, {MB_OVERLOAD_STRING, strrpos, mb_strrpos, mb_orig_strrpos}, + {MB_OVERLOAD_STRING, strstr, mb_strstr, mb_orig_strstr}, {MB_OVERLOAD_STRING, substr, mb_substr, mb_orig_substr}, {MB_OVERLOAD_STRING, strtolower, mb_strtolower, mb_orig_strtolower}, {MB_OVERLOAD_STRING, strtoupper, mb_strtoupper, mb_orig_strtoupper}, @@ -205,6 +206,7 @@ PHP_FE(mb_strlen, NULL) PHP_FE(mb_strpos, NULL) PHP_FE(mb_strrpos, NULL) + PHP_FE(mb_strstr, NULL) PHP_FE(mb_substr_count, NULL) PHP_FE(mb_substr, NULL) PHP_FE(mb_strcut, NULL) @@ -1673,6 +1675,69 @@ } /* }}} */ +/* {{{ proto string mb_strstr(string haystack, string needle[, bool part[, string encoding]]) + Finds first occurrence of a string within another */ +PHP_FUNCTION(mb_strstr) +{ + int n, len, mblen; + mbfl_string haystack, needle, result, *ret = NULL;; + char *enc_name = NULL; + int enc_name_len; + zend_bool part = 0; + + mbfl_string_init(haystack); + mbfl_string_init(needle); + haystack.no_language = MBSTRG(current_language); + haystack.no_encoding = MBSTRG(current_internal_encoding); + needle.no_language = MBSTRG(current_language); + needle.no_encoding = MBSTRG(current_internal_encoding); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|bs, (char **)haystack.val, haystack.len, (char **)needle.val, needle.len, part, enc_name, enc_name_len) == FAILURE) { + RETURN_FALSE; + } + + if (enc_name != NULL) { + haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(enc_name); + if (haystack.no_encoding == mbfl_no_encoding_invalid) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown encoding \%s\, enc_name); + RETURN_FALSE; + } + } + + if (haystack.len = 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty haystack); + RETURN_FALSE; + } + if (needle.len = 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING,Empty needle); + RETURN_FALSE; + } + n = mbfl_strpos(haystack, needle, 0, 0); + if (n = 0) { + if (part) { + mblen = mbfl_strlen(haystack); + ret = mbfl_substr(haystack, result, 0, n); + if (ret != NULL) { + RETVAL_STRINGL((char *)ret-val, ret-len, 0); + } else { + RETVAL_FALSE; + } + } else { + mblen = mbfl_strlen(haystack); + len = (mblen - n); + ret = mbfl_substr(haystack, result, n, len); + if (ret != NULL) { + RETVAL_STRINGL((char *)ret-val, ret-len, 0); + } else { + RETVAL_FALSE; + } + } + } else { + RETVAL_FALSE; + } +} +/* }}} */ + /* {{{ proto int mb_substr_count(string haystack, string needle [, string encoding]) Count the number of substring occurrences */ PHP_FUNCTION(mb_substr_count) http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.h?r1=1.72r2=1.73diff_format=u Index: php-src/ext/mbstring/mbstring.h diff -u php-src/ext/mbstring/mbstring.h:1.72 php-src/ext/mbstring/mbstring.h:1.73 --- php-src/ext/mbstring/mbstring.h:1.72Mon Mar 27 15:20:02 2006 +++ php-src/ext/mbstring/mbstring.h Tue Mar 28 16:05:16 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mbstring.h,v 1.72 2006/03/27 15:20:02 masugata Exp $ */ +/*
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h
masugataMon Mar 27 15:20:02 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c mbstring.h Log: added mb_list_mime_names( ). http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.249r2=1.250diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.249 php-src/ext/mbstring/mbstring.c:1.250 --- php-src/ext/mbstring/mbstring.c:1.249 Sun Mar 26 02:23:25 2006 +++ php-src/ext/mbstring/mbstring.c Mon Mar 27 15:20:02 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.249 2006/03/26 02:23:25 masugata Exp $ */ +/* $Id: mbstring.c,v 1.250 2006/03/27 15:20:02 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -214,6 +214,7 @@ PHP_FE(mb_detect_encoding, NULL) PHP_FE(mb_list_encodings, NULL) PHP_FE(mb_list_encodings_alias_names, NULL) + PHP_FE(mb_list_mime_names, NULL) PHP_FE(mb_convert_kana, NULL) PHP_FE(mb_encode_mimeheader,NULL) PHP_FE(mb_decode_mimeheader,NULL) @@ -2425,6 +2426,58 @@ } /* }}} */ +/* {{{ proto mixed mb_list_mime_names([string encoding]) + Returns an array or string of all supported mime names */ +PHP_FUNCTION(mb_list_mime_names) +{ + const mbfl_encoding **encodings; + const mbfl_encoding *encoding; + enum mbfl_no_encoding no_encoding; + int i; + char *name = NULL; + int name_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |s, name, name_len) == FAILURE) { + RETURN_FALSE; + } + + if (name == NULL) { + array_init(return_value); + i = 0; + encodings = mbfl_get_supported_encodings(); + while ((encoding = encodings[i++]) != NULL) { + if(encoding-mime_name != NULL) { + add_assoc_string(return_value, (char *) encoding-name, (char *) encoding-mime_name, 1); + } else{ + add_assoc_string(return_value, (char *) encoding-name, , 1); + } + } + } else { + no_encoding = mbfl_name2no_encoding(name); + if (no_encoding == mbfl_no_encoding_invalid) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown encoding \%s\, name); + RETURN_FALSE; + } + + name = (char *)mbfl_no_encoding2name(no_encoding); + if (name != NULL) { + i = 0; + encodings = mbfl_get_supported_encodings(); + while ((encoding = encodings[i++]) != NULL) { + if (strcmp(encoding-name, name) != 0){ continue; } + if(encoding-mime_name != NULL) { + RETURN_STRING((char *) encoding-mime_name, 1); + } + break; + } + RETURN_STRING(, 1); + } else { + RETURN_FALSE; + } + } +} +/* }}} */ + /* {{{ proto string mb_encode_mimeheader(string str [, string charset [, string transfer-encoding [, string linefeed [, int indent) Converts the string to MIME encoded-word in the format of =?charset?(B|Q)?encoded_string?= */ PHP_FUNCTION(mb_encode_mimeheader) http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.h?r1=1.71r2=1.72diff_format=u Index: php-src/ext/mbstring/mbstring.h diff -u php-src/ext/mbstring/mbstring.h:1.71 php-src/ext/mbstring/mbstring.h:1.72 --- php-src/ext/mbstring/mbstring.h:1.71Thu Mar 23 20:14:41 2006 +++ php-src/ext/mbstring/mbstring.h Mon Mar 27 15:20:02 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mbstring.h,v 1.71 2006/03/23 20:14:41 masugata Exp $ */ +/* $Id: mbstring.h,v 1.72 2006/03/27 15:20:02 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring (currently only for Japanese) @@ -113,6 +113,7 @@ PHP_FUNCTION(mb_detect_encoding); PHP_FUNCTION(mb_list_encodings); PHP_FUNCTION(mb_list_encodings_alias_names); +PHP_FUNCTION(mb_list_mime_names); PHP_FUNCTION(mb_convert_kana); PHP_FUNCTION(mb_encode_mimeheader); PHP_FUNCTION(mb_decode_mimeheader); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
masugataSun Mar 26 02:23:25 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: fixed compiler warning. http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.248r2=1.249diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.248 php-src/ext/mbstring/mbstring.c:1.249 --- php-src/ext/mbstring/mbstring.c:1.248 Thu Mar 23 20:14:41 2006 +++ php-src/ext/mbstring/mbstring.c Sun Mar 26 02:23:25 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.248 2006/03/23 20:14:41 masugata Exp $ */ +/* $Id: mbstring.c,v 1.249 2006/03/26 02:23:25 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3528,10 +3528,8 @@ int var_len; char *enc = NULL; int enc_len; - char *name; mbfl_buffer_converter *convd; enum mbfl_no_encoding no_encoding = MBSTRG(current_internal_encoding); - zval *row; mbfl_string string, result, *ret = NULL; long illegalchars = 0; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h
masugataThu Mar 23 20:14:41 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c mbstring.h Log: added mb_list_encodings_alias_names( ). http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.247r2=1.248diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.247 php-src/ext/mbstring/mbstring.c:1.248 --- php-src/ext/mbstring/mbstring.c:1.247 Tue Mar 21 07:47:43 2006 +++ php-src/ext/mbstring/mbstring.c Thu Mar 23 20:14:41 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.247 2006/03/21 07:47:43 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.248 2006/03/23 20:14:41 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -213,6 +213,7 @@ PHP_FE(mb_convert_encoding, NULL) PHP_FE(mb_detect_encoding, NULL) PHP_FE(mb_list_encodings, NULL) + PHP_FE(mb_list_encodings_alias_names, NULL) PHP_FE(mb_convert_kana, NULL) PHP_FE(mb_encode_mimeheader,NULL) PHP_FE(mb_decode_mimeheader,NULL) @@ -2360,6 +2361,70 @@ } /* }}} */ +/* {{{ proto array mb_list_encodings_alias_names([string encoding]) + Returns an array of all supported alias encodings */ +PHP_FUNCTION(mb_list_encodings_alias_names) +{ + const mbfl_encoding **encodings; + const mbfl_encoding *encoding; + enum mbfl_no_encoding no_encoding; + int i, j; + zval *row; + char *name = NULL; + int name_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |s, name, name_len) == FAILURE) { + RETURN_FALSE; + } + + if (name == NULL) { + array_init(return_value); + i = 0; + encodings = mbfl_get_supported_encodings(); + while ((encoding = encodings[i++]) != NULL) { + MAKE_STD_ZVAL(row); + array_init(row); + if (encoding-aliases != NULL) { + j = 0; + while ((*encoding-aliases)[j] != NULL) { + add_next_index_string(row, (char *)(*encoding-aliases)[j], 1); + j++; + } + } + add_assoc_zval(return_value, (char *) encoding-name, row); + } + } else { + no_encoding = mbfl_name2no_encoding(name); + if (no_encoding == mbfl_no_encoding_invalid) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown encoding \%s\, name); + RETURN_FALSE; + } + + name = (char *)mbfl_no_encoding2name(no_encoding); + if (name != NULL) { + i = 0; + encodings = mbfl_get_supported_encodings(); + while ((encoding = encodings[i++]) != NULL) { + if (strcmp(encoding-name, name) != 0){ continue; } + + array_init(return_value); + if (encoding-aliases != NULL) { + j = 0; + while ((*encoding-aliases)[j] != NULL) { + add_next_index_string(return_value, (char *)(*encoding-aliases)[j], 1); + j++; + } + } + + break; + } + } else { + RETURN_FALSE; + } + } +} +/* }}} */ + /* {{{ proto string mb_encode_mimeheader(string str [, string charset [, string transfer-encoding [, string linefeed [, int indent) Converts the string to MIME encoded-word in the format of =?charset?(B|Q)?encoded_string?= */ PHP_FUNCTION(mb_encode_mimeheader) http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.h?r1=1.70r2=1.71diff_format=u Index: php-src/ext/mbstring/mbstring.h diff -u php-src/ext/mbstring/mbstring.h:1.70 php-src/ext/mbstring/mbstring.h:1.71 --- php-src/ext/mbstring/mbstring.h:1.70Tue Mar 21 07:47:43 2006 +++ php-src/ext/mbstring/mbstring.h Thu Mar 23 20:14:41 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mbstring.h,v 1.70 2006/03/21 07:47:43 hirokawa Exp $ */ +/* $Id: mbstring.h,v 1.71 2006/03/23 20:14:41 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring (currently only for Japanese) @@ -112,6 +112,7 @@ PHP_FUNCTION(mb_convert_encoding); PHP_FUNCTION(mb_detect_encoding); PHP_FUNCTION(mb_list_encodings); +PHP_FUNCTION(mb_list_encodings_alias_names);
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h /ext/mbstring/libmbfl/mbfl mbfilter.c mbfilter.h mbfl_convert.c mbfl_convert.h
hirokawaTue Mar 21 02:11:55 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c mbstring.h /php-src/ext/mbstring/libmbfl/mbfl mbfilter.c mbfilter.h mbfl_convert.c mbfl_convert.h Log: MF PHP_5_1 http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.244r2=1.245diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.244 php-src/ext/mbstring/mbstring.c:1.245 --- php-src/ext/mbstring/mbstring.c:1.244 Thu Mar 16 15:21:12 2006 +++ php-src/ext/mbstring/mbstring.c Tue Mar 21 02:11:55 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.244 2006/03/16 15:21:12 masugata Exp $ */ +/* $Id: mbstring.c,v 1.245 2006/03/21 02:11:55 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -786,6 +786,7 @@ MBSTRG(filter_illegal_substchar) = 0x3f;/* '?' */ MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; MBSTRG(current_filter_illegal_substchar) = 0x3f;/* '?' */ + MBSTRG(illegalchars) = 0; MBSTRG(func_overload) = 0; MBSTRG(encoding_translation) = 0; MBSTRG(strict_detection) = 0; @@ -928,6 +929,7 @@ MBSTRG(current_http_output_encoding) = MBSTRG(http_output_encoding); MBSTRG(current_filter_illegal_mode) = MBSTRG(filter_illegal_mode); MBSTRG(current_filter_illegal_substchar) = MBSTRG(filter_illegal_substchar); + MBSTRG(illegalchars) = 0; n = 0; if (MBSTRG(detect_order_list)) { @@ -996,6 +998,7 @@ MBSTRG(current_detect_order_list_size) = 0; } if (MBSTRG(outconv) != NULL) { + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(MBSTRG(outconv)); mbfl_buffer_converter_delete(MBSTRG(outconv)); MBSTRG(outconv) = NULL; } @@ -1451,6 +1454,7 @@ if ((arg_status PHP_OUTPUT_HANDLER_START) != 0) { /* delete the converter just in case. */ if (MBSTRG(outconv)) { + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(MBSTRG(outconv)); mbfl_buffer_converter_delete(MBSTRG(outconv)); MBSTRG(outconv) = NULL; } @@ -1515,6 +1519,7 @@ /* delete the converter if it is the last feed. */ if (last_feed) { + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(MBSTRG(outconv)); mbfl_buffer_converter_delete(MBSTRG(outconv)); MBSTRG(outconv) = NULL; } @@ -2079,6 +2084,7 @@ output = (char *)ret-val; } + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(MBSTRG(outconv)); mbfl_buffer_converter_delete(convd); return output; } @@ -2747,6 +2753,7 @@ } efree(stack); + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); mbfl_buffer_converter_delete(convd); } @@ -3439,6 +3446,8 @@ if (lang != NULL (name = (char *)mbfl_no_encoding2name(lang-mail_body_encoding)) != NULL) { RETVAL_STRING(name, 1); } + } else if (!strcasecmp(illegalchars, typ)) { + RETVAL_LONG(MBSTRG(illegalchars)); } else { RETURN_FALSE; } @@ -3605,6 +3614,7 @@ str[i] = ret-val; len[i] = ret-len; } + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); mbfl_buffer_converter_delete(convd); } @@ -3821,6 +3831,7 @@ *to = ret-val; *to_length = ret-len; } + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); mbfl_buffer_converter_delete(convd); return ret ? 0 : -1; http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.h?r1=1.68r2=1.69diff_format=u Index: php-src/ext/mbstring/mbstring.h diff -u php-src/ext/mbstring/mbstring.h:1.68 php-src/ext/mbstring/mbstring.h:1.69 --- php-src/ext/mbstring/mbstring.h:1.68Sun Jan 1 13:09:51 2006 +++ php-src/ext/mbstring/mbstring.h Tue Mar 21 02:11:55 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mbstring.h,v 1.68 2006/01/01 13:09:51 sniper Exp $ */ +/* $Id: mbstring.h,v 1.69 2006/03/21 02:11:55 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring (currently only for Japanese) @@ -181,6 +181,7 @@ long func_overload; zend_bool encoding_translation; long strict_detection; + long illegalchars; mbfl_buffer_converter *outconv; #if HAVE_MBREGEX defined(PHP_MBREGEX_GLOBALS) PHP_MBREGEX_GLOBALS
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
hirokawaTue Mar 21 02:19:59 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: changed a option name based on PHP naming convension. http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.245r2=1.246diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.245 php-src/ext/mbstring/mbstring.c:1.246 --- php-src/ext/mbstring/mbstring.c:1.245 Tue Mar 21 02:11:55 2006 +++ php-src/ext/mbstring/mbstring.c Tue Mar 21 02:19:59 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.245 2006/03/21 02:11:55 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.246 2006/03/21 02:19:59 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3446,7 +3446,7 @@ if (lang != NULL (name = (char *)mbfl_no_encoding2name(lang-mail_body_encoding)) != NULL) { RETVAL_STRING(name, 1); } - } else if (!strcasecmp(illegalchars, typ)) { + } else if (!strcasecmp(illegal_chars, typ)) { RETVAL_LONG(MBSTRG(illegalchars)); } else { RETURN_FALSE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h /ext/mbstring/libmbfl/mbfl mbfilter.c
hirokawaTue Mar 21 07:47:43 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c mbstring.h /php-src/ext/mbstring/libmbfl/mbfl mbfilter.c Log: added mb_check_encoding() to detect possible invalid encoding attack. http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.246r2=1.247diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.246 php-src/ext/mbstring/mbstring.c:1.247 --- php-src/ext/mbstring/mbstring.c:1.246 Tue Mar 21 02:19:59 2006 +++ php-src/ext/mbstring/mbstring.c Tue Mar 21 07:47:43 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.246 2006/03/21 02:19:59 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.247 2006/03/21 07:47:43 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -221,6 +221,7 @@ PHP_FE(mb_decode_numericentity, NULL) PHP_FE(mb_send_mail,NULL) PHP_FE(mb_get_info, NULL) + PHP_FE(mb_check_encoding, NULL) #if HAVE_MBREGEX PHP_MBREGEX_FUNCTION_ENTRIES #endif @@ -2084,7 +2085,7 @@ output = (char *)ret-val; } - MBSTRG(illegalchars) += mbfl_buffer_illegalchars(MBSTRG(outconv)); + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); mbfl_buffer_converter_delete(convd); return output; } @@ -3454,6 +3455,67 @@ } /* }}} */ +/* {{{ proto bool mb_check_encoding([string var[, string encoding]]) + Check if the string is valid for the specified encoding */ +PHP_FUNCTION(mb_check_encoding) +{ + char *var = NULL; + int var_len; + char *enc = NULL; + int enc_len; + char *name; + mbfl_buffer_converter *convd; + enum mbfl_no_encoding no_encoding = MBSTRG(current_internal_encoding); + zval *row; + mbfl_string string, result, *ret = NULL; + long illegalchars = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |ss, var, var_len, enc, enc_len) == FAILURE) { + RETURN_FALSE; + } + + if (var == NULL) { + RETURN_BOOL(MBSTRG(illegalchars) == 0); + } + + if (enc != NULL) { + no_encoding = mbfl_name2no_encoding(enc); + if (no_encoding == mbfl_no_encoding_invalid || no_encoding == mbfl_no_encoding_pass) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid encoding \%s\, enc); + RETURN_FALSE; + } + } + + convd = mbfl_buffer_converter_new(no_encoding, no_encoding, 0); + if (convd == NULL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to create converter); + RETURN_FALSE; + } + mbfl_buffer_converter_illegal_mode(convd, MBSTRG(current_filter_illegal_mode)); + mbfl_buffer_converter_illegal_substchar(convd, MBSTRG(current_filter_illegal_substchar)); + + /* initialize string */ + mbfl_string_init(string); + mbfl_string_init(result); + string.no_encoding = no_encoding; + string.no_language = MBSTRG(current_language); + + string.val = (unsigned char *)var; + string.len = var_len; + ret = mbfl_buffer_converter_feed_result(convd, string, result); + illegalchars = mbfl_buffer_illegalchars(convd); + mbfl_buffer_converter_delete(convd); + + if (ret != NULL) { + MBSTRG(illegalchars) += illegalchars; + efree(ret-val); + RETURN_BOOL(illegalchars == 0); + } else { + RETURN_FALSE; + } +} +/* }}} */ + /* {{{ MBSTRING_API int php_mb_encoding_translation() */ MBSTRING_API int php_mb_encoding_translation(TSRMLS_D) { @@ -3614,6 +3676,7 @@ str[i] = ret-val; len[i] = ret-len; } + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); mbfl_buffer_converter_delete(convd); } @@ -3831,6 +3894,7 @@ *to = ret-val; *to_length = ret-len; } + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); mbfl_buffer_converter_delete(convd); http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.h?r1=1.69r2=1.70diff_format=u Index: php-src/ext/mbstring/mbstring.h diff -u php-src/ext/mbstring/mbstring.h:1.69 php-src/ext/mbstring/mbstring.h:1.70 --- php-src/ext/mbstring/mbstring.h:1.69Tue Mar 21 02:11:55 2006 +++ php-src/ext/mbstring/mbstring.h Tue Mar 21 07:47:43 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mbstring.h,v 1.69 2006/03/21 02:11:55 hirokawa Exp $ */ +/* $Id: mbstring.h,v 1.70 2006/03/21 07:47:43 hirokawa Exp $ */ /* * PHP 4 Multibyte String
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
masugataThu Mar 16 15:21:12 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: added option parameter mb_list_encodings( ). http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.243r2=1.244diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.243 php-src/ext/mbstring/mbstring.c:1.244 --- php-src/ext/mbstring/mbstring.c:1.243 Sun Mar 12 07:54:03 2006 +++ php-src/ext/mbstring/mbstring.c Thu Mar 16 15:21:12 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.243 2006/03/12 07:54:03 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.244 2006/03/16 15:21:12 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2314,19 +2314,41 @@ } /* }}} */ -/* {{{ proto array mb_list_encodings() - Returns an array of all supported encodings */ +/* {{{ proto mixed mb_list_encodings([string alias_encoding]) + Returns an array of all supported entity encodings or Returns the entity encoding as a string */ PHP_FUNCTION(mb_list_encodings) { const mbfl_encoding **encodings; const mbfl_encoding *encoding; + enum mbfl_no_encoding no_encoding; int i; + char *name = NULL; + int name_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |s, name, name_len) == FAILURE) { + RETURN_FALSE; + } - array_init(return_value); - i = 0; - encodings = mbfl_get_supported_encodings(); - while ((encoding = encodings[i++]) != NULL) { - add_next_index_string(return_value, (char *) encoding-name, 1); + if (name == NULL) { + array_init(return_value); + i = 0; + encodings = mbfl_get_supported_encodings(); + while ((encoding = encodings[i++]) != NULL) { + add_next_index_string(return_value, (char *) encoding-name, 1); + } + } else { + no_encoding = mbfl_name2no_encoding(name); + if (no_encoding == mbfl_no_encoding_invalid) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Unknown encoding \%s\, name); + RETURN_FALSE; + } + + name = (char *)mbfl_no_encoding2name(no_encoding); + if (name != NULL) { + RETURN_STRING(name, 1); + } else { + RETURN_FALSE; + } } } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
hirokawaSun Mar 12 07:54:03 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: fixed a possible null injection caused by missuse of mbstring.substitute_character. http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.242r2=1.243diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.242 php-src/ext/mbstring/mbstring.c:1.243 --- php-src/ext/mbstring/mbstring.c:1.242 Fri Mar 10 16:36:52 2006 +++ php-src/ext/mbstring/mbstring.c Sun Mar 12 07:54:03 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.242 2006/03/10 16:36:52 masugata Exp $ */ +/* $Id: mbstring.c,v 1.243 2006/03/12 07:54:03 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -688,6 +688,9 @@ /* {{{ static PHP_INI_MH(OnUpdate_mbstring_substitute_character) */ static PHP_INI_MH(OnUpdate_mbstring_substitute_character) { + int c; + char *endptr = NULL; + if (new_value != NULL) { if (strcasecmp(none, new_value) == 0) { MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE; @@ -695,7 +698,12 @@ MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG; } else { MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; - MBSTRG(filter_illegal_substchar) = zend_atoi(new_value, new_value_length); + if (new_value_length 0) { + c = strtol(new_value, endptr, 0); + if (*endptr == '\0') { + MBSTRG(filter_illegal_substchar) = c; + } + } } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
masugataFri Mar 10 16:36:52 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: fixed different value was returned in mb_get_info. http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.241r2=1.242diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.241 php-src/ext/mbstring/mbstring.c:1.242 --- php-src/ext/mbstring/mbstring.c:1.241 Tue Mar 7 00:20:53 2006 +++ php-src/ext/mbstring/mbstring.c Fri Mar 10 16:36:52 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.241 2006/03/07 00:20:53 pajoye Exp $ */ +/* $Id: mbstring.c,v 1.242 2006/03/10 16:36:52 masugata Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3321,20 +3321,22 @@ /* }}} */ -/* {{{ proto string mb_get_info([string type]) +/* {{{ proto mixed mb_get_info([string type]) Returns the current settings of mbstring */ PHP_FUNCTION(mb_get_info) { char *typ = NULL; int typ_len; char *name; + const struct mb_overload_def *over_func; + zval *row; + const mbfl_language *lang = mbfl_no2language(MBSTRG(current_language)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |s, typ, typ_len) == FAILURE) { RETURN_FALSE; } if (!typ || !strcasecmp(all, typ)) { - const mbfl_language *lang = mbfl_no2language(MBSTRG(current_language)); array_init(return_value); if ((name = (char *)mbfl_no_encoding2name(MBSTRG(current_internal_encoding))) != NULL) { add_assoc_string(return_value, internal_encoding, name, 1); @@ -3345,16 +3347,30 @@ if ((name = (char *)mbfl_no_encoding2name(MBSTRG(current_http_output_encoding))) != NULL) { add_assoc_string(return_value, http_output, name, 1); } - if ((name = (char *)mbfl_no_encoding2name(MBSTRG(func_overload))) != NULL) { - add_assoc_string(return_value, func_overload, name, 1); - } + if (MBSTRG(func_overload)){ + over_func = (mb_ovld[0]); + MAKE_STD_ZVAL(row); + array_init(row); + while (over_func-type 0) { + if ((MBSTRG(func_overload) over_func-type) == over_func-type ) { + add_assoc_string(row, over_func-orig_func, over_func-ovld_func, 1); + } + over_func++; + } + add_assoc_zval(return_value, func_overload, row); + } else { + add_assoc_string(return_value, func_overload, no overload, 1); + } if (lang != NULL) { - add_assoc_string(return_value, mail_charset, - mbfl_no_encoding2name(lang-mail_charset), 1); - add_assoc_string(return_value, mail_header_encoding, - mbfl_no_encoding2name(lang-mail_header_encoding), 1); - add_assoc_string(return_value, mail_body_encoding, - mbfl_no_encoding2name(lang-mail_body_encoding), 1); + if ((name = (char *)mbfl_no_encoding2name(lang-mail_charset)) != NULL) { + add_assoc_string(return_value, mail_charset, name, 1); + } + if ((name = (char *)mbfl_no_encoding2name(lang-mail_header_encoding)) != NULL) { + add_assoc_string(return_value, mail_header_encoding, name, 1); + } + if ((name = (char *)mbfl_no_encoding2name(lang-mail_body_encoding)) != NULL) { + add_assoc_string(return_value, mail_body_encoding, name, 1); + } } } else if (!strcasecmp(internal_encoding, typ)) { if ((name = (char *)mbfl_no_encoding2name(MBSTRG(current_internal_encoding))) != NULL) { @@ -3369,7 +3385,28 @@ RETVAL_STRING(name, 1); } } else if (!strcasecmp(func_overload, typ)) { - if ((name = (char *)mbfl_no_encoding2name(MBSTRG(func_overload))) != NULL) { + if (MBSTRG(func_overload)){ + over_func = (mb_ovld[0]); + array_init(return_value); + while (over_func-type 0) { + if ((MBSTRG(func_overload) over_func-type) == over_func-type ) { +
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
yohgaki Fri Mar 3 20:41:52 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: remove obsolete check http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.239r2=1.240diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.239 php-src/ext/mbstring/mbstring.c:1.240 --- php-src/ext/mbstring/mbstring.c:1.239 Thu Mar 2 00:34:28 2006 +++ php-src/ext/mbstring/mbstring.c Fri Mar 3 20:41:52 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.239 2006/03/02 00:34:28 yohgaki Exp $ */ +/* $Id: mbstring.c,v 1.240 2006/03/03 20:41:52 yohgaki Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3070,11 +3070,6 @@ smart_str *s; extern void mbfl_memory_device_unput(mbfl_memory_device *device); - if (PG(safe_mode) (ZEND_NUM_ARGS() == 5)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE.); - RETURN_FALSE; - } - /* initialize */ mbfl_memory_device_init(device, 0, 0); mbfl_string_init(orig_str); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
yohgaki Thu Mar 2 00:34:28 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: add safe_mode num of parameter check http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.238r2=1.239diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.238 php-src/ext/mbstring/mbstring.c:1.239 --- php-src/ext/mbstring/mbstring.c:1.238 Thu Feb 23 20:15:36 2006 +++ php-src/ext/mbstring/mbstring.c Thu Mar 2 00:34:28 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.238 2006/02/23 20:15:36 helly Exp $ */ +/* $Id: mbstring.c,v 1.239 2006/03/02 00:34:28 yohgaki Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3069,7 +3069,12 @@ HashTable ht_headers; smart_str *s; extern void mbfl_memory_device_unput(mbfl_memory_device *device); - + + if (PG(safe_mode) (ZEND_NUM_ARGS() == 5)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE.); + RETURN_FALSE; + } + /* initialize */ mbfl_memory_device_init(device, 0, 0); mbfl_string_init(orig_str); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
hirokawaSat Feb 11 02:25:29 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: added additional info about mail encoding to mb_get_info(). (made by Jokagi) http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.236r2=1.237diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.236 php-src/ext/mbstring/mbstring.c:1.237 --- php-src/ext/mbstring/mbstring.c:1.236 Mon Feb 6 10:41:42 2006 +++ php-src/ext/mbstring/mbstring.c Sat Feb 11 02:25:29 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.236 2006/02/06 10:41:42 tony2001 Exp $ */ +/* $Id: mbstring.c,v 1.237 2006/02/11 02:25:29 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -,6 +,7 @@ } if (!typ || !strcasecmp(all, typ)) { + const mbfl_language *lang = mbfl_no2language(MBSTRG(current_language)); array_init(return_value); if ((name = (char *)mbfl_no_encoding2name(MBSTRG(current_internal_encoding))) != NULL) { add_assoc_string(return_value, internal_encoding, name, 1); @@ -3346,6 +3347,14 @@ if ((name = (char *)mbfl_no_encoding2name(MBSTRG(func_overload))) != NULL) { add_assoc_string(return_value, func_overload, name, 1); } + if (lang != NULL) { + add_assoc_string(return_value, mail_charset, + mbfl_no_encoding2name(lang-mail_charset), 1); + add_assoc_string(return_value, mail_header_encoding, + mbfl_no_encoding2name(lang-mail_header_encoding), 1); + add_assoc_string(return_value, mail_body_encoding, + mbfl_no_encoding2name(lang-mail_body_encoding), 1); + } } else if (!strcasecmp(internal_encoding, typ)) { if ((name = (char *)mbfl_no_encoding2name(MBSTRG(current_internal_encoding))) != NULL) { RETVAL_STRING(name, 1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
tony2001Mon Feb 6 10:41:42 2006 UTC Modified files: /php-src/ext/mbstring mbstring.c Log: MF51: initialize to_r remove needless semicolon http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.235r2=1.236diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.235 php-src/ext/mbstring/mbstring.c:1.236 --- php-src/ext/mbstring/mbstring.c:1.235 Sun Jan 1 13:09:51 2006 +++ php-src/ext/mbstring/mbstring.c Mon Feb 6 10:41:42 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.235 2006/01/01 13:09:51 sniper Exp $ */ +/* $Id: mbstring.c,v 1.236 2006/02/06 10:41:42 tony2001 Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -163,7 +163,7 @@ ZEND_BEGIN_ARG_INFO(third_and_rest_force_ref, 1) ZEND_ARG_PASS_INFO(0) ZEND_ARG_PASS_INFO(0) - ZEND_END_ARG_INFO(); + ZEND_END_ARG_INFO() /* {{{ mb_overload_def mb_ovld[] */ static const struct mb_overload_def mb_ovld[] = { @@ -3047,7 +3047,7 @@ char *extra_cmd=NULL; int extra_cmd_len; int i; - char *to_r; + char *to_r = NULL; char *force_extra_parameters = INI_STR(mail.force_extra_parameters); struct { int cnt_type:1; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
hirokawaThu Dec 29 23:52:59 2005 EDT Modified files: /php-src/ext/mbstring mbstring.c Log: added Turkish language definition (related to bug #29955) http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.233r2=1.234diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.233 php-src/ext/mbstring/mbstring.c:1.234 --- php-src/ext/mbstring/mbstring.c:1.233 Sun Dec 25 15:21:54 2005 +++ php-src/ext/mbstring/mbstring.c Thu Dec 29 23:52:59 2005 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.233 2005/12/25 15:21:54 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.234 2005/12/29 23:52:59 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -134,6 +134,12 @@ mbfl_no_encoding_armscii8 }; +static const enum mbfl_no_encoding php_mb_default_identify_list_tr[] = { + mbfl_no_encoding_ascii, + mbfl_no_encoding_utf8, + mbfl_no_encoding_8859_9 +}; + static const enum mbfl_no_encoding php_mb_default_identify_list_neut[] = { mbfl_no_encoding_ascii, mbfl_no_encoding_utf8 @@ -147,6 +153,7 @@ { mbfl_no_language_simplified_chinese, php_mb_default_identify_list_cn, sizeof(php_mb_default_identify_list_cn) / sizeof(php_mb_default_identify_list_cn[0]) }, { mbfl_no_language_russian, php_mb_default_identify_list_ru, sizeof(php_mb_default_identify_list_ru) / sizeof(php_mb_default_identify_list_ru[0]) }, { mbfl_no_language_armenian, php_mb_default_identify_list_hy, sizeof(php_mb_default_identify_list_hy) / sizeof(php_mb_default_identify_list_hy[0]) }, + { mbfl_no_language_turkish, php_mb_default_identify_list_tr, sizeof(php_mb_default_identify_list_tr) / sizeof(php_mb_default_identify_list_tr[0]) }, { mbfl_no_language_neutral, php_mb_default_identify_list_neut, sizeof(php_mb_default_identify_list_neut) / sizeof(php_mb_default_identify_list_neut[0]) } }; @@ -891,6 +898,9 @@ case mbfl_no_language_armenian: default_enc = ArmSCII-8; break; + case mbfl_no_language_turkish: + default_enc = ISO-8859-9; + break; case mbfl_no_language_english: default: default_enc = ISO-8859-1; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
hirokawaFri Dec 23 11:14:54 2005 EDT Modified files: /php-src/ext/mbstring mbstring.c Log: fixed #28899 mb_substr() and substr() work differently when mbstring.func_overload is enabled. http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.231r2=1.232diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.231 php-src/ext/mbstring/mbstring.c:1.232 --- php-src/ext/mbstring/mbstring.c:1.231 Fri Dec 16 14:50:31 2005 +++ php-src/ext/mbstring/mbstring.c Fri Dec 23 11:14:54 2005 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.231 2005/12/16 14:50:31 tony2001 Exp $ */ +/* $Id: mbstring.c,v 1.232 2005/12/23 11:14:54 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -60,7 +60,6 @@ #include ext/standard/url.h #include main/php_output.h #include ext/standard/info.h - #include libmbfl/mbfl/mbfl_allocators.h #include php_variables.h @@ -1763,6 +1762,11 @@ } } + if (((MBSTRG(func_overload) MB_OVERLOAD_STRING) == MB_OVERLOAD_STRING) +(from = mbfl_strlen(string))) { + RETURN_FALSE; + } + ret = mbfl_substr(string, result, from, len); if (ret != NULL) { RETVAL_STRINGL((char *)ret-val, ret-len, 0); /* the string is already strdup()'ed */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c /ext/mbstring/tests mb_strcut.phpt
tony2001Fri Dec 16 14:50:32 2005 EDT Modified files: /php-src/ext/mbstring mbstring.c /php-src/ext/mbstring/tests mb_strcut.phpt Log: MF51 Ilia's last fix fix the test appropriately http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/mbstring.c?r1=1.230r2=1.231diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.230 php-src/ext/mbstring/mbstring.c:1.231 --- php-src/ext/mbstring/mbstring.c:1.230 Tue Dec 6 02:07:17 2005 +++ php-src/ext/mbstring/mbstring.c Fri Dec 16 14:50:31 2005 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.230 2005/12/06 02:07:17 sniper Exp $ */ +/* $Id: mbstring.c,v 1.231 2005/12/16 14:50:31 tony2001 Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1844,6 +1844,13 @@ } } + if (from Z_STRLEN_PP(arg1)) { + RETURN_FALSE; + } + if (((unsigned) from + (unsigned) len) Z_STRLEN_PP(arg1)) { + len = Z_STRLEN_PP(arg1) - from; + } + ret = mbfl_strcut(string, result, from, len); if (ret != NULL) { RETVAL_STRINGL(ret-val, ret-len, 0); /* the string is already strdup()'ed */ http://cvs.php.net/viewcvs.cgi/php-src/ext/mbstring/tests/mb_strcut.phpt?r1=1.3r2=1.4diff_format=u Index: php-src/ext/mbstring/tests/mb_strcut.phpt diff -u php-src/ext/mbstring/tests/mb_strcut.phpt:1.3 php-src/ext/mbstring/tests/mb_strcut.phpt:1.4 --- php-src/ext/mbstring/tests/mb_strcut.phpt:1.3 Sun Nov 3 08:37:59 2002 +++ php-src/ext/mbstring/tests/mb_strcut.phpt Fri Dec 16 14:50:32 2005 @@ -17,7 +17,7 @@ print mb_strcut($euc_jp, 0, 100,'EUC-JP') . \n; $str = mb_strcut($euc_jp, 100, 10,'EUC-JP'); -($str === ) ? print OK\n : print NG: $str\n; +($str === false) ? print OK\n : print NG: $str\n; $str = mb_strcut($euc_jp, -100, 10,'EUC-JP'); ($str !== ) ?print OK: $str\n : print NG:\n; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
sniper Mon Dec 5 20:26:39 2005 EDT Modified files: /php-src/ext/mbstring mbstring.c Log: nuke php3 legacy http://cvs.php.net/diff.php/php-src/ext/mbstring/mbstring.c?r1=1.228r2=1.229ty=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.228 php-src/ext/mbstring/mbstring.c:1.229 --- php-src/ext/mbstring/mbstring.c:1.228 Wed Nov 23 10:16:39 2005 +++ php-src/ext/mbstring/mbstring.c Mon Dec 5 20:26:39 2005 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.228 2005/11/23 15:16:39 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.229 2005/12/06 01:26:39 sniper Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -181,7 +181,7 @@ /* }}} */ /* {{{ function_entry mbstring_functions[] */ -function_entry mbstring_functions[] = { +zval_function_entry mbstring_functions[] = { PHP_FE(mb_convert_case, NULL) PHP_FE(mb_strtoupper, NULL) PHP_FE(mb_strtolower, NULL) @@ -1776,7 +1776,7 @@ Returns part of a string */ PHP_FUNCTION(mb_strcut) { - pval **arg1, **arg2, **arg3, **arg4; + zval **arg1, **arg2, **arg3, **arg4; int argc, from, len; mbfl_string string, result, *ret; @@ -1892,7 +1892,7 @@ Trim the string in terminal width */ PHP_FUNCTION(mb_strimwidth) { - pval **arg1, **arg2, **arg3, **arg4, **arg5; + zval **arg1, **arg2, **arg3, **arg4, **arg5; int from, width; mbfl_string string, result, marker, *ret; @@ -2054,7 +2054,7 @@ Returns converted string in desired encoding */ PHP_FUNCTION(mb_convert_encoding) { - pval **arg_str, **arg_new, **arg_old; + zval **arg_str, **arg_new, **arg_old; int i; size_t size, l, n; char *_from_encodings, *ret, *s_free = NULL; @@ -2198,7 +2198,7 @@ Encodings of the given string is returned (as a string) */ PHP_FUNCTION(mb_detect_encoding) { - pval **arg_str, **arg_list, **arg_strict; + zval **arg_str, **arg_list, **arg_strict; mbfl_string string; const char *ret; enum mbfl_no_encoding *elist; @@ -2484,7 +2484,7 @@ Converts the string resource in variables to desired encoding */ PHP_FUNCTION(mb_convert_variables) { - pval ***args, ***stack, **var, **hash_entry; + zval ***args, ***stack, **var, **hash_entry; HashTable *target_hash; mbfl_string string, result, *ret; enum mbfl_no_encoding from_encoding, to_encoding; @@ -2499,7 +2499,7 @@ if (argc 3) { WRONG_PARAM_COUNT; } - args = (pval ***)ecalloc(argc, sizeof(pval **)); + args = (zval ***)ecalloc(argc, sizeof(zval **)); if (zend_get_parameters_array_ex(argc, args) == FAILURE) { efree((void *)args); WRONG_PARAM_COUNT; @@ -2541,7 +2541,7 @@ /* auto detect */ from_encoding = mbfl_no_encoding_invalid; stack_max = PHP_MBSTR_STACK_BLOCK_SIZE; - stack = (pval ***)safe_emalloc(stack_max, sizeof(pval **), 0); + stack = (zval ***)safe_emalloc(stack_max, sizeof(zval **), 0); stack_level = 0; identd = mbfl_encoding_detector_new(elist, elistsz); if (identd != NULL) { @@ -2567,8 +2567,8 @@ if (Z_TYPE_PP(hash_entry) == IS_ARRAY || Z_TYPE_PP(hash_entry) == IS_OBJECT) { if (stack_level = stack_max) { stack_max += PHP_MBSTR_STACK_BLOCK_SIZE; - ptmp = erealloc(stack, sizeof(pval **)*stack_max); - stack = (pval ***)ptmp; + ptmp = erealloc(stack, sizeof(zval **)*stack_max); + stack = (zval ***)ptmp; } stack[stack_level] = var; stack_level++; @@ -2624,7 +2624,7 @@ /* convert */ if (convd != NULL) { stack_max = PHP_MBSTR_STACK_BLOCK_SIZE; - stack = (pval ***)safe_emalloc(stack_max, sizeof(pval **), 0); + stack = (zval ***)safe_emalloc(stack_max, sizeof(zval **), 0); stack_level = 0; n = 2; while (n argc || stack_level 0) { @@ -2648,8 +2648,8 @@ if (Z_TYPE_PP(hash_entry) == IS_ARRAY || Z_TYPE_PP(hash_entry) ==
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
sniper Mon Dec 5 21:07:18 2005 EDT Modified files: /php-src/ext/mbstring mbstring.c Log: fix build http://cvs.php.net/diff.php/php-src/ext/mbstring/mbstring.c?r1=1.229r2=1.230ty=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.229 php-src/ext/mbstring/mbstring.c:1.230 --- php-src/ext/mbstring/mbstring.c:1.229 Mon Dec 5 20:26:39 2005 +++ php-src/ext/mbstring/mbstring.c Mon Dec 5 21:07:17 2005 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.229 2005/12/06 01:26:39 sniper Exp $ */ +/* $Id: mbstring.c,v 1.230 2005/12/06 02:07:17 sniper Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -180,8 +180,8 @@ }; /* }}} */ -/* {{{ function_entry mbstring_functions[] */ -zval_function_entry mbstring_functions[] = { +/* {{{ zend_function_entry mbstring_functions[] */ +zend_function_entry mbstring_functions[] = { PHP_FE(mb_convert_case, NULL) PHP_FE(mb_strtoupper, NULL) PHP_FE(mb_strtolower, NULL) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
hirokawaWed Nov 23 10:16:44 2005 EDT Modified files: /php-src/ext/mbstring mbstring.c Log: fixed 5307 unexpected header can be injected to mb_send_mail(). http://cvs.php.net/diff.php/php-src/ext/mbstring/mbstring.c?r1=1.227r2=1.228ty=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.227 php-src/ext/mbstring/mbstring.c:1.228 --- php-src/ext/mbstring/mbstring.c:1.227 Sat Nov 19 01:32:20 2005 +++ php-src/ext/mbstring/mbstring.c Wed Nov 23 10:16:39 2005 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.227 2005/11/19 06:32:20 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.228 2005/11/23 15:16:39 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2798,6 +2798,15 @@ */ #if HAVE_SENDMAIL +#define SKIP_LONG_HEADER_SEP_MBSTRING(str, pos) \ + if (str[pos] == '\r' str[pos + 1] == '\n' (str[pos + 2] == ' ' || str[pos + 2] == '\t')) {\ + pos += 3; \ + while (str[pos] == ' ' || str[pos] == '\t') { \ + pos++; \ + } \ + continue; \ + } + #define APPEND_ONE_CHAR(ch) do { \ if (token.a 0) { \ smart_str_appendc(token, ch); \ @@ -3009,6 +3018,8 @@ int subject_len; char *extra_cmd=NULL; int extra_cmd_len; + int i; + char *to_r; char *force_extra_parameters = INI_STR(mail.force_extra_parameters); struct { int cnt_type:1; @@ -3115,7 +3126,30 @@ } /* To: */ - if (to == NULL || to_len = 0) { + if (to != NULL) { +if (to_len 0) { +to_r = estrndup(to, to_len); +for (; to_len; to_len--) { +if (!isspace((unsigned char) to_r[to_len - 1])) { +break; +} +to_r[to_len - 1] = '\0'; +} +for (i = 0; to_r[i]; i++) { + if (iscntrl((unsigned char) to_r[i])) { + /* According to RFC 822, section 3.1.1 long headers may be separated into +* parts using CRLF followed at least one linear-white-space character ('\t' or ' '). +* To prevent these separators from being replaced with a space, we use the +* SKIP_LONG_HEADER_SEP_MBSTRING to skip over them. +*/ + SKIP_LONG_HEADER_SEP_MBSTRING(to_r, i); + to_r[i] = ' '; + } +} +} else { +to_r = to; +} +} else { php_error_docref(NULL TSRMLS_CC, E_WARNING, Missing To: field); err = 1; } @@ -3217,7 +3251,7 @@ extra_cmd = php_escape_shell_cmd(extra_cmd); } - if (!err php_mail(to, subject, message, headers, extra_cmd TSRMLS_CC)) { + if (!err php_mail(to_r, subject, message, headers, extra_cmd TSRMLS_CC)) { RETVAL_TRUE; } else { RETVAL_FALSE; @@ -3226,6 +3260,9 @@ if (extra_cmd) { efree(extra_cmd); } + if (to_r != to) { + efree(to_r); + } if (subject_buf) { efree((void *)subject_buf); } @@ -3236,6 +3273,7 @@ zend_hash_destroy(ht_headers); } +#undef SKIP_LONG_HEADER_SEP_MBSTRING #undef APPEND_ONE_CHAR #undef SEPARATE_SMART_STR #undef PHP_MBSTR_MAIL_MIME_HEADER1 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
hirokawaSat Nov 19 01:32:25 2005 EDT Modified files: /php-src/ext/mbstring mbstring.c Log: fixed #35253 length of the encoded string vilolates a RFC. http://cvs.php.net/diff.php/php-src/ext/mbstring/mbstring.c?r1=1.226r2=1.227ty=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.226 php-src/ext/mbstring/mbstring.c:1.227 --- php-src/ext/mbstring/mbstring.c:1.226 Wed Sep 21 09:23:12 2005 +++ php-src/ext/mbstring/mbstring.c Sat Nov 19 01:32:20 2005 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.226 2005/09/21 13:23:12 iliaa Exp $ */ +/* $Id: mbstring.c,v 1.227 2005/11/19 06:32:20 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2294,7 +2294,7 @@ } /* }}} */ -/* {{{ proto string mb_encode_mimeheader(string str [, string charset [, string transfer-encoding [, string linefeed]]]) +/* {{{ proto string mb_encode_mimeheader(string str [, string charset [, string transfer-encoding [, string linefeed [, int indent) Converts the string to MIME encoded-word in the format of =?charset?(B|Q)?encoded_string?= */ PHP_FUNCTION(mb_encode_mimeheader) { @@ -2306,12 +2306,13 @@ int trans_enc_name_len; char *linefeed = \r\n; int linefeed_len; + int indent = 0; mbfl_string_init(string); string.no_language = MBSTRG(current_language); string.no_encoding = MBSTRG(current_internal_encoding); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|sss, (char **)string.val, string.len, charset_name, charset_name_len, trans_enc_name, trans_enc_name_len, linefeed, linefeed_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|sssl, (char **)string.val, string.len, charset_name, charset_name_len, trans_enc_name, trans_enc_name_len, linefeed, linefeed_len, indent) == FAILURE) { return; } @@ -2341,7 +2342,7 @@ } mbfl_string_init(result); - ret = mbfl_mime_header_encode(string, result, charset, transenc, linefeed, 0); + ret = mbfl_mime_header_encode(string, result, charset, transenc, linefeed, indent); if (ret != NULL) { RETVAL_STRINGL((char *)ret-val, ret-len, 0) /* the string is already strdup()'ed */ } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
iliaa Wed Sep 21 09:15:24 2005 EDT Modified files: /php-src/ext/mbstring mbstring.c Log: Fixed bug #34565 (mb_send_mail does not fetch mail.force_extra_parameters) http://cvs.php.net/diff.php/php-src/ext/mbstring/mbstring.c?r1=1.224r2=1.225ty=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224 php-src/ext/mbstring/mbstring.c:1.225 --- php-src/ext/mbstring/mbstring.c:1.224 Wed Aug 3 10:07:24 2005 +++ php-src/ext/mbstring/mbstring.c Wed Sep 21 09:15:20 2005 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224 2005/08/03 14:07:24 sniper Exp $ */ +/* $Id: mbstring.c,v 1.225 2005/09/21 13:15:20 iliaa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3007,6 +3007,7 @@ int subject_len; char *extra_cmd=NULL; int extra_cmd_len; + char *force_extra_parameters = INI_STR(mail.force_extra_parameters); struct { int cnt_type:1; int cnt_trans_enc:1; @@ -3208,12 +3209,21 @@ mbfl_memory_device_output('\0', device); headers = (char *)device.buffer; + if (force_extra_parameters) { + extra_cmd = estrdup(force_extra_parameters); + } else if (extra_cmd) { + extra_cmd = php_escape_shell_cmd(extra_cmd); + } + if (!err php_mail(to, subject, message, headers, extra_cmd TSRMLS_CC)) { RETVAL_TRUE; } else { RETVAL_FALSE; } + if (extra_cmd) { + efree(extra_cmd); + } if (subject_buf) { efree((void *)subject_buf); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
iliaa Wed Sep 21 09:23:13 2005 EDT Modified files: /php-src/ext/mbstring mbstring.c Log: MFB: fixed compiler warnings http://cvs.php.net/diff.php/php-src/ext/mbstring/mbstring.c?r1=1.225r2=1.226ty=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.225 php-src/ext/mbstring/mbstring.c:1.226 --- php-src/ext/mbstring/mbstring.c:1.225 Wed Sep 21 09:15:20 2005 +++ php-src/ext/mbstring/mbstring.c Wed Sep 21 09:23:12 2005 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.225 2005/09/21 13:15:20 iliaa Exp $ */ +/* $Id: mbstring.c,v 1.226 2005/09/21 13:23:12 iliaa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -55,6 +55,7 @@ #include mbstring.h #include ext/standard/php_string.h #include ext/standard/php_mail.h +#include ext/standard/exec.h #include ext/standard/php_smart_str.h #include ext/standard/url.h #include main/php_output.h -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
moriyoshi Mon Feb 21 10:14:32 2005 EDT Modified files: /php-src/ext/mbstring mbstring.c Log: - WS fix. http://cvs.php.net/diff.php/php-src/ext/mbstring/mbstring.c?r1=1.219r2=1.220ty=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.219 php-src/ext/mbstring/mbstring.c:1.220 --- php-src/ext/mbstring/mbstring.c:1.219 Mon Feb 21 10:14:01 2005 +++ php-src/ext/mbstring/mbstring.c Mon Feb 21 10:14:32 2005 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.219 2005/02/21 15:14:01 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.220 2005/02/21 15:14:32 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2283,7 +2283,6 @@ } /* }}} */ - /* {{{ proto string mb_encode_mimeheader(string str [, string charset [, string transfer-encoding [, string linefeed]]]) Converts the string to MIME encoded-word in the format of =?charset?(B|Q)?encoded_string?= */ PHP_FUNCTION(mb_encode_mimeheader) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
iliaa Thu Mar 11 20:59:47 2004 EDT Modified files: /php-src/ext/mbstring mbstring.c Log: Fixed compiler warning. http://cvs.php.net/diff.php/php-src/ext/mbstring/mbstring.c?r1=1.212r2=1.213ty=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.212 php-src/ext/mbstring/mbstring.c:1.213 --- php-src/ext/mbstring/mbstring.c:1.212 Wed Mar 10 15:55:42 2004 +++ php-src/ext/mbstring/mbstring.c Thu Mar 11 20:59:46 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.212 2004/03/10 20:55:42 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.213 2004/03/12 01:59:46 iliaa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2249,7 +2249,7 @@ i = 0; encodings = mbfl_get_supported_encodings(); while ((encoding = encodings[i++]) != NULL) { - add_next_index_string(return_value, encoding-name, 1); + add_next_index_string(return_value, (char *) encoding-name, 1); } } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
moriyoshi Wed Mar 10 15:55:43 2004 EDT Modified files: /php-src/ext/mbstring mbstring.c Log: - Revert ini setting patch, as I notified in http://news.php.net/article.php?group=php.internalsarticle=8451 http://cvs.php.net/diff.php/php-src/ext/mbstring/mbstring.c?r1=1.211r2=1.212ty=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.211 php-src/ext/mbstring/mbstring.c:1.212 --- php-src/ext/mbstring/mbstring.c:1.211 Mon Mar 8 17:18:03 2004 +++ php-src/ext/mbstring/mbstring.c Wed Mar 10 15:55:42 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.211 2004/03/08 22:18:03 derick Exp $ */ +/* $Id: mbstring.c,v 1.212 2004/03/10 20:55:42 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -701,7 +701,8 @@ PHP_INI_ENTRY(mbstring.script_encoding, NULL, PHP_INI_ALL, OnUpdate_mbstring_script_encoding) #endif /* ZEND_MULTIBYTE */ PHP_INI_ENTRY(mbstring.substitute_character, NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character) -STD_PHP_INI_ENTRY(mbstring.func_overload, 0, PHP_INI_SYSTEM, OnUpdateLong, func_overload, zend_mbstring_globals, mbstring_globals) +STD_PHP_INI_ENTRY(mbstring.func_overload, 0, PHP_INI_SYSTEM | +PHP_INI_PERDIR, OnUpdateLong, func_overload, zend_mbstring_globals, mbstring_globals) STD_PHP_INI_BOOLEAN(mbstring.encoding_translation, 0, PHP_INI_SYSTEM | PHP_INI_PERDIR, OnUpdate_mbstring_encoding_translation, -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
iliaa Sat Mar 6 14:29:53 2004 EDT Modified files: /php-src/ext/mbstring mbstring.c Log: Fixed bug #27421 (mbstring.func_overload should be system ini setting). http://cvs.php.net/diff.php/php-src/ext/mbstring/mbstring.c?r1=1.209r2=1.210ty=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.209 php-src/ext/mbstring/mbstring.c:1.210 --- php-src/ext/mbstring/mbstring.c:1.209 Sat Feb 28 15:45:23 2004 +++ php-src/ext/mbstring/mbstring.c Sat Mar 6 14:29:52 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.209 2004/02/28 20:45:23 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.210 2004/03/06 19:29:52 iliaa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -700,8 +700,7 @@ PHP_INI_ENTRY(mbstring.script_encoding, NULL, PHP_INI_ALL, OnUpdate_mbstring_script_encoding) #endif /* ZEND_MULTIBYTE */ PHP_INI_ENTRY(mbstring.substitute_character, NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character) -STD_PHP_INI_ENTRY(mbstring.func_overload, 0, PHP_INI_SYSTEM | -PHP_INI_PERDIR, OnUpdateLong, func_overload, zend_mbstring_globals, mbstring_globals) +STD_PHP_INI_ENTRY(mbstring.func_overload, 0, PHP_INI_SYSTEM, OnUpdateLong, func_overload, zend_mbstring_globals, mbstring_globals) STD_PHP_INI_BOOLEAN(mbstring.encoding_translation, 0, PHP_INI_SYSTEM | PHP_INI_PERDIR, OnUpdate_mbstring_encoding_translation, -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c /ext/mbstring/tests bug26639.phpt
moriyoshi Thu Dec 18 04:50:21 2003 EDT Added files: /php-src/ext/mbstring/tests bug26639.phpt Modified files: /php-src/ext/mbstring mbstring.c Log: Fix bug #26639 (mb_convert_variables() clutters variables beyond the references) Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.205 php-src/ext/mbstring/mbstring.c:1.206 --- php-src/ext/mbstring/mbstring.c:1.205 Wed Dec 10 12:38:45 2003 +++ php-src/ext/mbstring/mbstring.c Thu Dec 18 04:50:19 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.205 2003/12/10 17:38:45 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.206 2003/12/18 09:50:19 moriyoshi Exp $ */ /* * PHP4 Multibyte String module mbstring @@ -2605,9 +2605,13 @@ string.len = Z_STRLEN_PP(hash_entry); ret = mbfl_buffer_converter_feed_result(convd, string, result); if (ret != NULL) { - STR_FREE(Z_STRVAL_PP(hash_entry)); - Z_STRVAL_PP(hash_entry) = (char *)ret-val; - Z_STRLEN_PP(hash_entry) = ret-len; + if ((*hash_entry)-refcount 1) { + ZVAL_DELREF(*hash_entry); + MAKE_STD_ZVAL(*hash_entry); + } else { + zval_dtor(*hash_entry); + } + ZVAL_STRINGL(*hash_entry, ret-val, ret-len, 0); } } } @@ -2617,9 +2621,8 @@ string.len = Z_STRLEN_PP(var); ret = mbfl_buffer_converter_feed_result(convd, string, result); if (ret != NULL) { - STR_FREE(Z_STRVAL_PP(var)); - Z_STRVAL_PP(var) = (char *)ret-val; - Z_STRLEN_PP(var) = ret-len; + zval_dtor(*var); + ZVAL_STRINGL(*var, ret-val, ret-len, 0); } } } Index: php-src/ext/mbstring/tests/bug26639.phpt +++ php-src/ext/mbstring/tests/bug26639.phpt --TEST-- Bug #26639 (mb_convert_variables() clutters variables beyond the references) --SKIPIF-- ?php extension_loaded('mbstring') or die('skip mbstring not available'); ? --FILE-- ?php $a = ¢¤¦¨; $b = $a; mb_convert_variables(EUC-JP, Shift_JIS, $b); debug_zval_dump($a); debug_zval_dump($b); unset($a); unset($b); $a = ¢¤¦¨; $b = $a; mb_convert_variables(EUC-JP, Shift_JIS, $b); debug_zval_dump($a); debug_zval_dump($b); unset($a); unset($b); $a = ¢¤¦¨; $b = array($a); $c = $b; mb_convert_variables(EUC-JP, Shift_JIS, $c); debug_zval_dump($b); debug_zval_dump($c); unset($a); unset($b); unset($c); $a = ¢¤¦¨; $b = array($a); $c = $b; mb_convert_variables(euc-jp, shift_jis, $c); debug_zval_dump($b); debug_zval_dump($c); unset($a); unset($b); unset($c); $a = ¢¤¦¨; $b = array($a); $c = $b; mb_convert_variables(euc-jp, shift_jis, $c); debug_zval_dump($b); debug_zval_dump($c); unset($a); unset($b); unset($c); $a = ¢¤¦¨; $b = array($a); $c = $b; mb_convert_variables(euc-jp, shift_jis, $c); debug_zval_dump($b); debug_zval_dump($c); unset($a); unset($b); unset($c); ? --EXPECT-- string(10) ¢¤¦¨ refcount(2) string(10) ¤¢¤¤¤¦¤¨¤ª refcount(2) string(10) ¤¢¤¤¤¦¤¨¤ª refcount(1) string(10) ¤¢¤¤¤¦¤¨¤ª refcount(1) array(1) refcount(2){ [0]= string(10) ¢¤¦¨ refcount(2) } array(1) refcount(2){ [0]= string(10) ¤¢¤¤¤¦¤¨¤ª refcount(1) } array(1) refcount(2){ [0]= string(10) ¢¤¦¨ refcount(2) } array(1) refcount(2){ [0]= string(10) ¤¢¤¤¤¦¤¨¤ª refcount(1) } array(1) refcount(1){ [0]= string(10) ¤¢¤¤¤¦¤¨¤ª refcount(2) } array(1) refcount(1){ [0]= string(10) ¤¢¤¤¤¦¤¨¤ª refcount(2) } array(1) refcount(1){ [0]= string(10) ¤¢¤¤¤¦¤¨¤ª refcount(2) } array(1) refcount(1){ [0]= string(10) ¤¢¤¤¤¦¤¨¤ª refcount(2) } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c /ext/mbstring/tests bug26639.phpt
Shouldn't you be using some SEPARATE*() macro here? It seems as if you're doing something like that. At 09:50 AM 12/18/2003 +, Moriyoshi Koizumi wrote: moriyoshi Thu Dec 18 04:50:21 2003 EDT Added files: /php-src/ext/mbstring/tests bug26639.phpt Modified files: /php-src/ext/mbstring mbstring.c Log: Fix bug #26639 (mb_convert_variables() clutters variables beyond the references) Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.205 php-src/ext/mbstring/mbstring.c:1.206 --- php-src/ext/mbstring/mbstring.c:1.205 Wed Dec 10 12:38:45 2003 +++ php-src/ext/mbstring/mbstring.c Thu Dec 18 04:50:19 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.205 2003/12/10 17:38:45 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.206 2003/12/18 09:50:19 moriyoshi Exp $ */ /* * PHP4 Multibyte String module mbstring @@ -2605,9 +2605,13 @@ string.len = Z_STRLEN_PP(hash_entry); ret = mbfl_buffer_converter_feed_result(convd, string, result); if (ret != NULL) { - STR_FREE(Z_STRVAL_PP(hash_entry)); - Z_STRVAL_PP(hash_entry) = (char *)ret-val; - Z_STRLEN_PP(hash_entry) = ret-len; + if ((*hash_entry)-refcount 1) { + ZVAL_DELREF(*hash_entry); + MAKE_STD_ZVAL(*hash_entry); + } else { + zval_dtor(*hash_entry); + } + ZVAL_STRINGL(*hash_entry, ret-val, ret-len, 0); } } } @@ -2617,9 +2621,8 @@ string.len = Z_STRLEN_PP(var); ret = mbfl_buffer_converter_feed_result(convd, string, result); if (ret != NULL) { - STR_FREE(Z_STRVAL_PP(var)); - Z_STRVAL_PP(var) = (char *)ret-val; - Z_STRLEN_PP(var) = ret-len; + zval_dtor(*var); + ZVAL_STRINGL(*var, ret-val, ret-len, 0); } } } Index: php-src/ext/mbstring/tests/bug26639.phpt +++ php-src/ext/mbstring/tests/bug26639.phpt --TEST-- Bug #26639 (mb_convert_variables() clutters variables beyond the references) --SKIPIF-- ?php extension_loaded('mbstring') or die('skip mbstring not available'); ? --FILE-- ?php $a = ¢¤¦¨; $b = $a; mb_convert_variables(EUC-JP, Shift_JIS, $b); debug_zval_dump($a); debug_zval_dump($b); unset($a); unset($b); $a = ¢¤¦¨; $b = $a; mb_convert_variables(EUC-JP, Shift_JIS, $b); debug_zval_dump($a); debug_zval_dump($b); unset($a); unset($b); $a = ¢¤¦¨; $b = array($a); $c = $b; mb_convert_variables(EUC-JP, Shift_JIS, $c); debug_zval_dump($b); debug_zval_dump($c); unset($a); unset($b); unset($c); $a = ¢¤¦¨; $b = array($a); $c = $b; mb_convert_variables(euc-jp, shift_jis, $c); debug_zval_dump($b); debug_zval_dump($c); unset($a); unset($b); unset($c); $a = ¢¤¦¨; $b = array($a); $c = $b; mb_convert_variables(euc-jp, shift_jis, $c); debug_zval_dump($b); debug_zval_dump($c); unset($a); unset($b); unset($c); $a = ¢¤¦¨; $b = array($a); $c = $b; mb_convert_variables(euc-jp, shift_jis, $c); debug_zval_dump($b); debug_zval_dump($c); unset($a); unset($b); unset($c); ? --EXPECT-- string(10) ¢¤¦¨ refcount(2) string(10) ¤¢¤¤¤¦¤¨¤ª refcount(2) string(10) ¤¢¤¤¤¦¤¨¤ª refcount(1) string(10) ¤¢¤¤¤¦¤¨¤ª refcount(1) array(1) refcount(2){ [0]= string(10) ¢¤¦¨ refcount(2) } array(1) refcount(2){ [0]= string(10) ¤¢¤¤¤¦¤¨¤ª refcount(1) } array(1) refcount(2){ [0]= string(10) ¢¤¦¨ refcount(2) } array(1) refcount(2){ [0]= string(10) ¤¢¤¤¤¦¤¨¤ª refcount(1) } array(1) refcount(1){ [0]= string(10) ¤¢¤¤¤¦¤¨¤ª refcount(2) } array(1) refcount(1){ [0]= string(10) ¤¢¤¤¤¦¤¨¤ª refcount(2) } array(1) refcount(1){ [0]= string(10) ¤¢¤¤¤¦¤¨¤ª refcount(2) } array(1) refcount(1){ [0]= string(10) ¤¢¤¤¤¦¤¨¤ª refcount(2) } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c /ext/mbstring/tests bug26639.phpt
On 2003/12/19, at 0:12, Andi Gutmans wrote: Shouldn't you be using some SEPARATE*() macro here? It seems as if you're doing something like that. I didn't try to use that macro because a zval_copy_ctor() call in it would be redundant in this case. It seems REPLACE_ZVAL_VALUE() is a more suitable macro for this purpose. Moriyoshi +if ((*hash_entry)-refcount 1) { +ZVAL_DELREF(*hash_entry); +MAKE_STD_ZVAL(*hash_entry); +} else { +zval_dtor(*hash_entry); +} +ZVAL_STRINGL(*hash_entry, ret-val, ret-len, 0); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
moriyoshi Tue Nov 11 12:35:33 2003 EDT Modified files: /php-src/ext/mbstring mbstring.c Log: Compiler warning fix (patch by Joe Orton) Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.203 php-src/ext/mbstring/mbstring.c:1.204 --- php-src/ext/mbstring/mbstring.c:1.203 Sat Oct 25 06:29:07 2003 +++ php-src/ext/mbstring/mbstring.c Tue Nov 11 12:35:32 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.203 2003/10/25 10:29:07 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.204 2003/11/11 17:35:32 moriyoshi Exp $ */ /* * PHP4 Multibyte String module mbstring @@ -3331,7 +3331,7 @@ TSRMLS_DC) { int i; - mbfl_string string, result, *ret; + mbfl_string string, result, *ret = NULL; enum mbfl_no_encoding from_encoding, to_encoding; mbfl_buffer_converter *convd; @@ -3395,7 +3395,7 @@ { mbfl_string string; enum mbfl_no_encoding *elist; - enum mbfl_no_encoding encoding; + enum mbfl_no_encoding encoding = mbfl_no_encoding_invalid; mbfl_encoding_detector *identd = NULL; int size, *list; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c
On Tue, Nov 11, 2003 at 05:35:33PM -, Moriyoshi Koizumi wrote: moriyoshi Tue Nov 11 12:35:33 2003 EDT Modified files: /php-src/ext/mbstring mbstring.c Log: Compiler warning fix (patch by Joe Orton) The fix is needed on the 4.3 branch too BTW. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h/main rfc1867.c
Ilia Alshanetsky [EMAIL PROTECTED] wrote: On October 25, 2003 07:14 pm, Rasmus Lerdorf wrote: Ah, thought it was the other patch. However, I wouldn't call the above a new feature. That one is a bug fix as it was an oversight to not also convert form fields in multipart posts. Well, it is a mix of a feature a bug fix. The bug if we decide to call it such is by no means critical and 2 days before the release time is not a time to make any non critical changes simply because there is no time to test I kind of agree with Ilia here. It'd be a bad idea to have GPC-related patch during the RC period, although the modified parts are all companied with #ifdef's as far as I'm concerned. them. rfc1867.c is very sensitive code which previously had a number of security faults at least 1 directly caused by mbstring related changes. It is my opinion such changes have no place this late in the release cycle. Just want to make it clear, the past problem you mentioned related to mbstring is not a security fault, you know. Moriyoshi -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h /main rfc1867.c
Ilia, I appreciate your continious effort about QC process. GPC bug in rfc1867.c is not critical one, and I agree with you it is not preferable in the final RC process. I will revert my GPC related patch in a couple of hours. But, I shoudn't revert an another license related patch as shown below because the license compatibility has priority. +2003-10-25 Rui Hirokawa [EMAIL PROTECTED] + +* (PHP_4_3) + ext/mbstring/mbstring.dsp: + fixed windows build. + +* (PHP_4_3) + ext/mbstring/README.libmbfl + ext/mbstring/config.m4 + ext/mbstring/cp932_table.h + ext/mbstring/html_entities.c + ext/mbstring/mbfilter.c + ext/mbstring/mbfilter.h + ext/mbstring/mbfilter_cn.c + ext/mbstring/mbfilter_cn.h + ext/mbstring/mbfilter_ja.c + ext/mbstring/mbfilter_ja.h + ext/mbstring/mbfilter_kr.c + ext/mbstring/mbfilter_kr.h + ext/mbstring/mbfilter_ru.c + ext/mbstring/mbfilter_ru.h + ext/mbstring/mbfilter_tw.c + ext/mbstring/mbfilter_tw.h + ext/mbstring/mbregex.c + ext/mbstring/mbregex.h + ext/mbstring/mbstring.c + ext/mbstring/mbstring.dsp + ext/mbstring/mbstring.h + ext/mbstring/unicode_table.h + ext/mbstring/unicode_table_cn.h + ext/mbstring/unicode_table_ja.h + ext/mbstring/unicode_table_kr.h + ext/mbstring/unicode_table_ru.h + ext/mbstring/unicode_table_tw.h: + mbfilter is replaced with libmbfl to maintain the licence compatibility. + mbregex.[ch] is moved to mbregex/ for the same reason. + On Sun, 26 Oct 2003 00:46:29 -0400 Ilia Alshanetsky [EMAIL PROTECTED] wrote: On October 25, 2003 07:14 pm, Rasmus Lerdorf wrote: Ah, thought it was the other patch. However, I wouldn't call the above a new feature. That one is a bug fix as it was an oversight to not also convert form fields in multipart posts. Well, it is a mix of a feature a bug fix. The bug if we decide to call it such is by no means critical and 2 days before the release time is not a time to make any non critical changes simply because there is no time to test them. rfc1867.c is very sensitive code which previously had a number of security faults at least 1 directly caused by mbstring related changes. It is my opinion such changes have no place this late in the release cycle. Ilia -- Rui Hirokawa [EMAIL PROTECTED] -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h/main rfc1867.c
Rui, wasn't there any agreement with the author of libmbfl that still allows us to keep the modified version in the 4.3 branch? Unless there's something obvious, we'd be better off replacing them by the safer stuff however. Moriyoshi Rui Hirokawa [EMAIL PROTECTED] wrote: Ilia, I appreciate your continious effort about QC process. GPC bug in rfc1867.c is not critical one, and I agree with you it is not preferable in the final RC process. I will revert my GPC related patch in a couple of hours. But, I shoudn't revert an another license related patch as shown below because the license compatibility has priority. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h/main rfc1867.c
Moriyoshi, Yes, there was a temporary agreement that allows us to release the current version in the 4.3 branch until new implementation has stability. But, I think replacing libmbfl with mbfilter.* in PHP 4.3.4 is preferable because, 1. license problem should be solved as quickly as possible. 2. The differences of libmbfl and the current implementation are quite small because the new implementation is based on the current implementation. 3. the new implementation with libmbfl is well tested in PHP 5 since last August. 4. the new implementation was already confirmed to pass the all unit tests in ext/mbstring/tests/*. Rui On Sun, 26 Oct 2003 16:31:06 +0900 Moriyoshi Koizumi [EMAIL PROTECTED] wrote: Rui, wasn't there any agreement with the author of libmbfl that still allows us to keep the modified version in the 4.3 branch? Unless there's something obvious, we'd be better off replacing them by the safer stuff however. Moriyoshi Rui Hirokawa [EMAIL PROTECTED] wrote: Ilia, I appreciate your continious effort about QC process. GPC bug in rfc1867.c is not critical one, and I agree with you it is not preferable in the final RC process. I will revert my GPC related patch in a couple of hours. But, I shoudn't revert an another license related patch as shown below because the license compatibility has priority. -- Rui Hirokawa [EMAIL PROTECTED] -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h /main rfc1867.c
On October 26, 2003 02:20 am, Rui Hirokawa wrote: But, I shoudn't revert an another license related patch as shown below because the license compatibility has priority. There is no argument about the license fix patch, it is a necessary evil. I will make RC3 on Monday with this patch and if no bugs appear, go forth with 4.3.4 final 1 week from Monday. Ilia -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h /main rfc1867.c
My appologies for the delayed response (I see that the patch was commited). After reviewing the patch I would very much prefer if you would revert it and wait till PHP 4.3.5 (ot whatever the next release will be) with it. Ilia On October 24, 2003 11:08 pm, Rui Hirokawa wrote: Yes, I have plan to commit to 4.3 branch. Ilia, is it possible to commit ? Rui -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h /main rfc1867.c
On October 25, 2003 06:22 pm, Rasmus Lerdorf wrote: And continue breaking licenses knowingly? That patch does not fix licensing issues, it merely adds a feature, the license fix is not there... Patch log: name/value in multipart/form-date will be converted into internal encoding when mbstring.encoding_translation is On. Ilia -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h /main rfc1867.c
On Sat, 25 Oct 2003, Ilia Alshanetsky wrote: On October 25, 2003 06:22 pm, Rasmus Lerdorf wrote: And continue breaking licenses knowingly? That patch does not fix licensing issues, it merely adds a feature, the license fix is not there... Patch log: name/value in multipart/form-date will be converted into internal encoding when mbstring.encoding_translation is On. Ah, thought it was the other patch. However, I wouldn't call the above a new feature. That one is a bug fix as it was an oversight to not also convert form fields in multipart posts. -Rasmus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h /main rfc1867.c
I think it is a kind of bug fix because, 1. name field of multipart/form was not converted into internal encoding. This behavior is different from the usual GPC conversion performed by mbstr_treat_data() and it might makes confusion for the users. 2. auto-detection might be fail because auto-detection was performed per variables. It should be performed using the whole form data as in mbstr_treat_data(). 3. form field was converted into internal encoding even if mbstring.http_input is set to 'pass'. 4.auto detection was performed even if mbstring.http_input is set to 'pass' or any valid encoding . And the license fix is an another patch as Rasmus said. Rui On Sat, 25 Oct 2003 18:36:41 -0400 Ilia Alshanetsky [EMAIL PROTECTED] wrote: On October 25, 2003 06:22 pm, Rasmus Lerdorf wrote: And continue breaking licenses knowingly? That patch does not fix licensing issues, it merely adds a feature, the license fix is not there... Patch log: name/value in multipart/form-date will be converted into internal encoding when mbstring.encoding_translation is On. Ilia -- Rui Hirokawa [EMAIL PROTECTED] -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h /main rfc1867.c
On October 25, 2003 07:14 pm, Rasmus Lerdorf wrote: Ah, thought it was the other patch. However, I wouldn't call the above a new feature. That one is a bug fix as it was an oversight to not also convert form fields in multipart posts. Well, it is a mix of a feature a bug fix. The bug if we decide to call it such is by no means critical and 2 days before the release time is not a time to make any non critical changes simply because there is no time to test them. rfc1867.c is very sensitive code which previously had a number of security faults at least 1 directly caused by mbstring related changes. It is my opinion such changes have no place this late in the release cycle. Ilia -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mbstring mbstring.c mbstring.h /main rfc1867.c
Yes, I have plan to commit to 4.3 branch. Ilia, is it possible to commit ? Rui On Thu, 23 Oct 2003 10:43:16 +0900 (JST) Rasmus Lerdorf [EMAIL PROTECTED] wrote: Are you committing this to 4.3 as well? On Wed, 22 Oct 2003, Rui Hirokawa wrote: hirokawaWed Oct 22 10:14:06 2003 EDT Modified files: /php-src/main rfc1867.c /php-src/ext/mbstring mbstring.c mbstring.h Log: name/value in multipart/form-date will be converted into internal encoding when mbstring.encoding_translation is On. -- Rui Hirokawa [EMAIL PROTECTED] -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php