From:             jason at e7x dot com
Operating system: Windows 2000/Linux
PHP version:      4.3.9
PHP Bug Type:     Filesystem function related
Bug description:  fread from userspace stream wrapper only reads 8192 bytes

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 bug report at http://bugs.php.net/?id=30936&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30936&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=30936&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=30936&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30936&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30936&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30936&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30936&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30936&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30936&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30936&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=30936&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=30936&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30936&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30936&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30936&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30936&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30936&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30936&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30936&r=mysqlcfg

Reply via email to