php.net |  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
Votes:1
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-03-19 09:47 UTC] gulli dot jonsson at gulli dot net
Description:
------------
---
From manual page: http://www.php.net/directoryiterator.getpathname
---

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:
---------------
<?php

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 ..)

/home/gulli/cli/directoryiterator.php
/home/gulli/cli/directoryiterator.php
/home/gulli/cli/somesubdir/somefileinsubdir.txt


Actual result:
--------------
./directoryiterator.php
/home/gulli/cli/directoryiterator.php
somesubdir/somefileinsubdir.txt


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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