php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #29960 DirectoryIterator::fileType
Submitted: 2004-09-03 00:15 UTC Modified: 2004-09-03 21:03 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: asgarbutt at ucdavis dot edu Assigned: nlopess (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.0.1 OS: *
Private report: No CVE-ID: None
 [2004-09-03 00:15 UTC] asgarbutt at ucdavis dot edu
Description:
------------
When utilizing the new DirectoryIterator of PHP5 (5.0.1) I get the following message.

Fatal error: Call to undefined method DirectoryIterator::fileExt() in C:\Apache2\htdocs\imagearchive\test.php on line 40

The function is listed in the documentation but only minimumly.

Reproduce code:
---------------
$sPath = 'C:\Apache2\htdocs'

foreach (new DirectoryIterator($sPath) as $oFile) {
  if ($oFile->isFile()) {
    echo 'isFile => '.$oFile->isFile().'<br />';
    echo 'getFilename => '.$oFile->getFilename().'<br />';
    echo 'fileType => '.$oFile->fileType().'<br />';
  }
}


Expected result:
----------------
isFile => 1
getFilename => apache_pb.gif
fileType => .gif (or something similar)

Actual result:
--------------
isFile => 1
getFilename => apache_pb.gif

Fatal error: Call to undefined method DirectoryIterator::fileType() in C:\Apache2\htdocs\imagearchive\test.php on line 40

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-03 00:27 UTC] asgarbutt at ucdavis dot edu
In my description, i wrote the wrong quote.  It should be ...
Fatal error: Call to undefined method DirectoryIterator::fileType() in
C:\Apache2\htdocs\imagearchive\test.php on line 40

as stated in the Actual result section.
 [2004-09-03 00:37 UTC] asgarbutt at ucdavis dot edu
Found a better link to the SPL.  It is still not complete, but it is much more thorough that the documentation provided on http://www.php.net/manual/en/function.directoryiterator-filetype.php

It can be found here at :  http://www.php.net/~helly/php/ext/spl/index.html

Sorry about the bug post.
 [2004-09-03 08:27 UTC] helly@php.net
DirectoryIterator has no file*() functions
 [2004-09-03 21:03 UTC] nlopess@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:11 UTC] phpdocbot@php.net
Automatic comment on behalf of nlopess
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=6cbff883280ce38df4bbee52b411b25d98b3905d
Log: fix #29960: wrong file*() protos
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Sep 10 00:00:02 2025 UTC