Home » File System » File » Bug #1191
File::readLine() stops on blank lines
Details
| Submitted | 2004-04-13 04:17 UTC |
|---|---|
| From | ieure at php dot net |
| Status | Bogus |
| Package | File |
| PHP Version | Irrelevant |
| OS | Debian Linux |
| Roadmaps | (Not assigned) |
Comments
[2004-04-13 04:17 UTC] ieure at php dot net
Description:
------------
When readLine() comes to an empty line in a text file, it stops.
Reproduce code:
---------------
while ($line = File::readLine('file')) {
print $line;
}
compare with:
$fp = fopen('file', 'r');
while ($line = fgets($fp, 1024)) {
print $line;
}
fclose($fp);
Expected result:
----------------
The while loop should continue until all lines in 'file' have been read and
returned.
Actual result:
--------------
The while loop stops at the first empty line in 'file'
[2004-04-13 18:57 UTC] richard at phpguru dot org
Your code is at fault, not the package.
[2004-05-19 08:02 UTC] ieure at php dot net
In what way is my code at fault?
The File documentation does not indicate any methods to
either determine the number of lines in a file, nor to
determine if there are lines left to be read.