|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-02-08 00:44 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 21 23:00:01 2025 UTC |
Description: ------------ dir_readdir seems to cause a crash when used with readdir(). Code below is based on the \ext\standard\tests\file\userdirstream.phpt test, but instead of using scandir() which appears to work fine, the manual looping causes an application exception. Reproduce code: --------------- class test { public $idx = 0; function dir_opendir($path, $options) { print "Opening\n"; $this->idx = 0; return true; } function dir_readdir() { $sample = array('first','second','third','fourth'); if ($this->idx >= count($sample)) return false; else return $sample[$this->idx++]; } function dir_rewinddir() { $this->idx = 0; return true; } function dir_closedir() { print "Closing up!\n"; return true; } } stream_wrapper_register('test', 'test'); $dh = opendir('test://example.com/path/to/test'); if ($dh) { while (($f = readdir($dh)) !== FALSE) echo $f, "\n"; } Expected result: ---------------- Opening first second third fourth without an application exception Actual result: -------------- Opening first second third fourth with an application exception