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: 2020-12-27 04: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: cmb (profile)
Status: No Feedback 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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sjorsvanleeuwen at gmail dot com
New email:
PHP Version: OS:

 

 [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
 [2020-12-14 12:06 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-12-14 12:06 UTC] cmb@php.net
Does this still happen to you with any of the actively supported
PHP versions[1]?

[1] <https://www.php.net/supported-versions.php>
 [2020-12-27 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 15:01:29 2024 UTC