php/php-src — pull request #665 by paulyg (2014-05-07 04:32:11+00:00)
Title: SPL: Fix for bug 66405 RecursiveDirectoryIterator w/ CURRENT_AS_PATHNAME

Commit bc752085 introduced a change to make
RecursiveDirectoryIterator::getChildren() return the current directory name
when the FilesystemIterator::CURRENT_AS_PATHNAME flag is used. However, per the
RecursiveIterator interface getChildren() is supposed to return an Iterator
(or subclass of). So when you use RecursiveDirectoryIterator with
FilesystemIterator::CURRENT_AS_PATHNAME and wrap it in a
RecursiveIteratorIterator and try to foreach: RecursiveIteratorIterator throws
an UnexpectedValueException with message 'Objects returned by
RecursiveIterator::getChildren() must implement RecursiveIterator' becuase it
got a string when it should have gotten an Iterator object.

This commit removed the change introduced by commit bc752085 so that
RecursiveDirectoryIterator::getChildren() always returns a new instance of
itself.

This fix is against the PHP-5.4 branch
(as per https://wiki.php.net/vcs/gitworkflow applied to lowest stable branch).
I believe it should get ported up to 5.5, 5.6, and master. A test case
(bug66405.phpt) is includes. All tests in ext/spl/tests pass.