#30936 [Opn->Bgs]: fread from userspace stream wrapper only reads 8192 bytes
| From: | derick@php.net | Date: | Mon, 29 Nov 2004 22:25:34 +0000 |
| Subject: | #30936 [Opn->Bgs]: fread from userspace stream wrapper only reads 8192 bytes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-69626@lists.php.net to get a copy of this message | ||
ID: 30936
Updated by: derick@php.net
Reported By: jason at e7x dot com
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: Windows 2000/Linux
PHP Version: 4.3.9
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
http://php.net/fread says:
fread() reads up to length bytes from the file pointer referenced by
handle
note the "up to".
Previous Comments:
------------------------------------------------------------------------
[2004-11-29 22:47:45] jason at e7x dot com
Description:
------------
Attempting to fread() more than 8192 bytes from a userspace stream
wrapper will only read and return the first 8192 bytes, putting an echo
statement in stream_read() shows that it is only being called once.
Reading <= 8192 bytes at a time works as expected, as does fgets($f,
15000) (reads 14999 bytes).
This bug is only present in 4.3.9 and 4.3.10RC1, 4.3.8 works fine.
Reproduce code:
---------------
<?php
// using example class from the manual:
// http://uk.php.net/stream_wrapper_register
$x = str_repeat('x', 15000);
$f = fopen('var://x', 'r');
$len = strlen(fread($f, 15000));
fclose($f);
echo "Read $len bytes";
?>
Expected result:
----------------
Read 15000 bytes
Actual result:
--------------
Read 8192 bytes
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30936&edit=1