#30014 [Com]: pathinfo() doesn't handle multibyte path
| From: | ppmm at wuxinan dot net | Date: | Thu, 30 Sep 2004 01:22:44 +0000 |
| Subject: | #30014 [Com]: pathinfo() doesn't handle multibyte path | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-66906@lists.php.net to get a copy of this message | ||
ID: 30014
Comment by: ppmm at wuxinan dot net
Reported By: cvictor at pchome dot com dot tw
Status: Open
Bug Type: Directory function related
Operating System: Windows XP Pro
PHP Version: 5.0.1
New Comment:
related to bug# 30105
http://bugs.php.net/bug.php?id=30105
Previous Comments:
------------------------------------------------------------------------
[2004-09-07 20:26:26] cvictor at pchome dot com dot tw
Description:
------------
pathinfo() doesn't handle pathname in multibyte well. This error can be
reporduced under big5 and utf-8 charset, no matter converting the whole
source php file or using mb_convert_encoding() inline.
This error only occurs when the first character of basename is a
Chinese character.
I didn't recompile PHP bin, and modules used seem not relevent. My
php.ini is adapted from php.ini-recommended. The OS is a Traditional
Chinese version.
Reproduce code:
---------------
<?php
$fp = '/var/©ú²Ó.txt';
var_dump(pathinfo($fp));
$fp = '/var/a©ú²Ó.txt';
var_dump(pathinfo($fp));
?>
Expected result:
----------------
array(3) {
["dirname"]=>
string(4) "/var"
["basename"]=>
string(8) "©ú²Ó.txt"
["extension"]=>
string(3) "txt"
}
array(3) {
["dirname"]=>
string(4) "/var"
["basename"]=>
string(8) "a©ú²Ó.txt"
["extension"]=>
string(3) "txt"
}
Actual result:
--------------
array(3) {
["dirname"]=>
string(4) "/var"
["basename"]=>
string(4) ".txt"
["extension"]=>
string(3) "txt"
}
array(3) {
["dirname"]=>
string(4) "/var"
["basename"]=>
string(8) "a©ú²Ó.txt"
["extension"]=>
string(3) "txt"
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30014&edit=1