#25072 [Opn->Fbk]: include and user_space stream
| From: | sniper@php.net | Date: | Wed, 13 Aug 2003 10:30:36 +0000 |
| Subject: | #25072 [Opn->Fbk]: include and user_space stream | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-45847@lists.php.net to get a copy of this message | ||
ID: 25072
Updated by: sniper@php.net
Reported By: eduard at sitesupra dot com
-Status: Open
+Status: Feedback
Bug Type: Reproducible crash
Operating System: WinXP
PHP Version: 4.3.2
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2003-08-13 05:26:23] eduard at sitesupra dot com
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 this bug report at http://bugs.php.net/?id=25072&edit=1