From: cvictor at pchome dot com dot tw Operating system: Windows XP Pro PHP version: 5.0.1 PHP Bug Type: Directory function related Bug description: pathinfo() doesn't handle multibyte path
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 bug report at http://bugs.php.net/?id=30014&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30014&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30014&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30014&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30014&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30014&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30014&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30014&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30014&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30014&r=support Expected behavior: http://bugs.php.net/fix.php?id=30014&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30014&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30014&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30014&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30014&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30014&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30014&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30014&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30014&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30014&r=mysqlcfg