Re: stream_get_line behaviour Bug #63240

From: Date: Wed, 10 Oct 2012 13:52:37 +0000
Subject: Re: stream_get_line behaviour Bug #63240
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-63325@lists.php.net to get a copy of this message
Sent from my iPhone On 10 Oct, 2012, at 6:39 PM, Nicolai Scheer <nicolai.scheer@gmail.com> wrote: > Hi again! > > Thanks for your help an comments on the issue. > > cataphract commented on the stream_get_line behaviour (returning false > when used on an empty file) on the bug report page. > I do agree that reading on an empty file can be considered an error > thus returning false, because there's nothing to read. > > Unfortunately, and that's why we stumbled upon this in the first > place, feof does not return true when opening an empty file. > I did not have a look at the internals, but my guess is that feof just > does not return true because no one did a read on the file handle yet. > To my mind if would be sensible to return true using feof on an empty > file, so that one does not actually try a read... That wouldn't be right. Technically the EOF should be discovered, not deduced from other information like stat(). Also, some streams don't support reporting an appropriate size. > > What do you think? > > Greetings > > Nico > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.internals (#63325) next »