ID: 36320
Updated by: [EMAIL PROTECTED]
Reported By: Jared dot Williams1 at ntlworld dot com
-Status: Open
+Status: Suspended
Bug Type: Streams related
Operating System: Win2000
PHP Version: 5.1.2
New Comment:
There is no easy fix for this problem inside PHP source code. The
problem stems from PHP's shutdown order, where classes are destroyed
prior to resources. The fix you can implement involves adding a missing
clodedir() call to your script.
Previous Comments:
------------------------------------------------------------------------
[2006-02-07 16:16:31] Jared dot Williams1 at ntlworld dot com
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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36320&edit=1