#49148 [Opn]: combination of stream_get_line and fseek does not work correctly

From: Date: Mon, 31 Aug 2009 20:04:38 +0000
Subject: #49148 [Opn]: combination of stream_get_line and fseek does not work correctly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-141773@lists.php.net to get a copy of this message
ID: 49148 Updated by: garretts@php.net Reported By: mugeso at mugeso dot com Status: Open Bug Type: Streams related Operating System: win32 only - Windows XP SP3 PHP Version: 5.2.10 New Comment: This is reproduceable on Linux too. Previous Comments: ------------------------------------------------------------------------ [2009-08-04 07:44:16] mugeso at mugeso dot com Description: ------------ When use in combination of stream_get_line and fseek, reading a file which has only 2 lines without ending on EOF(like below) does fail. This happens on only Windows and with only "2lines file without ending on EOF". Reproduce code: --------------- 2lines.txt -- a<CRLF> b<EOF> phpfile: -- <?php $file = dirname(__FILE__) . '/2lines.txt'; $fp = fopen($file, "rb"); var_dump(stream_get_line($fp, null, "\xd\xa")); fseek($fp, ftell($fp)); // expected that this does not affect result. var_dump(stream_get_line($fp, null, "\xd\xa")); Expected result: ---------------- string(1) "a" string(1) "b" Actual result: -------------- string(1) "a" bool(false) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49148&edit=1

« previous php.bugs (#141773) next »