Doc #69261 [Opn->Asn]: getPathname() returns path based on what's passed to the iterator

From: Date: Thu, 19 Mar 2015 10:42:45 +0000
Subject: Doc #69261 [Opn->Asn]: getPathname() returns path based on what's passed to the iterator
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12010@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69261&edit=1 ID: 69261 Updated by: salathe@php.net Reported by: gulli dot jonsson at gulli dot net Summary: getPathname() returns path based on what's passed to the iterator -Status: Open +Status: Assigned Type: Documentation Problem Package: Documentation problem Operating System: Fedora 20 PHP Version: 5.5.22 -Assigned To: +Assigned To: salathe Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2015-03-19 09:47:49] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69261&edit=1

« previous php.doc.bugs (#12010) next »