php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #51895 SPL RecursiveDirectoryIteratory Flags documentation
Submitted: 2010-05-24 00:07 UTC Modified: 2010-08-18 13:47 UTC
From: therandshow at gmail dot com Assigned: salathe (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3.2 OS: Fedora Linux
Private report: No CVE-ID: None
 [2010-05-24 00:07 UTC] therandshow at gmail dot com
Description:
------------
While understand that much of the SPL extension is undocumented, it occurs to me that there's a simple piece of documentation that could be added. 
On this page: http://us.php.net/manual/en/recursivedirectoryiterator.construct.php 
it refers to "flags" without telling what options there are for flags. Now it is documented here that there are flags defined as recursive iterator class constants http://us.php.net/manual/en/spl.constants.php , but I guessed that was unlikely to be all the flags possible. Thus I used the ReflectionClass to get all of RecursiveDirectoryIterator's class constants and got this array:

array(11) {
  ["CURRENT_MODE_MASK"]=>
  int(240)
  ["CURRENT_AS_PATHNAME"]=>
  int(32)
  ["CURRENT_AS_FILEINFO"]=>
  int(0)
  ["CURRENT_AS_SELF"]=>
  int(16)
  ["KEY_MODE_MASK"]=>
  int(3840)
  ["KEY_AS_PATHNAME"]=>
  int(0)
  ["FOLLOW_SYMLINKS"]=>
  int(512)
  ["KEY_AS_FILENAME"]=>
  int(256)
  ["NEW_CURRENT_AND_KEY"]=>
  int(256)
  ["SKIP_DOTS"]=>
  int(4096)
  ["UNIX_PATHS"]=>
  int(8192)
}


Test script:
---------------
$reflector = new ReflectionClass('RecursiveDirectoryIterator');
var_dump($reflector->getConstants());

Expected result:
----------------
array(11) {
  ["CURRENT_MODE_MASK"]=>
  int(240)
  ["CURRENT_AS_PATHNAME"]=>
  int(32)
  ["CURRENT_AS_FILEINFO"]=>
  int(0)
  ["CURRENT_AS_SELF"]=>
  int(16)
  ["KEY_MODE_MASK"]=>
  int(3840)
  ["KEY_AS_PATHNAME"]=>
  int(0)
  ["FOLLOW_SYMLINKS"]=>
  int(512)
  ["KEY_AS_FILENAME"]=>
  int(256)
  ["NEW_CURRENT_AND_KEY"]=>
  int(256)
  ["SKIP_DOTS"]=>
  int(4096)
  ["UNIX_PATHS"]=>
  int(8192)
}


Actual result:
--------------
array(11) {
  ["CURRENT_MODE_MASK"]=>
  int(240)
  ["CURRENT_AS_PATHNAME"]=>
  int(32)
  ["CURRENT_AS_FILEINFO"]=>
  int(0)
  ["CURRENT_AS_SELF"]=>
  int(16)
  ["KEY_MODE_MASK"]=>
  int(3840)
  ["KEY_AS_PATHNAME"]=>
  int(0)
  ["FOLLOW_SYMLINKS"]=>
  int(512)
  ["KEY_AS_FILENAME"]=>
  int(256)
  ["NEW_CURRENT_AND_KEY"]=>
  int(256)
  ["SKIP_DOTS"]=>
  int(4096)
  ["UNIX_PATHS"]=>
  int(8192)
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-24 01:26 UTC] salathe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: salathe
 [2010-05-24 01:26 UTC] salathe@php.net
The RecursiveDirectoryIterator extends from FilesystemIterator and all of those constants are inherited from it.  The docs for the FilesystemIterator constants [1] should give insight into what they are to be used for (they are brief but better than nothing). 

I'll leave this bug open as a reminder to update the RecursiveDirectoryIterator skeleton documentation with something more substantial. 

[1] http://php.net/class.filesystemiterator#filesystemiterator.constants
 [2010-05-24 22:37 UTC] therandshow at gmail dot com
Thanks for pointing out the FilesystemIterator constants, but then one clear issue then is the RecursiveDirectoryIterator's documentation does not say that it extends FilesystemIterator. The class documentation says:

" RecursiveDirectoryIterator    extends  DirectoryIterator   implements Traversable   , Iterator   , RecursiveIterator"

None of which extend FilesystemIterator. (Though as you pointed out, even as this was the case, the documentation would be incomplete, as it ought then include an "inherited from FilesytemIterator" section
 [2010-05-25 07:39 UTC] dtajchreber@php.net
-Status: Assigned +Status: Feedback
 [2010-05-25 07:39 UTC] dtajchreber@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

 [2010-05-25 07:40 UTC] dtajchreber@php.net
-Status: Feedback +Status: Open
 [2010-05-25 07:40 UTC] dtajchreber@php.net
Please ignore the previous comment. Accidental. Sorry.
 [2010-08-18 13:43 UTC] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&revision=302434
Log: recursivedirectoryiterator extends filesystemiterator (doc bug #51895)
 [2010-08-18 13:47 UTC] salathe@php.net
-Status: Assigned +Status: Closed
 [2010-08-18 13:47 UTC] salathe@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.

I updated the extends/implements list and added a changelog noting the 
introduction of the FilesystemIterator.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 03:00:02 2026 UTC