|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-01-29 17:42 UTC] 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)
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 06:00:01 2025 UTC |
It's definitely a bug introduced recently. Indeed with: $stream = fopen("php://temp", "r+"); fwrite($stream, "0123456789"); rewind($stream); var_dump(fread($stream, 1024), ftell($stream), feof($stream)); The output for 5.5.20, 5.6.4, php7@20141201, HHVM 3.5.0 is: string(10) "0123456789" int(10) bool(true) And now with 5.5.21, 5.6.5, php7@20150101 the output was: string(10) "0123456789" int(10) bool(false)