From:             worthbob01 at yahoo dot com
Operating system: rh es 3
PHP version:      5.1.0RC1
PHP Bug Type:     Reproducible crash
Bug description:  seg fault when using scandir

Description:
------------
recursive scandir causes seg fault.  code example from
http://us2.php.net/scandir User Contributed Notes.

Reproduce code:
---------------
<?php
$afiles = scandir_recursive("/tmp");
function scandir_recursive($directory)
{
  $folderContents = array();
  $directory = realpath($directory).DIRECTORY_SEPARATOR;
  foreach (scandir($directory) as $folderItem) {
    if ($folderItem != "." AND $folderItem != "..") {
      if (is_dir($directory.$folderItem.DIRECTORY_SEPARATOR)) {
        $folderContents[$folderItem] = scandir_recursive(
$directory.$folderItem."\\");
      }
      else {
        $folderContents[] = $folderItem;
      }
    }
  }
  return $folderContents;
}
?>


Expected result:
----------------
nothing as there is not output in the sample.  just expected it to run
without a seg fault.

Actual result:
--------------
[EMAIL PROTECTED] design]# date;php sample.php;date
Wed Sep  7 16:11:11 CDT 2005
Segmentation fault
Wed Sep  7 16:11:12 CDT 2005
[EMAIL PROTECTED] design]# 

-- 
Edit bug report at http://bugs.php.net/?id=34415&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34415&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34415&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34415&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34415&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34415&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34415&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34415&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34415&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34415&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34415&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34415&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34415&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34415&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34415&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34415&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34415&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34415&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34415&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34415&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34415&r=mysqlcfg

Reply via email to