ID: 30362
User updated by: uk_gavin_uk at hotmail dot com
Reported By: uk_gavin_uk at hotmail dot com
Status: Open
Bug Type: Filesystem function related
Operating System: Windows 2000
PHP Version: 5.0.2
New Comment:
The $a was meant to be "Y" in stream_get_line()
schoolboy error :-/
Previous Comments:
------------------------------------------------------------------------
[2004-10-08 13:39:34] uk_gavin_uk at hotmail dot com
Description:
------------
- Downloaded and using php-5.0.2-Win32.zip from www.php.net
- Confirmed md5 hash
using stream_get_line() on a file I get data returned to me but not in
the manner expected or documented?? It's best you look at the
Reproduce code, but it looks like the function reads up until the first
instance of the delimiter specified, but on subsequent calls it ignores
the delemeter and reads in the number of chars it did on the first
call??
Reproduce code:
---------------
<?php
$resource = fopen('C:/test/import/file.txt', 'rb');
for ($i = 0; ($i < 10) && !feof($resource); ++$i ) {
$line = stream_get_line($resource, 50, $a);
echo $line . "\n";
}
fclose($resource);
?>
FILE.TXT:
111Y111111111Y111111111Y111111111Y111111111Y111111111Y111111111Y111111111Y111111111Y111111111
Expected result:
----------------
111
111111111
111111111
111111111
111111111
111111111
111111111
111111111
Actual result:
--------------
111
Y11
111
111
1Y1
111
111
11Y
111
111
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30362&edit=1