|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-06-08 06:37 UTC] derick@php.net
[2011-04-10 22:23 UTC] chx@php.net
-Status: Wont fix
+Status: Open
[2011-04-10 22:23 UTC] chx@php.net
[2011-04-11 00:19 UTC] cataphract@php.net
-Status: Open
+Status: Bogus
[2011-04-11 00:19 UTC] cataphract@php.net
[2012-06-06 20:46 UTC] ion at 66 dot ru
[2013-09-15 10:20 UTC] kenji dot uui at gmail dot com
[2013-10-30 15:10 UTC] fleshgrinder at gmx dot at
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 04:00:01 2025 UTC |
Description: ------------ Simply put, basename() does ot work with Japanese filepaths. If the filename is Japanese only the extension part of the filename is returned. So a filename "/folder/?t?@?C????.txt" resolves to just ".txt". I discovered the problem when performing a basename() on the $_FILES array's 'name' element for uploaded Japanese files, however after testing the bug occurs no matter how you supply the filename. My PHP environment is running with UTF-8 internal encoding. The code snippet below illustrates this perfectly. Reproduce code: --------------- <?php // show normal behavior with roman filename $filename='/myfolder/roman_filename.txt'; echo "The full filename of the romanized file is $filename.\n"; // /myfolder/roman_filename.txt $basename=basename($filename); echo "The basename of the romanized file is $basename.\n"; // /roman_filename.txt // show behavior with Japanese filename $filename='/myfolder/???{???̃t?@?C????.txt'; echo "The full filename of the Japanese file is $filename.\n"; // /myfolder/???{???̃t?@?C????.txt $basename=basename($filename); echo "The basename of the Japanese file is $basename."; // .txt ?> Expected result: ---------------- The full filename of the romanized file is /myfolder/roman_filename.txt. The basename of the romanized file is roman_filename.txt. The full filename of the Japanese file is /myfolder/???{???̃t?@?C????.txt. The basename of the Japanese file is ???{???̃t?@?C????.txt. Actual result: -------------- The full filename of the romanized file is /myfolder/roman_filename.txt. The basename of the romanized file is roman_filename.txt. The full filename of the Japanese file is /myfolder/???{???̃t?@?C????.txt. The basename of the Japanese file is .txt.