Bug #74589 [NEW]: __DIR__ wrong for unicode character

From: Date: Sun, 14 May 2017 07:07:29 +0000
Subject: Bug #74589 [NEW]: __DIR__ wrong for unicode character
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209102@lists.php.net to get a copy of this message
From: ganlvtech at qq dot com Operating system: Windows PHP version: 7.1.5 Package: *General Issues Bug Type: Bug Bug description:__DIR__ wrong for unicode character Description: ------------ Save the test script to "D:\新建文件夹\test.php".(There must be some unicode character in the path) Then execute php test.php. On Windows, shows D:\ D:\新建文件夹 bool(false) Save to "D:\新建文件夹a\test.php", then shows D:\新建文件夹a D:\新建文件夹a bool(true) Save to "D:\a新建文件夹\test.php", then shows D:\ D:\a新建文件夹 bool(false) Save to "D:\a新建文件夹\a新建文件夹\test.php", then shows D:\ D:\a新建文件夹\a新建文件夹 bool(false) So, you may find that. If the directory's name ends with a unicode character, then __DIR__ would miss this part, until it find a dir not ends with a unicode character. Sorry for my poor English. Test script: --------------- <?php echo __DIR__, "\n"; echo dirname(__FILE__), "\n"; var_dump(__DIR__ === dirname(__FILE__)); ?> -- Edit bug report at https://bugs.php.net/bug.php?id=74589&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74589&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74589&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74589&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74589&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74589&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74589&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74589&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74589&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74589&r=support Expected behavior: https://bugs.php.net/fix.php?id=74589&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74589&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74589&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74589&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74589&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74589&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74589&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74589&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74589&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74589&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74589&r=mysqlcfg

« previous php.bugs (#209102) next »