From:             lamsoft at gmail dot com
Operating system: WinXP SP2
PHP version:      5.2.1
PHP Bug Type:     *Unicode Issues
Bug description:  dirname faild in UTF8 dirname + Source Code

Description:
------------
unlink, rename function cannot be executed if the filename is in unicode
character, but opendir, readdir work fine.

The following output is from the browser which the encoding is already set
to UTF-8, it still some of the character cannot be read.

The OS is English, but the regional settings has been set to Chinese
(Taiwan), so that the PHP can only read characters those are in English
Character or BIG5.

<b>Warning</b>:  unlink(h:\ndsrom\temp\unzipped/EZ [WWW.ABCDE.ORG] -
[?&#65533;&#65533;,&#65533;&#65533;?&#65533;&#65533;,ROM,??,&#65533;&#65533;?,?&#65533;bEZ].url.url)
[<a href='function.unlink'>function.unlink</a>]: Invalid argument in
<b>D:\HTTP\Sub\nds\cli\php\checkUpdate_3.php</b> on line <b>157</b><br />

<br />
<b>Warning</b>: 
unlink(h:\ndsrom\temp\unzipped/&#65533;&#997;&#65533;?&#65533;&#65533;.txt)
[<a href='function.unlink'>function.unlink</a>]: Invalid argument in
<b>D:\HTTP\Sub\nds\cli\php\checkUpdate_3.php</b> on line <b>157</b><br />
<br />
<b>Warning</b>: 
rename(h:\ndsrom\temp\unzipped/&#65533;&#65533;?&#65533;&#65533;&#65533;?DS
&#65533;&#65533;??&#65533;P&#65533;&#65533;b&#65533;P&#65533;&#65533;?&#65533;&#65533;.nds,h:\ndsrom\temp\unzipped/test.zip)
[<a href='function.rename'>function.rename</a>]: Invalid argument in
<b>D:\HTTP\Sub\nds\cli\php\checkUpdate_3.php</b> on line <b>161</b><br />

Directory listing works fine, but it can't show the character~~
Array
(
    [0] => h:\ndsrom\temp\unzipped/EZ [WWW.EMU-ZONE.ORG] -
[?&#65533;&#65533;,&#65533;&#65533;?&#65533;&#65533;,ROM,??,&#65533;&#65533;?,?&#65533;bEZ].url.url
    [1] =>
h:\ndsrom\temp\unzipped/&#65533;&#997;&#65533;?&#65533;&#65533;.txt
    [2] =>
h:\ndsrom\temp\unzipped/&#65533;&#65533;?&#65533;&#65533;&#65533;?DS
&#65533;&#65533;??&#65533;P&#65533;&#65533;b&#65533;P&#65533;&#65533;?&#65533;&#65533;.nds
)

The file contains in that folder which browsed by Explorer: (An image,
those filename are some Simplified Chinese name in UTF8 encoding)
http://xs313.xs.to/xs313/07135/34tsdg.jpg

Reproduce code:
---------------
it is included in the description.
In addition, the parameter in the rename and unlink is passed by the
function of "directoryToArray" which is copied from
"http://snippets.dzone.com/posts/show/155"; and use foreach to unlink or
rename the filename

Expected result:
----------------
The file can be renamed and unlink successfully without any warnings.


Actual result:
--------------
it is included in the description.

-- 
Edit bug report at http://bugs.php.net/?id=40962&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40962&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40962&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40962&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40962&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40962&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40962&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40962&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40962&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40962&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40962&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40962&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40962&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40962&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40962&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40962&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40962&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40962&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40962&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40962&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40962&r=mysqlcfg

Reply via email to