#30014 [Opn->Fbk]: pathinfo() doesn't handle multibyte path
ID: 30014
Updated by: sniper@php.net
Reported By: cvictor at pchome dot com dot tw
-Status: Open
+Status: Feedback
Bug Type: Directory function related
Operating System: Windows XP Pro
PHP Version: 5.0.1
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2004-09-30 03:27:23] ppmm at wuxinan dot net
partial summary of bug # 29542 30014 30105:
this bug confirmed to exist on:
simplified chinese windows 2000
traditional chinese windows xp pro
redhat 9 (default rpm's)
this bug confirmed not to exist on:
fedora core 3 test 1 (default rpm's)
english windows xp pro
------------------------------------------------------------------------
[2004-09-30 03:22:30] ppmm at wuxinan dot net
related to bug# 30105
http://bugs.php.net/bug.php?id=30105
------------------------------------------------------------------------
[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
Thread (5 messages)