#35859 [Opn->Fbk]: fread limited to 8K
| From: | vrana@php.net | Date: | Mon, 09 Jan 2006 15:25:24 +0000 |
| Subject: | #35859 [Opn->Fbk]: fread limited to 8K | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969371486@lists.php.net to get a copy of this message | ||
ID: 35859
Updated by: vrana@php.net
Reported By: cpuidle at gmx dot de
-Status: Open
+Status: Feedback
Bug Type: Documentation problem
Operating System: WinXP SP2
PHP Version: 5.1.1
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc.
If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.
Previous Comments:
------------------------------------------------------------------------
[2006-01-06 16:55:51] cpuidle at gmx dot de
OK, at least a documentation problem, thanks. The dependency on stread
wrappers still seem to be a non-docs bug to me. And the sudden change
in behaviour certainly doesn't help with the often-claimed enterprise
readiness...
Why should existing 5.0.5 code suddenly break with 5.1.1?
------------------------------------------------------------------------
[2006-01-06 16:50:09] sniper@php.net
reclassified (see bug #30936 for Wez's comment)
------------------------------------------------------------------------
[2005-12-31 15:36:16] cpuidle at gmx dot de
The documentation reads:
> fread() reads up to length bytes from the file pointer referenced by
handle. Reading stops when up to length bytes have been read, EOF (end
of file) is reached, or (for network streams) when a packet becomes
available, whichever comes first.
Neither of the conditions is satisfied. The internal 8K limit is *not*
documented?
------------------------------------------------------------------------
[2005-12-31 15:27:51] sniper@php.net
See comments in bug #30936
------------------------------------------------------------------------
[2005-12-31 14:20:24] cpuidle at gmx dot de
Description:
------------
I'm experiencing a very weird bug where fread is limited to 8K though
the source file (ANSI) is bigger than 8K. I was not able to reproduce
the bug standalone, only inside a complex application.
This does not happen with PHP5.0.5, but with 5.1.1.
Unfortunately the sample code does not reproduce the problem
standalone, but demonstrates the effect.
Reproduce code:
---------------
function _read_file($filename)
{
if ( file_exists($filename) && ($fd = @fopen($filename, 'rb')) ) {
$contents = ($size = filesize($filename)) ? fread($fd, $size) :
'';
echo("_read_file($filename) \$size: $size strlen(\$contents):
".strlen($contents)."<br/>");
fclose($fd);
}
}
_read_file('templates/elegant/\show.tpl');
Expected result:
----------------
Output:
_read_file(templates/elegant/\show.tpl) $size: 9520 strlen($contents):
9520
Actual result:
--------------
Output:
_read_file(templates/elegant/\show.tpl) $size: 9520 strlen($contents):
8192
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35859&edit=1