[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
tony2001Wed May 27 13:42:17 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: MFH: fix compile warnings http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.54r2=1.224.2.22.2.25.2.55diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.54 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.55 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.54Sun May 10 21:04:46 2009 +++ php-src/ext/mbstring/mbstring.c Wed May 27 13:42:17 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.54 2009/05/10 21:04:46 jani Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.55 2009/05/27 13:42:17 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(PHP_5_3) /ext/mbstring mbstring.c /ext/mbstring/tests zend_multibyte-02.phpt zend_multibyte-03.phpt zend_multibyte-04.phpt zend_multibyte-05.phpt zend_multibyte-06.phpt zend_mu
janiSun May 10 21:04:46 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c /php-src/ext/mbstring/tests 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.224.2.22.2.25.2.53r2=1.224.2.22.2.25.2.54diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.53 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.54 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.53Mon Apr 20 16:07:59 2009 +++ php-src/ext/mbstring/mbstring.c Sun May 10 21:04:46 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.53 2009/04/20 16:07:59 jani Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.54 2009/05/10 21:04:46 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); } @@ -4720,7 +4726,6 @@ /* }}} */ #ifdef ZEND_MULTIBYTE - /* {{{ php_mb_set_zend_encoding() */ static int php_mb_set_zend_encoding(TSRMLS_D) { @@ -4812,9 +4817,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-02.phpt?r1=1.1.2.2r2=1.1.2.3diff_format=u Index: php-src/ext/mbstring/tests/zend_multibyte-02.phpt diff -u php-src/ext/mbstring/tests/zend_multibyte-02.phpt:1.1.2.2
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
janiMon Apr 20 16:08:00 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: - Sync with HEAD (just reorder to match HEAD order) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.52r2=1.224.2.22.2.25.2.53diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.52 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.53 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.52Sun Mar 15 20:42:56 2009 +++ php-src/ext/mbstring/mbstring.c Mon Apr 20 16:07:59 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.52 2009/03/15 20:42:56 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.53 2009/04/20 16:07:59 jani Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -933,169 +933,6 @@ /* }}} */ #endif -#ifdef ZEND_MULTIBYTE -/* {{{ char *php_mb_encoding_detector() - * Interface for Zend Engine - */ -static char* php_mb_encoding_detector(const unsigned char *arg_string, size_t arg_length, char *arg_list TSRMLS_DC) -{ - mbfl_string string; - const char *ret; - enum mbfl_no_encoding *elist; - int size, *list; - - /* make encoding list */ - list = NULL; - size = 0; - php_mb_parse_encoding_list(arg_list, strlen(arg_list), list, size, 0 TSRMLS_CC); - if (size = 0) { - return NULL; - } - if (size 0 list != NULL) { - elist = list; - } else { - elist = MBSTRG(current_detect_order_list); - size = MBSTRG(current_detect_order_list_size); - } - - mbfl_string_init(string); - string.no_language = MBSTRG(language); - string.val = (unsigned char *)arg_string; - string.len = arg_length; - ret = mbfl_identify_encoding_name(string, elist, size, 0); - if (list != NULL) { - efree((void *)list); - } - if (ret != NULL) { - return estrdup(ret); - } else { - return NULL; - } -} -/* }}} */ - -/* {{{ 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) -{ - mbfl_string string, result, *ret; - enum mbfl_no_encoding from_encoding, to_encoding; - mbfl_buffer_converter *convd; - - /* new encoding */ - to_encoding = mbfl_name2no_encoding(encoding_to); - if (to_encoding == mbfl_no_encoding_invalid) { - return -1; - } - /* old encoding */ - from_encoding = mbfl_name2no_encoding(encoding_from); - if (from_encoding == mbfl_no_encoding_invalid) { - return -1; - } - /* initialize string */ - mbfl_string_init(string); - mbfl_string_init(result); - string.no_encoding = from_encoding; - string.no_language = MBSTRG(language); - string.val = (unsigned char*)from; - string.len = from_length; - - /* initialize converter */ - convd = mbfl_buffer_converter_new(from_encoding, to_encoding, string.len); - if (convd == NULL) { - return -1; - } - mbfl_buffer_converter_illegal_mode(convd, MBSTRG(current_filter_illegal_mode)); - mbfl_buffer_converter_illegal_substchar(convd, MBSTRG(current_filter_illegal_substchar)); - - /* do it */ - ret = mbfl_buffer_converter_feed_result(convd, string, result); - if (ret != NULL) { - *to = ret-val; - *to_length = ret-len; - } - - MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); - mbfl_buffer_converter_delete(convd); - - return ret ? 0 : -1; -} -/* }}} */ - -/* {{{ int php_mb_oddlen() - * returns number of odd (e.g. appears only first byte of multibyte - * character) chars - */ -static size_t php_mb_oddlen(const unsigned char *string, size_t length, const char *encoding TSRMLS_DC) -{ - mbfl_string mb_string; - - mbfl_string_init(mb_string); - mb_string.no_language = MBSTRG(language); - mb_string.no_encoding = mbfl_name2no_encoding(encoding); - mb_string.val = (unsigned char *)string; - mb_string.len = length; - - if (mb_string.no_encoding == mbfl_no_encoding_invalid) { - return 0; - } - return mbfl_oddlen(mb_string); -} -/* }}} */ - -/* {{{ php_mb_set_zend_encoding() */ -static int php_mb_set_zend_encoding(TSRMLS_D) -{ - /* 'd better use mbfl_memory_device? */ - char *name, *list = NULL; - int n, *entry, list_size = 0; - zend_encoding_detector encoding_detector; - zend_encoding_converter encoding_converter; - zend_encoding_oddlen
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
iliaa Fri Mar 6 15:48:30 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: Improve parameter parsing code http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.50r2=1.224.2.22.2.25.2.51diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.50 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.51 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.50Tue Feb 17 16:29:59 2009 +++ php-src/ext/mbstring/mbstring.c Fri Mar 6 15:48:30 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.50 2009/02/17 16:29:59 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.51 2009/03/06 15:48:30 iliaa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2279,7 +2279,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; @@ -2295,7 +2295,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); @@ -2323,9 +2323,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(PHP_5_3) /ext/mbstring mbstring.c /ext/mbstring/tests mb_get_info.phpt
moriyoshi Tue Feb 17 16:29:59 2009 UTC Added files: (Branch: PHP_5_3) /php-src/ext/mbstring/tests mb_get_info.phpt Modified files: /php-src/ext/mbstring mbstring.c Log: - MFH: Add an entry for http_output_conv_mimetypes to the output of mb_get_info(). (patch by T. Komura, thanks!) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.49r2=1.224.2.22.2.25.2.50diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.49 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.50 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.49Sun Feb 15 07:11:04 2009 +++ php-src/ext/mbstring/mbstring.c Tue Feb 17 16:29:59 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.49 2009/02/15 07:11:04 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.50 2009/02/17 16:29:59 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -4314,6 +4314,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]); @@ -4405,6 +4408,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]=
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c /ext/mbstring/libmbfl/mbfl mbfilter.c
moriyoshi Sun Feb 15 07:11:04 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c /php-src/ext/mbstring/libmbfl/mbfl mbfilter.c Log: - Forgot to include these files. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.48r2=1.224.2.22.2.25.2.49diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.48 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.49 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.48Sat Feb 14 07:34:15 2009 +++ php-src/ext/mbstring/mbstring.c Sun Feb 15 07:11:04 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.48 2009/02/14 07:34:15 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.49 2009/02/15 07:11:04 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2385,7 +2385,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); @@ -2454,7 +2454,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); @@ -2564,7 +2564,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; } @@ -2683,7 +2683,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.7.2.5.2.1.2.4r2=1.7.2.5.2.1.2.5diff_format=u Index: php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c diff -u php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.7.2.5.2.1.2.4 php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.7.2.5.2.1.2.5 --- php-src/ext/mbstring/libmbfl/mbfl/mbfilter.c:1.7.2.5.2.1.2.4Sat Feb 14 08:16:05 2009 +++ php-src/ext/mbstring/libmbfl/mbfl/mbfilter.cSun Feb 15 07:11:04 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, pc.needle); - if (filter == NULL) { - return -4; + + { + const mbfl_encoding *u8_enc; + u8_enc = mbfl_no2encoding(mbfl_no_encoding_utf8); + if (u8_enc == NULL || u8_enc-mblen_table == NULL) { + return -8; + } + u8_tbl = u8_enc-mblen_table; } - p = needle-val; - n = needle-len; - if (p != NULL) { - while (n 0) { - if ((*filter-filter_function)(*p++, filter) 0) { - break; - } - n--; + + if (haystack-no_encoding != mbfl_no_encoding_utf8) { + mbfl_string_init(_haystack_u8); + haystack_u8 = mbfl_convert_encoding(haystack, _haystack_u8, mbfl_no_encoding_utf8); + if (haystack_u8 == NULL) { + result = -4; + goto out; } - } - mbfl_convert_filter_flush(filter); -
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c mbstring.h /ext/mbstring/libmbfl/mbfl mbfilter.c /ext/mbstring/tests bug45923.phpt
moriyoshi Sat Feb 14 07:34:16 2009 UTC Added files: (Branch: PHP_5_3) /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: - MFH: fix Bug #45923 (mb_st[r]ripos() offset not handled correctly) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.47r2=1.224.2.22.2.25.2.48diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.47 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.48 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.47Wed Feb 11 14:26:24 2009 +++ php-src/ext/mbstring/mbstring.c Sat Feb 14 07:34:15 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.47 2009/02/11 14:26:24 iliaa Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.48 2009/02/14 07:34:15 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2237,12 +2237,12 @@ } } - if (offset 0 || (unsigned long)offset (unsigned long)mbfl_strlen(haystack)) { - 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) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty delimiter.); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty delimiter); RETURN_FALSE; } @@ -2254,17 +2254,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; } @@ -2351,10 +2351,13 @@ RETURN_FALSE; } - if ((offset 0 offset mbfl_strlen(haystack)) || - (offset 0 -offset mbfl_strlen(haystack))) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, Offset is greater than the length of haystack string); - 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); @@ -2411,10 +2414,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) { @@ -4804,7 +4803,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; @@ -4847,9 +4846,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); + +
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
iliaa Wed Feb 11 14:26:24 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: Improved param parsing http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.46r2=1.224.2.22.2.25.2.47diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.46 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.47 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.46Mon Feb 9 15:34:01 2009 +++ php-src/ext/mbstring/mbstring.c Wed Feb 11 14:26:24 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.46 2009/02/09 15:34:01 iliaa Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.47 2009/02/11 14:26:24 iliaa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1882,17 +1882,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); @@ -1945,13 +1944,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(PHP_5_3) /ext/mbstring mbstring.c
iliaa Mon Feb 9 15:34:01 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: Initialize optional var http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.45r2=1.224.2.22.2.25.2.46diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.45 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.46 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.45Thu Jan 29 22:59:57 2009 +++ php-src/ext/mbstring/mbstring.c Mon Feb 9 15:34:01 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.45 2009/01/29 22:59:57 scottmac Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.46 2009/02/09 15:34:01 iliaa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2034,7 +2034,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(PHP_5_3) /ext/mbstring mbstring.c
scottmacThu Jan 29 22:59:58 2009 UTC Modified files: (Branch: PHP_5_3) /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.224.2.22.2.25.2.44r2=1.224.2.22.2.25.2.45diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.44 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.45 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.44Mon Jan 5 09:14:58 2009 +++ php-src/ext/mbstring/mbstring.c Thu Jan 29 22:59:57 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.44 2009/01/05 09:14:58 tony2001 Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.45 2009/01/29 22:59:57 scottmac Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3187,6 +3187,7 @@ if (!php_mb_parse_encoding_array(encoding_list, list, size, 0 TSRMLS_CC)) { if (list) { efree(list); + list = NULL; size = 0; } } @@ -3196,6 +3197,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(PHP_5_3) /ext/mbstring mbstring.c
tony2001Mon Jan 5 09:14:58 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: fix memleaks correctly and make valgrind happy http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.43r2=1.224.2.22.2.25.2.44diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.43 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.44 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.43Wed Dec 31 11:15:38 2008 +++ php-src/ext/mbstring/mbstring.c Mon Jan 5 09:14:58 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.43 2008/12/31 11:15:38 sebastian Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.44 2009/01/05 09:14:58 tony2001 Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1883,12 +1883,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; } @@ -1907,9 +1907,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); } @@ -1917,15 +1917,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; } @@ -1947,9 +1945,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; } @@ -1966,36 +1964,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 { -
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c /ext/mbstring/tests mb_stristr_variation1.phpt mb_stristr_variation2.phpt
felipe Tue Dec 30 02:17:30 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c /php-src/ext/mbstring/tests mb_stristr_variation1.phpt mb_stristr_variation2.phpt Log: - MFH: 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.224.2.22.2.25.2.41r2=1.224.2.22.2.25.2.42diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.41 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.42 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.41Sat Dec 27 13:32:24 2008 +++ php-src/ext/mbstring/mbstring.c Tue Dec 30 02:17:30 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.41 2008/12/27 13:32:24 felipe Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.42 2008/12/30 02:17:30 felipe Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2555,7 +2555,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.1.4.2r2=1.1.4.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.1.4.2 php-src/ext/mbstring/tests/mb_stristr_variation1.phpt:1.1.4.3 --- php-src/ext/mbstring/tests/mb_stristr_variation1.phpt:1.1.4.2 Fri Dec 5 13:10:47 2008 +++ php-src/ext/mbstring/tests/mb_stristr_variation1.phpt Tue Dec 30 02:17:30 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 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 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 string, resource given, %s(%d) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_stristr_variation2.phpt?r1=1.1.4.2r2=1.1.4.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.1.4.2 php-src/ext/mbstring/tests/mb_stristr_variation2.phpt:1.1.4.3 --- php-src/ext/mbstring/tests/mb_stristr_variation2.phpt:1.1.4.2 Fri Dec 5 13:10:48 2008 +++ php-src/ext/mbstring/tests/mb_stristr_variation2.phpt Tue Dec 30 02:17:30 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 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) @@ -195,7 +195,7 @@ bool(false) --instance of classWithToString-- -string(0) +bool(false) --instance of classWithoutToString-- Error: 2 - mb_stristr() expects parameter 2 to be string, object given, %s(%d) -- PHP CVS Mailing List
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
felipe Sat Dec 27 13:32:24 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: - MFH: Fixed memory leaks http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.40r2=1.224.2.22.2.25.2.41diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.40 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.41 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.40Thu Dec 25 19:30:47 2008 +++ php-src/ext/mbstring/mbstring.c Sat Dec 27 13:32:24 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.40 2008/12/25 19:30:47 felipe Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.41 2008/12/27 13:32:24 felipe Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1922,8 +1922,10 @@ if (list) { efree(list); } + zval_ptr_dtor(arg1); RETURN_FALSE; } + zval_ptr_dtor(arg1); break; } @@ -1978,7 +1980,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(PHP_5_3) /ext/mbstring mbstring.c
felipe Thu Dec 25 19:30:48 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: - MFH: Fixed memory leak http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.39r2=1.224.2.22.2.25.2.40diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.39 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.40 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.39Thu Dec 11 02:56:45 2008 +++ php-src/ext/mbstring/mbstring.c Thu Dec 25 19:30:47 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.39 2008/12/11 02:56:45 scottmac Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.40 2008/12/25 19:30:47 felipe Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1989,7 +1989,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
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
5.2 isn't affected. Scott Ilia Alshanetsky wrote: Can you MFH this to 5.2 as well. On 10-Dec-08, at 9:56 PM, Scott MacVicar wrote: scottmacThu Dec 11 02:56:46 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstringmbstring.c Log: MFH Fix bug #46738 - Segfault when mb_detect_encoding() fails. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.38r2=1.224.2.22.2.25.2.39diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.38 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.39 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.38Mon Nov 17 11:27:56 2008 +++ php-src/ext/mbstring/mbstring.cThu Dec 11 02:56:45 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.38 2008/11/17 11:27:56 felipe Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.39 2008/12/11 02:56:45 scottmac Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3227,7 +3227,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 Ilia Alshanetsky -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
scottmacThu Dec 11 02:56:46 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: MFH Fix bug #46738 - Segfault when mb_detect_encoding() fails. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.38r2=1.224.2.22.2.25.2.39diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.38 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.39 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.38Mon Nov 17 11:27:56 2008 +++ php-src/ext/mbstring/mbstring.c Thu Dec 11 02:56:45 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.38 2008/11/17 11:27:56 felipe Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.39 2008/12/11 02:56:45 scottmac Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3227,7 +3227,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
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
On 12.09.2008 23:09, Moriyoshi Koizumi wrote: Hi Antony, Antony Dovgal wrote: The docs say mbstring.internal_encoding is PHP_INI_ALL, but this change makes it in fact PHP_INI_SYSTEM. Also why allow using mb_internal_encoding() and disallow changing the ini setting? I missed your mail. Sorry for the late reply. As for your question. It's not really an INI_SYSTEM setting. But you can't change it with ini_set() once the request is started, therefore it's not INI_ALL anymore. To take account of the other settings that are affected by the value of mbstring.internal_encoding, it turned out the corresponding global entry got to be handled in RINIT. the original INI values are kept by the zend_ini facility separately, so doing so is anyway safe. That doesn't answer my question. We have mb_internal_encoding(), which updates internal encoding; and we have ini_set() which is supposed to do the same, but it fails after your patch. What was the reason for such changes (breaking BC and such..) and what's the point to keep calling it INI_ALL if you can't change it with ini_set() anymore? -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
Hi Antony, It seems I mistook what you addressed. I thought you were talking about the situation with per-dir settings because you mentioned it as PHP_INI_SYSTEM, though, as you said, I failed to think of the runtime settings. I guess adding (stage == PHP_INI_STAGE_RUNTIME) in the conditions will fix the problem. Moriyoshi Antony Dovgal wrote: On 12.09.2008 23:09, Moriyoshi Koizumi wrote: Hi Antony, Antony Dovgal wrote: The docs say mbstring.internal_encoding is PHP_INI_ALL, but this change makes it in fact PHP_INI_SYSTEM. Also why allow using mb_internal_encoding() and disallow changing the ini setting? I missed your mail. Sorry for the late reply. As for your question. It's not really an INI_SYSTEM setting. But you can't change it with ini_set() once the request is started, therefore it's not INI_ALL anymore. To take account of the other settings that are affected by the value of mbstring.internal_encoding, it turned out the corresponding global entry got to be handled in RINIT. the original INI values are kept by the zend_ini facility separately, so doing so is anyway safe. That doesn't answer my question. We have mb_internal_encoding(), which updates internal encoding; and we have ini_set() which is supposed to do the same, but it fails after your patch. What was the reason for such changes (breaking BC and such..) and what's the point to keep calling it INI_ALL if you can't change it with ini_set() anymore? -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
Hi Antony, Antony Dovgal wrote: The docs say mbstring.internal_encoding is PHP_INI_ALL, but this change makes it in fact PHP_INI_SYSTEM. Also why allow using mb_internal_encoding() and disallow changing the ini setting? I missed your mail. Sorry for the late reply. As for your question. It's not really an INI_SYSTEM setting. To take account of the other settings that are affected by the value of mbstring.internal_encoding, it turned out the corresponding global entry got to be handled in RINIT. the original INI values are kept by the zend_ini facility separately, so doing so is anyway safe. Regards, Moriyoshi -- Moriyoshi Koizumi [EMAIL PROTECTED] -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c mbstring.h /ext/mbstring/tests mb_encoding_aliases.phpt mb_list_encodings.phpt
moriyoshi Sat Sep 13 00:30:51 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/mbstring/tests mb_encoding_aliases.phpt mb_list_encodings.phpt Modified files: /php-src/ext/mbstring mbstring.c mbstring.h Log: - MFH: mb_list_*() issue settlements http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.33r2=1.224.2.22.2.25.2.34diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.33 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.34 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.33Fri Sep 12 23:35:01 2008 +++ php-src/ext/mbstring/mbstring.c Sat Sep 13 00:30:51 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.33 2008/09/12 23:35:01 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.34 2008/09/13 00:30:51 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -401,6 +401,11 @@ ZEND_END_ARG_INFO() static +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_encoding_aliases, 0, 0, 1) + ZEND_ARG_INFO(0, encoding) +ZEND_END_ARG_INFO() + +static ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_encode_mimeheader, 0, 0, 1) ZEND_ARG_INFO(0, str) ZEND_ARG_INFO(0, charset) @@ -585,6 +590,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_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) @@ -3298,117 +3304,29 @@ } /* }}} */ -/* {{{ 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_encoding_aliases(string encoding) + Returns an array of the aliases of a given encoding name */ +PHP_FUNCTION(mb_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) { - 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 mixed mb_list_mime_names([string encoding]) - Returns an array or string of all supported mime names */
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
iliaa Wed Sep 10 23:19:38 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: 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.224.2.22.2.25.2.31r2=1.224.2.22.2.25.2.32diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.31 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.32 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.31Mon Aug 18 00:37:16 2008 +++ php-src/ext/mbstring/mbstring.c Wed Sep 10 23:19:38 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.31 2008/08/18 00:37:16 felipe Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.32 2008/09/10 23:19:38 iliaa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3117,7 +3117,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; } @@ -3238,7 +3238,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
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
On 03.08.2008 04:04, Moriyoshi Koizumi wrote: +/* {{{ 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; + } +} +/* }}} */ + The docs say mbstring.internal_encoding is PHP_INI_ALL, but this change makes it in fact PHP_INI_SYSTEM. Also why allow using mb_internal_encoding() and disallow changing the ini setting? -- 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(PHP_5_3) /ext/mbstring mbstring.c
felipe Mon Aug 18 00:37:16 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: - New parameter parsing API (for mb_convert_variables()) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.30r2=1.224.2.22.2.25.2.31diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.30 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.31 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.30Mon Aug 11 15:42:35 2008 +++ php-src/ext/mbstring/mbstring.c Mon Aug 18 00:37:16 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.30 2008/08/11 15:42:35 nlopess Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.31 2008/08/18 00:37:16 felipe Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3600,37 +3600,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; - 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; + char *name, *to_enc; + void *ptmp; + + 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; } @@ -3644,13 +3637,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) { @@ -3665,7 +3658,7 @@ stack_level = 0; identd = mbfl_encoding_detector_new(elist, elistsz, MBSTRG(strict_detection)); if (identd != NULL) { - n = 2; + n = 0; while (n argc || stack_level 0) { if (stack_level = 0) { var = args[n++]; @@ -3746,7 +3739,7 @@ stack_max = PHP_MBSTR_STACK_BLOCK_SIZE; stack = (zval ***)safe_emalloc(stack_max, sizeof(zval **), 0); stack_level = 0; - n = 2; + n = 0; while (n argc || stack_level 0) { if (stack_level = 0) { var = args[n++]; @@ -3812,7 +3805,7 @@ mbfl_buffer_converter_delete(convd); } - efree((void *)args); + efree(args); name = (char *)mbfl_no_encoding2name(from_encoding); if (name != NULL) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
nlopess Mon Aug 11 15:42:35 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: MFH: fix build when pcre is not present http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.29r2=1.224.2.22.2.25.2.30diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.29 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.30 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.29Mon Aug 4 21:06:13 2008 +++ php-src/ext/mbstring/mbstring.c Mon Aug 11 15:42:35 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.29 2008/08/04 21:06:13 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.30 2008/08/11 15:42:35 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
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
moriyoshi Mon Aug 4 21:06:14 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: - MFH: More fixes for bug #45691 http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.28r2=1.224.2.22.2.25.2.29diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.28 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.29 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.28Sun Aug 3 11:58:15 2008 +++ php-src/ext/mbstring/mbstring.c Mon Aug 4 21:06:13 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.28 2008/08/03 11:58:15 jani Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.29 2008/08/04 21:06:13 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1394,6 +1394,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; @@ -1429,7 +1434,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); @@ -1604,9 +1610,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(PHP_5_3) /ext/mbstring mbstring.c
janiSun Aug 3 11:58:15 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: MFH: no c++ comments in c files http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.27r2=1.224.2.22.2.25.2.28diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.27 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.28 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.27Sun Aug 3 00:04:17 2008 +++ php-src/ext/mbstring/mbstring.c Sun Aug 3 11:58:15 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.27 2008/08/03 00:04:17 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.28 2008/08/03 11:58:15 jani Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1330,12 +1330,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(PHP_5_3) /ext/mbstring mbstring.c mbstring.h
moriyoshi Sat Aug 2 20:49:00 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c mbstring.h Log: - MFH: 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.224.2.22.2.25.2.25r2=1.224.2.22.2.25.2.26diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.25 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.26 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.25Fri Jul 25 14:04:54 2008 +++ php-src/ext/mbstring/mbstring.c Sat Aug 2 20:49:00 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.25 2008/07/25 14:04:54 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.26 2008/08/02 20:49:00 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1007,7 +1007,7 @@ } mbfl_string_init(string); - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); string.val = (unsigned char *)arg_string; string.len = arg_length; ret = mbfl_identify_encoding_name(string, elist, size, 0); @@ -1045,7 +1045,7 @@ mbfl_string_init(string); mbfl_string_init(result); string.no_encoding = from_encoding; - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); string.val = (unsigned char*)from; string.len = from_length; @@ -1080,7 +1080,7 @@ mbfl_string mb_string; mbfl_string_init(mb_string); - mb_string.no_language = MBSTRG(current_language); + mb_string.no_language = MBSTRG(language); mb_string.no_encoding = mbfl_name2no_encoding(encoding); mb_string.val = (unsigned char *)string; mb_string.len = length; @@ -1171,6 +1171,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; @@ -1186,12 +1187,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; } @@ -1206,12 +1211,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; } @@ -1229,6 +1239,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; } @@ -1242,31 +1254,72 @@ 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; +
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
moriyoshi Sun Aug 3 00:04:17 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: - MFH: 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.224.2.22.2.25.2.26r2=1.224.2.22.2.25.2.27diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.26 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.27 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.26Sat Aug 2 20:49:00 2008 +++ php-src/ext/mbstring/mbstring.c Sun Aug 3 00:04:17 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.26 2008/08/02 20:49:00 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.27 2008/08/03 00:04:17 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1250,8 +1250,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; @@ -1324,6 +1324,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) @@ -1577,8 +1594,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
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c mbstring.h
On 25.07.2008 02:21, Moriyoshi Koizumi wrote: moriyoshi Thu Jul 24 22:21:42 2008 UTC Added files: (Branch: PHP_5_3) /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 All of these tests fail (except for the first one). -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c mbstring.h
Can you send me the test results? I tested on PPC and i386, and they went well without problems. Moriyoshi On 2008/07/25, at 16:09, Antony Dovgal wrote: On 25.07.2008 02:21, Moriyoshi Koizumi wrote: moriyoshi Thu Jul 24 22:21:42 2008 UTC Added files: (Branch: PHP_5_3) /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 All of these tests fail (except for the first one). -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c mbstring.h
On 25.07.2008 13:29, Moriyoshi Koizumi wrote: Can you send me the test results? I tested on PPC and i386, and they went well without problems. I'm testing on Linux 64bit. Here are the diffs. -- ext/mbstring/tests/zend_multibyte-02.diff -- 001+ string(18) e38386e382b9e38388 001- string(12) 836583588367 -- ext/mbstring/tests/zend_multibyte-03.diff -- 001+ string(18) e38386e382b9e38388 001- string(12) a5c6a5b9a5c8 -- ext/mbstring/tests/zend_multibyte-04.diff -- 001+ string(12) 836583588367 001- string(18) e38386e382b9e38388 -- ext/mbstring/tests/zend_multibyte-05.diff -- 001+ string(18) e38386e382b9e38388 001- string(16) 3f3f3fe9b4bb3f3f -- ext/mbstring/tests/zend_multibyte-06.diff -- 001+ string(18) e38386e382b9e38388 001- string(12) 836583588367 -- ext/mbstring/tests/zend_multibyte-07.diff -- 001+ string(18) e38386e382b9e38388 001- string(12) a5c6a5b9a5c8 -- ext/mbstring/tests/zend_multibyte-08.diff -- 001+ string(12) 836583588367 001- string(18) e38386e382b9e38388 -- ext/mbstring/tests/zend_multibyte-09.diff -- 001+ string(18) e38386e382b9e38388 001- string(16) 3f3f3fe9b4bb3f3f -- ext/mbstring/tests/zend_multibyte-10.diff -- 001+ 001- Fatal error: Encoding declaration pragma must be the very first statement in the script in %s on line 3 -- ext/mbstring/tests/zend_multibyte-11.diff -- 001+ 001- Fatal error: Encoding declaration pragma must be the very first statement in the script in %s on line 3 -- ext/mbstring/tests/zend_multibyte-12.diff -- 001+ 1 001- Fatal error: Encoding declaration pragma must be the very first statement in the script in %s on line 4 -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c mbstring.h
It's probable that segfaults occurred in the test 10, 11 and 12. would you mind posting it if that's the case? Moriyoshi On 2008/07/25, at 18:51, Antony Dovgal wrote: On 25.07.2008 13:29, Moriyoshi Koizumi wrote: Can you send me the test results? I tested on PPC and i386, and they went well without problems. I'm testing on Linux 64bit. Here are the diffs. -- ext/mbstring/tests/zend_multibyte-02.diff -- 001+ string(18) e38386e382b9e38388 001- string(12) 836583588367 -- ext/mbstring/tests/zend_multibyte-03.diff -- 001+ string(18) e38386e382b9e38388 001- string(12) a5c6a5b9a5c8 -- ext/mbstring/tests/zend_multibyte-04.diff -- 001+ string(12) 836583588367 001- string(18) e38386e382b9e38388 -- ext/mbstring/tests/zend_multibyte-05.diff -- 001+ string(18) e38386e382b9e38388 001- string(16) 3f3f3fe9b4bb3f3f -- ext/mbstring/tests/zend_multibyte-06.diff -- 001+ string(18) e38386e382b9e38388 001- string(12) 836583588367 -- ext/mbstring/tests/zend_multibyte-07.diff -- 001+ string(18) e38386e382b9e38388 001- string(12) a5c6a5b9a5c8 -- ext/mbstring/tests/zend_multibyte-08.diff -- 001+ string(12) 836583588367 001- string(18) e38386e382b9e38388 -- ext/mbstring/tests/zend_multibyte-09.diff -- 001+ string(18) e38386e382b9e38388 001- string(16) 3f3f3fe9b4bb3f3f -- ext/mbstring/tests/zend_multibyte-10.diff -- 001+ 001- Fatal error: Encoding declaration pragma must be the very first statement in the script in %s on line 3 -- ext/mbstring/tests/zend_multibyte-11.diff -- 001+ 001- Fatal error: Encoding declaration pragma must be the very first statement in the script in %s on line 3 -- ext/mbstring/tests/zend_multibyte-12.diff -- 001+ 1 001- Fatal error: Encoding declaration pragma must be the very first statement in the script in %s on line 4 -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c mbstring.h
On 25.07.2008 13:51, Moriyoshi Koizumi wrote: It's probable that segfaults occurred in the test 10, 11 and 12. would you mind posting it if that's the case? No, there are no segfaults and valgrind keeps silence, too. It seems I found it: --SKIP-- ?php ini_set(mbstring.script_encoding, SJIS); ini_set(mbstring.script_encoding, ***) != SJIS or die(skip zend-multibyte is not available); ? Note that *** instead of SJIS. -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c mbstring.h
On 2008/07/25, at 19:11, Antony Dovgal wrote: On 25.07.2008 13:51, Moriyoshi Koizumi wrote: It's probable that segfaults occurred in the test 10, 11 and 12. would you mind posting it if that's the case? No, there are no segfaults and valgrind keeps silence, too. It seems I found it: --SKIP-- ?php ini_set(mbstring.script_encoding, SJIS); ini_set(mbstring.script_encoding, ***) != SJIS or die(skip zend-multibyte is not available); ? Note that *** instead of SJIS. ini_set() returns the previously set value, so that's fine. But I eventually noticed that the logic is inversed - or should be and actually. Thanks for the heads-up. Moriyoshi -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c mbstring.h
On 25.07.2008 14:36, Moriyoshi Koizumi wrote: ini_set() returns the previously set value, so that's fine. But I eventually noticed that the logic is inversed - or should be and actually. Thanks for the heads-up. The tests still fail, though. Even with zend multibyte enabled. -- ext/mbstring/tests/zend_multibyte-02.diff -- 001+ string(18) e38386e382b9e38388 001- string(12) 836583588367 -- ext/mbstring/tests/zend_multibyte-03.diff -- 001+ string(18) e38386e382b9e38388 001- string(12) a5c6a5b9a5c8 -- ext/mbstring/tests/zend_multibyte-04.diff -- 001+ string(12) 836583588367 001- string(18) e38386e382b9e38388 -- ext/mbstring/tests/zend_multibyte-05.diff -- 001+ string(18) e38386e382b9e38388 001- string(16) 3f3f3fe9b4bb3f3f -- ext/mbstring/tests/zend_multibyte-06.diff -- 001+ string(18) e38386e382b9e38388 001- string(12) 836583588367 -- ext/mbstring/tests/zend_multibyte-07.diff -- 001+ string(18) e38386e382b9e38388 001- string(12) a5c6a5b9a5c8 -- ext/mbstring/tests/zend_multibyte-08.diff -- 001+ string(12) 836583588367 001- string(18) e38386e382b9e38388 -- ext/mbstring/tests/zend_multibyte-09.diff -- 001+ string(18) e38386e382b9e38388 001- string(16) 3f3f3fe9b4bb3f3f -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c mbstring.h
I overlooked one more error; I wrote --SKIP-- everywhere --SKIPIF-- is expected :/ I committed the fix and now it should be ok ;) Moriyoshi On 2008/07/25, at 19:47, Antony Dovgal wrote: On 25.07.2008 14:36, Moriyoshi Koizumi wrote: ini_set() returns the previously set value, so that's fine. But I eventually noticed that the logic is inversed - or should be and actually. Thanks for the heads-up. The tests still fail, though. Even with zend multibyte enabled. -- ext/mbstring/tests/zend_multibyte-02.diff -- 001+ string(18) e38386e382b9e38388 001- string(12) 836583588367 -- ext/mbstring/tests/zend_multibyte-03.diff -- 001+ string(18) e38386e382b9e38388 001- string(12) a5c6a5b9a5c8 -- ext/mbstring/tests/zend_multibyte-04.diff -- 001+ string(12) 836583588367 001- string(18) e38386e382b9e38388 -- ext/mbstring/tests/zend_multibyte-05.diff -- 001+ string(18) e38386e382b9e38388 001- string(16) 3f3f3fe9b4bb3f3f -- ext/mbstring/tests/zend_multibyte-06.diff -- 001+ string(18) e38386e382b9e38388 001- string(12) 836583588367 -- ext/mbstring/tests/zend_multibyte-07.diff -- 001+ string(18) e38386e382b9e38388 001- string(12) a5c6a5b9a5c8 -- ext/mbstring/tests/zend_multibyte-08.diff -- 001+ string(12) 836583588367 001- string(18) e38386e382b9e38388 -- ext/mbstring/tests/zend_multibyte-09.diff -- 001+ string(18) e38386e382b9e38388 001- string(16) 3f3f3fe9b4bb3f3f -- 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(PHP_5_3) /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_
moriyoshi Fri Jul 25 12:51:47 2008 UTC Added files: (Branch: PHP_5_3) /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: - MFH: Fix a typo in mb_stripos() that caused segfaults (noticed by [EMAIL PROTECTED], thanks). http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.22r2=1.224.2.22.2.25.2.23diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.22 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.23 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.22Thu Jul 24 22:21:41 2008 +++ php-src/ext/mbstring/mbstring.c Fri Jul 25 12:51:47 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.22 2008/07/24 22:21:41 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.23 2008/07/25 12:51:47 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2392,10 +2392,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
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
moriyoshi Fri Jul 25 13:57:23 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: - MFH: Fix wrong cast http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.23r2=1.224.2.22.2.25.2.24diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.23 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.24 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.23Fri Jul 25 12:51:47 2008 +++ php-src/ext/mbstring/mbstring.c Fri Jul 25 13:57:23 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.23 2008/07/25 12:51:47 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.24 2008/07/25 13:57:23 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -,7 +,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(PHP_5_3) /ext/mbstring mbstring.c php_mbregex.c
moriyoshi Fri Jul 25 14:04:54 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c php_mbregex.c Log: - MFH: Fix warnings http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.24r2=1.224.2.22.2.25.2.25diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.24 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.25 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.24Fri Jul 25 13:57:23 2008 +++ php-src/ext/mbstring/mbstring.c Fri Jul 25 14:04:54 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.24 2008/07/25 13:57:23 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.25 2008/07/25 14:04:54 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2425,7 +2425,7 @@ RETURN_FALSE; } - if (offset haystack.len) { + if ((unsigned int)offset haystack.len) { RETURN_FALSE; } @@ -2833,11 +2833,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; } @@ -3219,7 +3219,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.53.2.1.2.4.2.10r2=1.53.2.1.2.4.2.11diff_format=u Index: php-src/ext/mbstring/php_mbregex.c diff -u php-src/ext/mbstring/php_mbregex.c:1.53.2.1.2.4.2.10 php-src/ext/mbstring/php_mbregex.c:1.53.2.1.2.4.2.11 --- php-src/ext/mbstring/php_mbregex.c:1.53.2.1.2.4.2.10Tue Jul 22 09:18:30 2008 +++ php-src/ext/mbstring/php_mbregex.c Fri Jul 25 14:04:54 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_mbregex.c,v 1.53.2.1.2.4.2.10 2008/07/22 09:18:30 moriyoshi Exp $ */ +/* $Id: php_mbregex.c,v 1.53.2.1.2.4.2.11 2008/07/25 14:04:54 moriyoshi Exp $ */ #ifdef HAVE_CONFIG_H @@ -928,7 +928,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) { @@ -1021,7 +1021,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 @@ char *arg_pattern, *arg_options; int arg_pattern_len, arg_options_len; OnigSyntaxType *syntax = NULL; - int option; + OnigOptionType option; if (zend_parse_parameters(argc TSRMLS_CC, z|ss, arg_str, arg_pattern, arg_pattern_len, arg_options, arg_options_len) == FAILURE) { return; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c mbstring.h php_unicode.c php_unicode.h /ext/mbstring/tests mb_strstr.phpt
moriyoshi Thu Jul 24 13:46:50 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/mbstring/tests mb_strstr.phpt Modified files: /php-src/ext/mbstring mbstring.c mbstring.h php_unicode.c php_unicode.h Log: - MFH: Fixed warnings. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.20r2=1.224.2.22.2.25.2.21diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.20 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.21 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.20Thu Jul 24 13:01:49 2008 +++ php-src/ext/mbstring/mbstring.c Thu Jul 24 13:46:49 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.20 2008/07/24 13:01:49 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.21 2008/07/24 13:46:49 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2225,17 +2225,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); @@ -2251,21 +2251,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); @@ -2292,7 +2292,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; } @@ -2398,9 +2398,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); @@ -2413,7 +2413,7 @@ RETURN_FALSE; } - if(!needle.len){ + if (!needle.len) { php_error_docref(NULL TSRMLS_CC, E_WARNING,Empty delimiter.); RETURN_FALSE; } @@ -2424,7 +2424,7 @@ RETURN_FALSE; } -
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c mbstring.h php_mbregex.c php_mbregex.h
moriyoshi Thu Jul 17 16:08:37 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c mbstring.h php_mbregex.c php_mbregex.h Log: - MFH: Removed dependencies from php_mbregex to oniguruma types http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.17r2=1.224.2.22.2.25.2.18diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.17 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.18 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.17Wed Jul 16 02:30:48 2008 +++ php-src/ext/mbstring/mbstring.c Thu Jul 17 16:08:37 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.17 2008/07/16 02:30:48 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.18 2008/07/17 16:08:37 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; @@ -906,7 +910,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; } @@ -1003,12 +1007,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 @@ -1159,7 +1164,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 } /* }}} */ @@ -1168,7 +1173,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.66.2.4.2.5.2.2r2=1.66.2.4.2.5.2.3diff_format=u Index: php-src/ext/mbstring/mbstring.h diff -u php-src/ext/mbstring/mbstring.h:1.66.2.4.2.5.2.2 php-src/ext/mbstring/mbstring.h:1.66.2.4.2.5.2.3 --- php-src/ext/mbstring/mbstring.h:1.66.2.4.2.5.2.2Wed Jan 30 09:41:12 2008 +++ php-src/ext/mbstring/mbstring.h Thu Jul 17 16:08:37 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mbstring.h,v 1.66.2.4.2.5.2.2 2008/01/30 09:41:12 dmitry Exp $ */ +/* $Id: mbstring.h,v 1.66.2.4.2.5.2.3 2008/07/17 16:08:37 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.53.2.1.2.4.2.8r2=1.53.2.1.2.4.2.9diff_format=u Index: php-src/ext/mbstring/php_mbregex.c diff -u
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c php_mbregex.h
moriyoshi Thu Jul 17 20:04:06 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c php_mbregex.h Log: - MFH: Fix ZTS build http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.18r2=1.224.2.22.2.25.2.19diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.18 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.19 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.18Thu Jul 17 16:08:37 2008 +++ php-src/ext/mbstring/mbstring.c Thu Jul 17 20:04:05 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.18 2008/07/17 16:08:37 moriyoshi Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.19 2008/07/17 20:04:05 moriyoshi Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1008,12 +1008,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.12.2.1.2.1.2.7r2=1.12.2.1.2.1.2.8diff_format=u Index: php-src/ext/mbstring/php_mbregex.h diff -u php-src/ext/mbstring/php_mbregex.h:1.12.2.1.2.1.2.7 php-src/ext/mbstring/php_mbregex.h:1.12.2.1.2.1.2.8 --- php-src/ext/mbstring/php_mbregex.h:1.12.2.1.2.1.2.7 Thu Jul 17 16:08:37 2008 +++ php-src/ext/mbstring/php_mbregex.h Thu Jul 17 20:04:06 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_mbregex.h,v 1.12.2.1.2.1.2.7 2008/07/17 16:08:37 moriyoshi Exp $ */ +/* $Id: php_mbregex.h,v 1.12.2.1.2.1.2.8 2008/07/17 20:04:06 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(PHP_5_3) /ext/mbstring mbstring.c
hirokawaSun Jul 13 01:34:21 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: fixed #43227 removed PHP_INI_PERDIR from mbstring.func_overload. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.15r2=1.224.2.22.2.25.2.16diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.15 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.16 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.15Fri Jul 11 13:53:09 2008 +++ php-src/ext/mbstring/mbstring.c Sun Jul 13 01:34:21 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.15 2008/07/11 13:53:09 felipe Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.16 2008/07/13 01:34:21 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -,8 +,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 | -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(PHP_5_3) /ext/mbstring mbstring.c
felipe Fri Jul 11 13:53:10 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: MFB: - Fixed bug #45486 (mb_send_mail(); header 'Content-Type: text/plain; charset=' parsing incorrect) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.14r2=1.224.2.22.2.25.2.15diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.14 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.15 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.14Mon Jul 7 12:52:00 2008 +++ php-src/ext/mbstring/mbstring.c Fri Jul 11 13:53:09 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.14 2008/07/07 12:52:00 felipe Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.15 2008/07/11 13:53:09 felipe Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -3916,7 +3916,7 @@ if (strcasecmp(param_name, charset) == 0) { enum mbfl_no_encoding _tran_cs = tran_cs; - charset = php_strtok_r(NULL, = , tmp); + charset = php_strtok_r(NULL, = \, tmp); if (charset != NULL) { _tran_cs = mbfl_name2no_encoding(charset); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c php_mbregex.h
felipe Mon Jul 7 12:40:51 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c php_mbregex.h Log: - Added arginfo - Removed unnecessary #include zend_arg_defs.c http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.12r2=1.224.2.22.2.25.2.13diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.12 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.13 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.12Sat Jul 5 06:52:04 2008 +++ php-src/ext/mbstring/mbstring.c Mon Jul 7 12:40:51 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.12 2008/07/05 06:52:04 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.13 2008/07/07 12:40:51 felipe Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -169,32 +169,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}, @@ -221,46 +195,393 @@ }; /* }}} */ +/* {{{ 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) +
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
felipe Mon Jul 7 12:52:01 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: - Removed unused variables http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.13r2=1.224.2.22.2.25.2.14diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.13 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.14 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.13Mon Jul 7 12:40:51 2008 +++ php-src/ext/mbstring/mbstring.c Mon Jul 7 12:52:00 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.13 2008/07/07 12:40:51 felipe Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.14 2008/07/07 12:52:00 felipe Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2610,7 +2610,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
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c php_mbregex.c /ext/mbstring/tests mb_ereg2.phpt mb_regex_encoding_error1.phpt mb_regex_encoding_variation1.phpt mb_substr_error1.phpt mb_su
2008/6/28 Alexey Zakhlestin [EMAIL PROTECTED]: indeyetsSat Jun 28 21:23:08 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c php_mbregex.c /php-src/ext/mbstring/tests mb_ereg2.phpt mb_regex_encoding_error1.phpt mb_regex_encoding_variation1.phpt mb_substr_error1.phpt mb_substr_variation1.phpt mb_substr_variation2.phpt Log: updated to the new parameter-parsing api Please merge these changes to HEAD as well (HEAD is an active branch ;) Thanks for your work! Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c php_mbregex.c
tony2001Tue Jul 1 07:54:31 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c php_mbregex.c Log: string length - int http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.10r2=1.224.2.22.2.25.2.11diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.10 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.11 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.10Sat Jun 28 21:23:07 2008 +++ php-src/ext/mbstring/mbstring.c Tue Jul 1 07:54:30 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.10 2008/06/28 21:23:07 indeyets Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.11 2008/07/01 07:54:30 tony2001 Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2108,8 +2108,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) { @@ -2181,7 +2181,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) { @@ -2285,7 +2286,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) { @@ -2428,7 +2430,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; @@ -2571,7 +2573,7 @@ PHP_FUNCTION(mb_detect_encoding) { char *str; - long str_len; + int str_len; zend_bool strict=0; zval *encoding_list; @@ -3189,7 +3191,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(); http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/php_mbregex.c?r1=1.53.2.1.2.4.2.5r2=1.53.2.1.2.4.2.6diff_format=u Index: php-src/ext/mbstring/php_mbregex.c diff -u php-src/ext/mbstring/php_mbregex.c:1.53.2.1.2.4.2.5 php-src/ext/mbstring/php_mbregex.c:1.53.2.1.2.4.2.6 --- php-src/ext/mbstring/php_mbregex.c:1.53.2.1.2.4.2.5 Sat Jun 28 21:23:07 2008 +++ php-src/ext/mbstring/php_mbregex.c Tue Jul 1 07:54:30 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_mbregex.c,v 1.53.2.1.2.4.2.5 2008/06/28 21:23:07 indeyets Exp $ */ +/* $Id: php_mbregex.c,v 1.53.2.1.2.4.2.6 2008/07/01 07:54:30 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H @@ -489,7 +489,7 @@ { size_t argc = ZEND_NUM_ARGS(); char *encoding; - long encoding_len; + int encoding_len; OnigEncoding mbctype; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |s, encoding, encoding_len) == FAILURE) { @@ -946,7 +946,7 @@ { size_t argc = ZEND_NUM_ARGS(); char *arg_pattern, *arg_options; - long arg_pattern_len, arg_options_len; + int arg_pattern_len, arg_options_len; int n, i, err, pos, len, beg, end, option; OnigUChar *str; OnigSyntaxType *syntax; @@ -1076,7 +1076,7 @@ size_t argc = ZEND_NUM_ARGS(); zval *arg_str; char *arg_pattern, *arg_options; - long arg_pattern_len, arg_options_len; + int arg_pattern_len, arg_options_len; OnigSyntaxType *syntax = NULL; int option; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c php_mbregex.h
indeyetsSat Jun 28 18:04:19 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c php_mbregex.h Log: added arginfo (fixes #45388) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.8r2=1.224.2.22.2.25.2.9diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.8 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.9 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.8 Fri Jun 13 14:48:33 2008 +++ php-src/ext/mbstring/mbstring.c Sat Jun 28 18:04:19 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.8 2008/06/13 14:48:33 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.9 2008/06/28 18:04:19 indeyets Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -167,6 +167,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}, @@ -204,7 +224,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) @@ -227,7 +247,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) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/php_mbregex.h?r1=1.12.2.1.2.1.2.1r2=1.12.2.1.2.1.2.2diff_format=u Index: php-src/ext/mbstring/php_mbregex.h diff -u php-src/ext/mbstring/php_mbregex.h:1.12.2.1.2.1.2.1 php-src/ext/mbstring/php_mbregex.h:1.12.2.1.2.1.2.2 --- php-src/ext/mbstring/php_mbregex.h:1.12.2.1.2.1.2.1 Mon Dec 31 07:17:09 2007 +++ php-src/ext/mbstring/php_mbregex.h Sat Jun 28 18:04:19 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_mbregex.h,v 1.12.2.1.2.1.2.1 2007/12/31 07:17:09 sebastian Exp $ */ +/* $Id: php_mbregex.h,v 1.12.2.1.2.1.2.2 2008/06/28 18:04:19 indeyets Exp $ */ #ifndef _PHP_MBREGEX_H #define _PHP_MBREGEX_H @@ -45,8 +45,8 @@ #define PHP_MBREGEX_FUNCTION_ENTRIES \ PHP_FE(mb_regex_encoding, NULL) \ PHP_FE(mb_regex_set_options,NULL) \ - PHP_FE(mb_ereg, third_arg_force_ref) \ - PHP_FE(mb_eregi,third_arg_force_ref) \ + PHP_FE(mb_ereg, mb_ereg_arginfo) \ + PHP_FE(mb_eregi,mb_ereg_arginfo) \ PHP_FE(mb_ereg_replace, NULL) \ PHP_FE(mb_eregi_replace,NULL) \ PHP_FE(mb_split,NULL) \ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c php_mbregex.c /ext/mbstring/tests mb_ereg2.phpt mb_regex_encoding_error1.phpt mb_regex_encoding_variation1.phpt mb_substr_error1.phpt mb_subst
indeyetsSat Jun 28 21:23:08 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c php_mbregex.c /php-src/ext/mbstring/tests mb_ereg2.phpt mb_regex_encoding_error1.phpt mb_regex_encoding_variation1.phpt mb_substr_error1.phpt mb_substr_variation1.phpt mb_substr_variation2.phpt Log: updated to the new parameter-parsing api http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.9r2=1.224.2.22.2.25.2.10diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.9 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.10 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.9 Sat Jun 28 18:04:19 2008 +++ php-src/ext/mbstring/mbstring.c Sat Jun 28 21:23:07 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.9 2008/06/28 18:04:19 indeyets Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.10 2008/06/28 21:23:07 indeyets Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1293,12 +1293,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); @@ -1310,12 +1315,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); } @@ -1323,8 +1328,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); } @@ -1332,18 +1337,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; } } /* }}} */ @@ -1352,52 +1356,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)
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
hirokawaFri Jun 13 14:48:33 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: MFH http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.7r2=1.224.2.22.2.25.2.8diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.7 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.8 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.7 Sat Feb 16 10:43:57 2008 +++ php-src/ext/mbstring/mbstring.c Fri Jun 13 14:48:33 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.7 2008/02/16 10:43:57 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.8 2008/06/13 14:48:33 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1025,9 +1025,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(PHP_5_3) /ext/mbstring mbstring.c
hirokawaSat Feb 16 08:21:39 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: 'auto' encoding was not initialized correctly per request basis. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.4r2=1.224.2.22.2.25.2.5diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.4 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.5 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.4 Mon Dec 31 07:17:09 2007 +++ php-src/ext/mbstring/mbstring.c Sat Feb 16 08:21:39 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.4 2007/12/31 07:17:09 sebastian Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.5 2008/02/16 08:21:39 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -888,6 +888,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(PHP_5_3) /ext/mbstring mbstring.c
hirokawaSat Feb 16 08:58:01 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: fixed bug #43840 mb_strpos bounds check is byte count rather than a character count. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.5r2=1.224.2.22.2.25.2.6diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.5 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.6 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.5 Sat Feb 16 08:21:39 2008 +++ php-src/ext/mbstring/mbstring.c Sat Feb 16 08:58:00 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.5 2008/02/16 08:21:39 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.6 2008/02/16 08:58:00 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1613,7 +1613,7 @@ } } - if (offset 0 || (unsigned long)offset haystack.len) { + if (offset 0 || (unsigned long)offset (unsigned long)mbfl_strlen(haystack)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Offset not contained in string.); RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
hirokawaSat Feb 16 10:43:57 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: fixed #43841 mb_strrpos offset is byte count for negative values. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.6r2=1.224.2.22.2.25.2.7diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.6 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.7 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.6 Sat Feb 16 08:58:00 2008 +++ php-src/ext/mbstring/mbstring.c Sat Feb 16 10:43:57 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.6 2008/02/16 08:58:00 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.7 2008/02/16 10:43:57 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1726,6 +1726,13 @@ if (needle.len = 0) { RETURN_FALSE; } + + if ((offset 0 offset mbfl_strlen(haystack)) || + (offset 0 -offset mbfl_strlen(haystack))) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, Offset is greater than the length of haystack string); + RETURN_FALSE; + } + n = mbfl_strpos(haystack, needle, offset, 1); if (n = 0) { RETVAL_LONG(n); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
Please MFH the fix into the 5.2 branch. On 16-Feb-08, at 3:58 AM, Rui Hirokawa wrote: hirokawaSat Feb 16 08:58:01 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstringmbstring.c Log: fixed bug #43840 mb_strpos bounds check is byte count rather than a character count. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.5r2=1.224.2.22.2.25.2.6diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.5 php-src/ ext/mbstring/mbstring.c:1.224.2.22.2.25.2.6 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.5 Sat Feb 16 08:21:39 2008 +++ php-src/ext/mbstring/mbstring.c Sat Feb 16 08:58:00 2008 @@ -17,7 +17,7 @@ + --+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.5 2008/02/16 08:21:39 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.6 2008/02/16 08:58:00 hirokawa Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -1613,7 +1613,7 @@ } } - if (offset 0 || (unsigned long)offset haystack.len) { + if (offset 0 || (unsigned long)offset (unsigned long)mbfl_strlen(haystack)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Offset not contained in string.); RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Ilia Alshanetsky -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
bjori Wed Dec 26 21:02:46 2007 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: MFH: Fix typo (TAKAGI Masahiro) http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.2r2=1.224.2.22.2.25.2.3diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.2 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.3 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.2 Sun Oct 7 05:22:04 2007 +++ php-src/ext/mbstring/mbstring.c Wed Dec 26 21:02:46 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.2 2007/10/07 05:22:04 davidw Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.3 2007/12/26 21:02:46 bjori Exp $ */ /* * PHP 4 Multibyte String module mbstring @@ -2325,7 +2325,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