#49148 [NEW]: combination of stream_get_line and fseek does not wrok correctly
| From: | mugeso at mugeso dot com | Date: | Tue, 04 Aug 2009 07:44:16 +0000 |
| Subject: | #49148 [NEW]: combination of stream_get_line and fseek does not wrok correctly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-140633@lists.php.net to get a copy of this message | ||
From: mugeso at mugeso dot com
Operating system: Windows XP SP3
PHP version: 5.2.10
PHP Bug Type: Streams related
Bug description: combination of stream_get_line and fseek does not wrok correctly
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 bug report at http://bugs.php.net/?id=49148&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49148&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49148&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49148&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49148&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49148&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49148&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49148&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49148&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49148&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49148&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49148&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49148&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49148&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49148&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49148&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49148&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49148&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49148&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49148&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49148&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49148&r=mysqlcfg