|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68067 DirectoryIterator magically adds .. to path
Submitted: 2014-09-21 11:54 UTC Modified: 2018-03-29 23:22 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: sjorsvanleeuwen at gmail dot com Assigned:
Status: Open Package: SPL related
PHP Version: 5.5.17 OS: Ubuntu
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: sjorsvanleeuwen at gmail dot com
New email:
PHP Version: OS:


 [2014-09-21 11:54 UTC] sjorsvanleeuwen at gmail dot com
WHen i want to iterate a specific folder in my project it ends up using the parent directory.

This happens only on the path used in the test script. Other paths are fine.

Test script:
* Document root in my case is /home/www/dev/my_project/public

$system = new \DirectoryIterator($_SERVER["DOCUMENT_ROOT"] .  "/../system");
echo $system->getRealPath();
echo $system->getPath();

Expected result:
Expected result would be with the given case:
Realpath: /home/www/dev/my_project/system
Path: /home/www/dev/my_project/public/../system

Actual result:
Actual result with the given case:
Realpath: /home/www/dev/my_project
Path: /home/www/dev/my_project/public/../system/..


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-29 23:22 UTC]
-Package: Directory function related +Package: SPL related
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Aug 15 10:01:26 2020 UTC