From: joey at alegria dot co dot jp Operating system: Fedora Core 4 PHP version: 5CVS-2006-06-08 (CVS) PHP Bug Type: *Directory/Filesystem functions Bug description: basename does not work with Japanese
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/[EMAIL PROTECTED]" 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/[EMAIL PROTECTED]'; echo "The full filename of the Japanese file is $filename.\n"; // /myfolder/[EMAIL PROTECTED] $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/[EMAIL PROTECTED] The basename of the Japanese file is [EMAIL PROTECTED] 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/[EMAIL PROTECTED] The basename of the Japanese file is .txt. -- Edit bug report at http://bugs.php.net/?id=37738&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37738&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37738&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37738&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37738&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37738&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37738&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37738&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37738&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37738&r=support Expected behavior: http://bugs.php.net/fix.php?id=37738&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37738&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37738&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37738&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37738&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37738&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37738&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37738&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37738&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37738&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37738&r=mysqlcfg