#48814 [Opn]: Subclass of RecursiveDirectoryIterator segfaults with custom constructor
| From: | dennis at born05 dot nl | Date: | Mon, 06 Jul 2009 12:00:59 +0000 |
| Subject: | #48814 [Opn]: Subclass of RecursiveDirectoryIterator segfaults with custom constructor | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-139313@lists.php.net to get a copy of this message | ||
ID: 48814
User updated by: dennis at born05 dot nl
Reported By: dennis at born05 dot nl
Status: Open
Bug Type: SPL related
Operating System: Fedora Core 6
-PHP Version: 5.2.10
+PHP Version: 5.2.10, 5.3.0
New Comment:
Applies for 5.2.10 AND 5.3.0
Previous Comments:
------------------------------------------------------------------------
[2009-07-06 11:59:38] dennis at born05 dot nl
Description:
------------
When you subclass RecursiveDirectoryIterator and override the
constructor with enhanced functionality it makes PHP segfault.
I have tested this on 5.2.10 and 5.3.0, both display similar (but not
equal) behaviour, the output is somewhat different, but both versions
segfault.
Reproduce code:
---------------
<?php
class MyRDI extends RecursiveDirectoryIterator
{
public $base_path;
public function __construct($path, $flags = 0)
{
$this->base_path = $path;
parent::__construct($path, $flags);
}
}
$iterator = new RecursiveIteratorIterator(new
MyRDI('/path/to/dir/hierarchy'));
foreach($iterator as $entry)
{
echo $entry->getFilename()."\n";
}
?>
Expected result:
----------------
See a list of all the filenames
Actual result:
--------------
PHP segfaults
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48814&edit=1