php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53087 getRealPath() returns the parent directory.
Submitted: 2010-10-17 03:40 UTC Modified: 2011-11-15 17:43 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: thepixeldeveloper at googlemail dot com Assigned:
Status: Not a bug Package: SPL related
PHP Version: 5.3.3 OS: Ubuntu Maverick Meerkat
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: thepixeldeveloper at googlemail dot com
New email:
PHP Version: OS:

 

 [2010-10-17 03:40 UTC] thepixeldeveloper at googlemail dot com
Description:
------------
Using getRealPath() on RecursiveDirectoryIterator returns the parent directory.

Test script:
---------------
<?php

$directory = '/var/www/nolimits/public/application/cache';

$iterator = new RecursiveDirectoryIterator($directory);

echo $iterator->getRealPath();

Expected result:
----------------
/var/www/nolimits/public/application/cache

Actual result:
--------------
/var/www/nolimits/public/application

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-17 04:35 UTC] thepixeldeveloper at googlemail dot com
Some additional information

./configure  --prefix=/opt/php-5.3.3 --with-openssl --with-mcrypt --with-
mysqli 
--with-mysql=mysqlnd --with-mysql-sock --with-gd --with-jpeg-dir=/usr --with-
png-dir=/usr --with-zlib-dir=/usr --with-freetype-dir=/usr --with-tidy --with-
curl --enable-fpm --enable-gd-native-ttf --enable-gd-jis-conv --enable-mbstring 
--disable-xmlreader --disable-xmlwriter --disable-phar --without-sqlite --
without-sqlite3 --disable-pdo --disable-posix --with-pear=/usr/share/pear

diff -u /home/mathew/Sources/php-5.3.3/php.ini-development php.ini

http://pastie.org/private/kjaxcwwyx210jfpkfe0ipw
 [2011-11-15 17:43 UTC] felipe@php.net
-Status: Open +Status: Bogus
 [2011-11-15 17:43 UTC] felipe@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Not a bug, your directory is probably empty, so it's getting the realpath for "..".

Check it using the getFileName() method. :)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 06 07:01:33 2025 UTC