|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-01-27 09:39 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 10:00:01 2025 UTC |
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)