#35859 [NEW]: fread limited to 8K
| From: | cpuidle at gmx dot de | Date: | Sat, 31 Dec 2005 13:20:25 +0000 |
| Subject: | #35859 [NEW]: fread limited to 8K | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-91302@lists.php.net to get a copy of this message | ||
From: cpuidle at gmx dot de
Operating system: WinXP SP2
PHP version: 5.1.1
PHP Bug Type: Filesystem function related
Bug description: fread limited to 8K
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 bug report at http://bugs.php.net/?id=35859&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35859&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35859&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35859&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=35859&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35859&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35859&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35859&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35859&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35859&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35859&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=35859&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=35859&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35859&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35859&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35859&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35859&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35859&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35859&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35859&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35859&r=mysqlcfg