|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36287 Segfault with SplFileInfo conversion
Submitted: 2006-02-04 17:42 UTC Modified: 2006-02-05 13:03 UTC
From: meeb at meeb dot org Assigned: helly
Status: Closed Package: Filesystem function related
PHP Version: 5.1.2 OS: *
Private report: No CVE-ID:
 [2006-02-04 17:42 UTC] meeb at meeb dot org
When accidently comparing a the iterator created by RecursiveDirectoryIterator against a string PHP segfaulted. This is new to 5.1.2 (worked under 5.1.1 and I was unaware of the issue with my code). There are obvious workarounds for this so no major panic.

Removing the 'if':


stops the segfault.

Unfortunately I only have EMT64/Debian64 servers available so I am unable to test this for cross-platform compatibility, and I was unable to find any exact matching bugs (closest were a few stack corruptions).

This occurs when the script is executed on the command line and via apache2. I have saved straces should they be requested.

Reproduce code:
$this->dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("."),true);
foreach($this->dir as $file){
  // works...
  echo $file->getPathName()."\n";
  // segfauls...
  if($file!="."&&$file!="..") echo $file->getPathName()."\n";

Expected result:

Actual result:
Segmentation Fault.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-04 17:45 UTC] meeb at meeb dot org

whoops :p
 [2006-02-04 18:44 UTC]
Please try using this CVS snapshot:
For Windows:

 [2006-02-05 12:44 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Sun Oct 04 23:01:29 2015 UTC