From: dennis at born05 dot nl
Operating system: Fedora Core 6
PHP version: 5.2.12
PHP Bug Type: SPL related
Bug description: Can't subclass RecursiveFilterIterator and change constructor
signature
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 bug report at http://bugs.php.net/?id=50857&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50857&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50857&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50857&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50857&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50857&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50857&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50857&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50857&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50857&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50857&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50857&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50857&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50857&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50857&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50857&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50857&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50857&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50857&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50857&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50857&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50857&r=mysqlcfg