Bug #55817 [NEW]: Wrong codes of mb_detect_encoding
| From: | laruence@php.net | Date: | Fri, 30 Sep 2011 07:40:22 +0000 |
| Subject: | Bug #55817 [NEW]: Wrong codes of mb_detect_encoding | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-163992@lists.php.net to get a copy of this message | ||
From: laruence
Operating system:
PHP version: 5.3.8
Package: mbstring related
Bug Type: Bug
Bug description:Wrong codes of mb_detect_encoding
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 bug report at https://bugs.php.net/bug.php?id=55817&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55817&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55817&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55817&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=55817&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55817&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=55817&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=55817&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=55817&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=55817&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=55817&r=support
Expected behavior: https://bugs.php.net/fix.php?id=55817&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=55817&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=55817&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=55817&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55817&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55817&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=55817&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=55817&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=55817&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=55817&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=55817&r=mysqlcfg