From: eduard at sitesupra dot com
Operating system: WinXP
PHP version: 4.3.2
PHP Bug Type: Reproducible crash
Bug description: include and user_space stream
Description:
------------
On windows:
When you have include() from userstream
result of stream_eof() is ignored and stream_read() called 2 times more
When few requests occur simultaneosly - apache crushes.
On Linux - this works correctly
Reproduce code:
---------------
<?php
class userstream
{
var $position = 0;
var $data = "If you can read this, it worked";
function stream_open($path, $mode, $options, &$opened_path)
{
return true;
}
function stream_read($count)
{
$ret = substr($this->data, $this->position, $count);
$this->position += strlen($ret);
echo "READ {$this->position}\n";
return $ret;
}
function stream_eof()
{
echo "EOF\n";
return $this->position >= strlen($this->data);
}
function stream_seek($offset,$whence)
{
echo "SEEK\n";
}
function stream_tell()
{
echo "TELL\n";
return $this->position;
}
function stream_stat()
{
echo "STAT\n";
return NULL;
}
function stream_close()
{
echo "CLOSE\n";
}
}
stream_register_wrapper("cookietest", "userstream");
include("cookietest://foo");
?>
Expected result:
----------------
SEEK
TELL
READ 31
EOF
CLOSE
If you can read this, it worked
Actual result:
--------------
SEEK
TELL
STAT
READ 31
EOF
READ 31
EOF
READ 31
EOF
CLOSE
If you can read this, it worked
--
Edit bug report at http://bugs.php.net/?id=25072&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25072&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25072&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25072&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25072&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25072&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25072&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25072&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25072&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25072&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25072&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25072&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25072&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25072&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25072&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25072&r=gnused