Bug #68067 [NEW]: DirectoryIterator magically adds .. to path
| From: | sjorsvanleeuwen at gmail dot com | Date: | Sun, 21 Sep 2014 11:54:41 +0000 |
| Subject: | Bug #68067 [NEW]: DirectoryIterator magically adds .. to path | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-187638@lists.php.net to get a copy of this message | ||
From: sjorsvanleeuwen at gmail dot com
Operating system: Ubuntu
PHP version: 5.5.17
Package: Directory function related
Bug Type: Bug
Bug description:DirectoryIterator magically adds .. to path
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 bug report at https://bugs.php.net/bug.php?id=68067&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68067&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68067&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68067&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68067&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68067&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68067&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68067&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68067&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68067&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68067&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68067&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68067&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68067&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68067&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68067&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68067&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68067&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68067&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68067&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68067&r=mysqlcfg