From:             uk_gavin_uk at hotmail dot com
Operating system: Windows 2000
PHP version:      5.0.2
PHP Bug Type:     Filesystem function related
Bug description:  stream_get_line() not working as documented

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 bug report at http://bugs.php.net/?id=30362&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30362&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30362&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30362&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30362&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30362&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30362&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30362&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30362&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30362&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30362&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30362&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30362&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30362&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30362&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30362&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30362&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30362&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30362&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30362&r=mysqlcfg

Reply via email to