php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67690 __DIR__ does not work with eacute
Submitted: 2014-07-27 07:57 UTC Modified: 2014-07-28 09:39 UTC
From: lingtalfi at gmail dot com Assigned:
Status: Not a bug Package: Directory function related
PHP Version: Irrelevant OS: MacOSX 10.5.8
Private report: No CVE-ID: None
 [2014-07-27 07:57 UTC] lingtalfi at gmail dot com
Description:
------------
Let create 2 files in a folder with name "dir":

- x.php
- x2.php

Let put the following content in x.php:

require_once 'x2.php';
$a = __DIR__;
var_dump($a === $b);


and the following content in x2.php:


$b = __DIR__;


Let's open x.php in a browser, it outputs true.


Let's now repeat the same steps but within a folder named "diré".
The output is false (in my case).









Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-27 07:59 UTC] lingtalfi at gmail dot com
I'm using 

Apache/2.2.26 (Unix) PHP/5.5.8
Mac OsX 10.8.5
 [2014-07-28 03:17 UTC] yohgaki@php.net
-Status: Open +Status: Feedback
 [2014-07-28 03:17 UTC] yohgaki@php.net
Sounds like encoding/normalization issue.
What's the content of $a and $b?
i.e. var_dump(bin2hex($a), bin2hex($b));
 [2014-07-28 06:21 UTC] lingtalfi at gmail dot com
-Status: Feedback +Status: Open
 [2014-07-28 06:21 UTC] lingtalfi at gmail dot com
Oh thank you.
It turns out that the problem was apache httpd.conf encoding.

I had a line like this in my virtual hosts:
    DocumentRoot "/Volumes/Macintosh HD 2/web/Komin>/service création/projets/doo"
    
Pasting it from a text-editor in utf-8, it works well ($a===$b),
however, pasting it from a text-editor in plain encoding makes it fail,
although the exact same string appears in the text-editor window (I find this very confusing).    

Problem solved.
 [2014-07-28 09:39 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2014-07-28 09:39 UTC] nikic@php.net
Closing as not-a-bug, as the issue was resolved.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC