Bug #74589 [Opn->Fbk]: __DIR__ wrong for unicode character
| From: | ab@php.net | Date: | Sun, 14 May 2017 14:37:52 +0000 |
| Subject: | Bug #74589 [Opn->Fbk]: __DIR__ wrong for unicode character | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-209104@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74589&edit=1
ID: 74589
Updated by: ab@php.net
Reported by: ganlvtech at qq dot com
Summary: __DIR__ wrong for unicode character
-Status: Open
+Status: Feedback
Type: Bug
Package: *General Issues
Operating System: Windows
PHP Version: 7.1.5
Block user comment: N
Private report: N
New Comment:
Thanks for the report. Please post additionally
- default_charset INI
- internal_encoding INI
- whether zend_multibyte is used
- whether your're on a DBCS system, codepage 932, 936 or alike
I have to say, that so far i've tried the snippet on a cp 437 system with default php.ini
settings, i see it working correctly. I guess, that there can be an issue with a particular system
codepage and non UTF-8 settings in php.ini, would be nice you to do a bit more research in this
direction.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2017-05-14 07:07:24] ganlvtech at qq dot com
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 this bug report at https://bugs.php.net/bug.php?id=74589&edit=1