Bug->Doc #66405 [Opn]: RecursiveDirectoryIterator::CURRENT_AS_PATHNAME breaks the RecursiveIterator
| From: | requinix@php.net | Date: | Fri, 03 Jan 2014 18:30:19 +0000 |
| Subject: | Bug->Doc #66405 [Opn]: RecursiveDirectoryIterator::CURRENT_AS_PATHNAME breaks the RecursiveIterator | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-10797@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66405&edit=1
ID: 66405
Updated by: requinix@php.net
Reported by: stof at notk dot org
Summary: RecursiveDirectoryIterator::CURRENT_AS_PATHNAME
breaks the RecursiveIterator
Status: Open
-Type: Bug
+Type: Documentation Problem
Package: SPL related
PHP Version: 5.5.7
Block user comment: N
Private report: N
New Comment:
This is expected behavior: the inner Iterator's getChildren() must return something that is,
itself, a RecursiveIterator, otherwise the whole idea of recursive iteration is impossible.
But I don't see that spelled out in the documentation so I'm changing this to a doc bug.
Previous Comments:
------------------------------------------------------------------------
[2014-01-03 17:04:32] stof at notk dot org
Description:
------------
When using the RecursiveDirectoryIterator::CURRENT_AS_PATHNAME flag of the
RecursiveDirectoryIterator, the iterator does not implement RecursiveIterator properly anymore
Test script:
---------------
<?php
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__,
RecursiveDirectoryIterator::CURRENT_AS_PATHNAME));
var_dump(iterator_to_array($iterator));
Expected result:
----------------
The list of of files in the current folder (including subfolders) is dumped
Actual result:
--------------
UnexpectedValueException: Objects returned by RecursiveIterator::getChildren() must implement
RecursiveIterator
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66405&edit=1