|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #69261 getPathname() returns path based on what's passed to the iterator
Submitted: 2015-03-19 09:47 UTC Modified: 2017-01-28 17:17 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: gulli dot jonsson at gulli dot net Assigned: salathe (profile)
Status: Assigned Package: SPL related
PHP Version: 5.5.22 OS: Fedora 20
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.
Block user comment
Status: Assign to:
Bug Type:
From: gulli dot jonsson at gulli dot net
New email:
PHP Version: OS:


 [2015-03-19 09:47 UTC] gulli dot jonsson at gulli dot net
From manual page:

This method only gets the pathname based on the path given when creating the DirectoryIterator, not a full pathname. The documentation could be more specific on this.

I'm assuming that the documentation is just not accurate enough and that it's not a bug in the method itself.

Test script:

foreach (new DirectoryIterator('.') as $file) {
    print $file->getPathname()."\n";

foreach (new DirectoryIterator(__DIR__) as $file) {
    print $file->getPathname()."\n";

foreach (new DirectoryIterator('somesubdir') as $file) {
    print $file->getPathname()."\n";

Expected result:
Based on the documentation I expected this output (skipped the . and ..)


Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-19 10:42 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: salathe
 [2017-01-28 17:17 UTC]
-Package: Documentation problem +Package: SPL related
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC