|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79739 inconsistent __DIR__ with accent
Submitted: 2020-06-26 07:46 UTC Modified: -
Avg. Score:3.5 ± 0.5
Reproduced:0 of 0 (0.0%)
From: lingtalfi at gmail dot com Assigned:
Status: Open Package: Apache2 related
PHP Version: 7.2.31 OS: mac osX mojave 10.14.6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: lingtalfi at gmail dot com
New email:
PHP Version: OS:


 [2020-06-26 07:46 UTC] lingtalfi at gmail dot com
I create two files in my webroot directory www (served by apache 2.4.37):

- a.php
- b.php

In both I add this script:

var_dump(__DIR__); exit;

The output from **a.php** is different than the one from **b.php** !!!

The output from a is this:

string(88) "/Users/xxxxxxxxxxxxx/Documents/it/web/Komin>/service création/projets/jin_site_demo/www" 

While the output from b is this:

string(89) "/Users/pierrelafitte/Documents/it/web/Komin>/service création/projets/jin_site_demo/www" 

I'm not sure where the problem comes from (php?, apache?, my mac?),
but there is obviously a problem as they should output the exact same string.

The problem comes from the accent (é) which is not encoded in the same manner,
I tried using the php binary (php -f a.php), and both scripts output identical output, which means that the problem only occur when using php with apache.

I'm just a php user (not php developer) so I don't have any patch, but hopefully, if it's a php problem, this post helps to fix it.

Test script:
var_dump(__DIR__); exit;


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Aug 15 06:05:46 2022 UTC