php.net |  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
Votes:1
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-09-21 11:54 UTC] sjorsvanleeuwen at gmail dot com
Description:
------------
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/..

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-29 23:22 UTC] cmb@php.net
-Package: Directory function related +Package: SPL related
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Dec 13 07:01:24 2019 UTC