|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-09-30 03:22 UTC] ppmm at wuxinan dot net
[2004-09-30 03:27 UTC] ppmm at wuxinan dot net
[2005-03-07 21:17 UTC] sniper@php.net
[2005-03-20 18:04 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 05:00:01 2025 UTC |
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" }