PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » File System » File » Bug #1191

File::readLine() stops on blank lines

Details

Submitted2004-04-13 04:17 UTC
Fromieure at php dot net
StatusBogus
PackageFile
PHP VersionIrrelevant
OSDebian 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.