Doc #51895 [Asn]: SPL RecursiveDirectoryIteratory Flags documentation
| From: | therandshow at gmail dot com | Date: | Mon, 24 May 2010 20:37:30 +0000 |
| Subject: | Doc #51895 [Asn]: SPL RecursiveDirectoryIteratory Flags documentation | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-4437@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51895&edit=1
ID: 51895
User updated by: therandshow at gmail dot com
Reported by: therandshow at gmail dot com
Summary: SPL RecursiveDirectoryIteratory Flags documentation
Status: Assigned
Type: Documentation Problem
Package: Documentation problem
Operating System: Fedora Linux
PHP Version: 5.3.2
Assigned To: salathe
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2010-05-24 01:26:15] 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 00:07:54] 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)
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51895&edit=1