ID: 50857 Updated by: johan...@php.net Reported By: dennis at born05 dot nl -Status: Open +Status: Bogus Bug Type: SPL related Operating System: Fedora Core 6 PHP Version: 5.2.12 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php When extending RecursiveFilterIterator this way you also have to provide a custom getChildren() method to generate the child objects. Previous Comments: ------------------------------------------------------------------------ [2010-01-27 09:29:59] dennis at born05 dot nl Description: ------------ When you subclass RecursiveFilterIterator and change the constructor's signature you get Catchable fatal errors and warnings about missing arguments when iterating. Reproduce code: --------------- class AutoLoaderFilterIterator extends RecursiveFilterIterator { private $excludes = array(); public function __construct(RecursiveIterator $iterator, array $excludes) { parent::__construct($iterator); $this->excludes = $excludes; } public function accept() { return true; } } $it = new RecursiveIteratorIterator( new AutoLoaderFilterIterator( new RecursiveDirectoryIterator('/path/to/dir/hierarchy') ,array() ) ); foreach($it as $file) { echo $file->getFilename()."<br/>"; } Expected result: ---------------- A list of files Actual result: -------------- For each iteration a Catchable fatal error and a Warning is issued Catchable fatal error: Argument 2 passed to AutoLoaderFilterIterator::__construct() must be an array, none given in RecursiveFilterIterator_bug.php on line 20 Warning: Missing argument 2 for AutoLoaderFilterIterator::__construct() in RecursiveFilterIterator_bug.php on line 20 (Line 20 being the constructor declaration of AutoLoaderFilterIterator) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50857&edit=1