From: Operating system: Windows 7 PHP version: 5.3.5 Package: Directory function related Bug Type: Bug Bug description:Directory::read() cannot handle non-unicode chars properly
Description: ------------ Notice: This problem does ONLY affect the CLI interpreter, NOT the CGI. Using dir('path/to/dir'), the read() method does not return UTF-8, if the directory contains e.g. umlauts (ä, ö, ü). I tested this on Linux and Windows, both CGI and CLI, and the problem does only occur with Windows/CLI. Test script: --------------- $path = 'path/to/directory/which/contains/umlauts'; $directory = dir($path); while (false !== ($content = $directory->read())) { if (mb_check_encoding($content, 'UTF-8') === false) { fprintf(STDERR, 'Returned non-utf-8 (%s)', $content); } } Expected result: ---------------- The expected result, of course, was that the return value of read is always encoded in UTF-8, i.e. no messages are print, when we run the script. Actual result: -------------- If a subdirectory contains umlauts (or I guess any non-unicode character), a message is print, i.e. the return value is not encoded in UTF-8. -- Edit bug report at http://bugs.php.net/bug.php?id=54028&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54028&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54028&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54028&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54028&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54028&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54028&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54028&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54028&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54028&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54028&r=support Expected behavior: http://bugs.php.net/fix.php?id=54028&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54028&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54028&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54028&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54028&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54028&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54028&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54028&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54028&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54028&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54028&r=mysqlcfg