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: Closed Package: SPL related
PHP Version: 5.3SVN-2012-01-17 (SVN) OS: GNU/Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: alex dot schuch at gmx dot de
New email:
PHP Version: OS:

 

 [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

Pull Requests

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
 [2020-11-18 12:28 UTC] phpdocbot@php.net
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
 [2020-11-18 12:28 UTC] phpdocbot@php.net
-Status: Open +Status: Closed
 [2020-11-18 22:15 UTC] phpdocbot@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=0c8b23a8225ec0ffc7744011274976f6f062ba84
Log: Fix #60776: FilesystemIterator always uses SPL_FILE_DIR_SKIPDOTS
 [2020-12-30 11:58 UTC] nikic@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=ce9e7caed8169664a91f16cdd5715ce75229b8bc
Log: Fix #60776: FilesystemIterator always uses SPL_FILE_DIR_SKIPDOTS
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 22:01:36 2025 UTC