|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-11-13 12:53 UTC] samuel dot chemla at orange dot com
Description:
------------
feof return false when it should return true.
See script below.
This bug is only on 7.0.32.
I tested on 7.2.9 and it works perfectly.
I filled this report because not reaching eof may be dangerous.
Test script:
---------------
$data = "foo";
$stream = fopen('php://memory', 'r+');
fwrite($stream, $data);
fseek($stream, 0);
if ($data !== fread($stream, strlen($data)+1)) {
throw new \Exception("Invalid data");
}
if (strlen($data) !== ftell($stream)) {
throw new \Exception("Invalid tell");
}
if (feof($stream) !== true) {
throw new \Exception("Invalid eof");
}
Expected result:
----------------
<No exception>
Actual result:
--------------
\Exception("Invalid eof") raised
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 21:00:01 2025 UTC |
For sake of consistency it should be in line: $data = "foo"; $stream = fopen('php://memory', 'r+'); fwrite($stream, $data); fseek($stream, 0); if ($data !== fread($stream, strlen($data)+1)) { throw new \Exception("Invalid read"); } if (strlen($data) !== ftell($stream)) { throw new \Exception("Invalid tell"); } if (feof($stream) !== true) { throw new \Exception("Invalid eof"); }