Bug #55817 [Asn->Csd]: Wrong codes of mb_detect_encoding
| From: | laruence@php.net | Date: | Tue, 04 Oct 2011 13:55:30 +0000 |
| Subject: | Bug #55817 [Asn->Csd]: Wrong codes of mb_detect_encoding | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-164080@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55817&edit=1
ID: 55817
Updated by: laruence@php.net
Reported by: laruence@php.net
Summary: Wrong codes of mb_detect_encoding
-Status: Assigned
+Status: Closed
Type: Bug
Package: mbstring related
PHP Version: 5.3.8
Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2011-09-30 15:08:11] laruence@php.net
Automatic comment from SVN on behalf of laruence
Revision: http://svn.php.net/viewvc/?view=revision&revision=317524
Log: A better fix for #55817 (thanks to bjori)
------------------------------------------------------------------------
[2011-09-30 13:33:46] laruence@php.net
Automatic comment from SVN on behalf of laruence
Revision: http://svn.php.net/viewvc/?view=revision&revision=317493
Log: Fix wrong codes #55817
------------------------------------------------------------------------
[2011-09-30 07:40:22] laruence@php.net
Description:
------------
using Z_STRVAL_P before make sure it is IS_STRING:
see http://lxr.php.net/opengrok/xref/PHP_5_4/ext/mbstring/mbstring.c#3186
if (ZEND_NUM_ARGS() >= 2 && Z_STRVAL_P(encoding_list)) {
switch (Z_TYPE_P(encoding_list)) {
case IS_ARRAY:
if (FAILURE ==
php_mb_parse_encoding_array(encoding_list, &list, &size, 0 TSRMLS_CC)) {
if (list) {
efree(list);
list = NULL;
size = 0;
}
}
break;
default:
convert_to_string(encoding_list);
if (FAILURE ==
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;
}
}
break;
}
if (size <= 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal
argument");
}
}
Test script:
---------------
none
Expected result:
----------------
none
Actual result:
--------------
none
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55817&edit=1