Bug #68067 [Opn->Fbk]: DirectoryIterator magically adds .. to path
| From: | cmb@php.net | Date: | Mon, 14 Dec 2020 12:06:04 +0000 |
| Subject: | Bug #68067 [Opn->Fbk]: DirectoryIterator magically adds .. to path | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-231063@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68067&edit=1
ID: 68067
Updated by: cmb@php.net
Reported by: sjorsvanleeuwen at gmail dot com
Summary: DirectoryIterator magically adds .. to path
-Status: Open
+Status: Feedback
Type: Bug
Package: SPL related
Operating System: Ubuntu
PHP Version: 5.5.17
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Does this still happen to you with any of the actively supported
PHP versions[1]?
[1] <https://www.php.net/supported-versions.php>
Previous Comments:
------------------------------------------------------------------------
[2014-09-21 11:54:41] 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/..
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68067&edit=1