Doc #60776 [Opn->Csd]: FilesystemIterator always uses SPL_FILE_DIR_SKIPDOTS

From: Date: Wed, 18 Nov 2020 12:28:11 +0000
Subject: Doc #60776 [Opn->Csd]: FilesystemIterator always uses SPL_FILE_DIR_SKIPDOTS
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18125@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60776&edit=1

 ID:                 60776
 Updated by:         phpdocbot@php.net
 Reported by:        alex dot schuch at gmx dot de
 Summary:            FilesystemIterator always uses SPL_FILE_DIR_SKIPDOTS
-Status:             Open
+Status:             Closed
 Type:               Documentation Problem
 Package:            SPL related
 Operating System:   GNU/Linux
 PHP Version:        5.3SVN-2012-01-17 (SVN)
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=cf52498fe93b743881f70facde70354939419b11
Log: Fix #60776: FilesystemIterator always uses SPL_FILE_DIR_SKIPDOTS


Previous Comments:
------------------------------------------------------------------------
[2012-03-12 16:34:26] iliaa@php.net

This is intended functionality, documentation should be updated to reflect that.

------------------------------------------------------------------------
[2012-01-17 12:01:49] alex dot schuch at gmx dot de

Description:
------------
The documentation of FilesystemIterator::__construct()
(http://de.php.net/manual/en/filesystemiterator.construct.php) suggests that it is possible to use
arbitrary valid flags for the iterator.

I do not fully understand the PHP source, but…

/* {{{ proto void FilesystemIterator::__construct(string path [, int flags])
 Cronstructs a new dir iterator from a path. */
SPL_METHOD(FilesystemIterator, __construct)
{
        spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIT_CTOR_FLAGS |
SPL_FILE_DIR_SKIPDOTS);
}
/* }}} */

The code above makes me believe that the flag SPL_FILE_DIR_SKIPDOTS is *always* added to the flags
when using the FilesystemIterator. So it is not possible to make the flag NOT be there, by for
example using 0 as argument.

So either this is a documentation issue, or this is an implementation bug.

Test script:
---------------
<?php
$oDirectoryIt = new FilesystemIterator('.', 0);
$oDirectoryIt->setFlags(0);

foreach ($oDirectoryIt as $oDirectory) {
        var_dump($oDirectory);
}
?>

Expected result:
----------------
I expect to see "." and ".." in the output.

Actual result:
--------------
I do not see "." or "..".


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=60776&edit=1


Thread (2 messages)

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