Bug #68948 [Com]: feof() on temporary streams broken

From: Date: Thu, 29 Jan 2015 19:15:29 +0000
Subject: Bug #68948 [Com]: feof() on temporary streams broken
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190315@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68948&edit=1

 ID:                 68948
 Comment by:         php at mcq8 dot be
 Reported by:        yunosh@php.net
 Summary:            feof() on temporary streams broken
 Status:             Open
 Type:               Bug
 Package:            Streams related
 Operating System:   Linux
 PHP Version:        master-Git-2015-01-29 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

This is due to https://github.com/php/php-src/pull/936
You only get an EOF when you tried to read more than there is data.
This is the same behaviour as reading from a file.


Previous Comments:
------------------------------------------------------------------------
[2015-01-29 17:42:00] yunosh@php.net

Description:
------------
feof() doesn't work properly on temporary streams.

Test script:
---------------
$stream = fopen("php://temp", "r+");
fwrite($stream, "0123456789");
rewind($stream);
var_dump(fread($stream, 10), ftell($stream), feof($stream));

Expected result:
----------------
string(10) "0123456789"
int(10)
bool(true)


Actual result:
--------------
string(10) "0123456789"
int(10)
bool(false)



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=68948&edit=1


Thread (10 messages)

« previous php.bugs (#190315) next »