php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #60776 FilesystemIterator always uses SPL_FILE_DIR_SKIPDOTS
Submitted: 2012-01-17 12:01 UTC Modified: 2017-01-28 11:43 UTC
From: alex dot schuch at gmx dot de Assigned:
Status: Open Package: SPL related
PHP Version: 5.3SVN-2012-01-17 (SVN) OS: GNU/Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-01-17 12:01 UTC] 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 "..".

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-12 16:34 UTC] iliaa@php.net
This is intended functionality, documentation should be updated to reflect that.
 [2012-03-12 16:34 UTC] iliaa@php.net
-Package: *Directory/Filesystem functions +Package: Documentation problem
 [2017-01-28 11:43 UTC] cmb@php.net
-Type: Bug +Type: Documentation Problem -Package: Documentation problem +Package: SPL related
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Nov 14 05:01:31 2019 UTC