From:             dozoyousan at mail dot goo dot ne dot jp
Operating system: Win2k,Linux
PHP version:      4.3.4
PHP Bug Type:     Unknown/Other Function
Bug description:  only one line CSV

Description:
------------
If only one line csv file , fgetcsv read two or more lines.

Reproduce code:
---------------
<?
        $file_name = "temp.csv";
        
        $file_ptr = fopen($file_name, "w");
        fwrite( $file_ptr, "php, pear, pecl");
        fclose( $file_ptr );
        
        $file_ptr = fopen( $file_name, "r" );

        while( $rows = fgetcsv( $file_ptr , filesize( $file_name ), "," ) )
                echo nl2br( print_r( $rows, true ));
        
        fclose( $file_ptr );
?>

Expected result:
----------------
Array
(
[0] => php
[1] => pear
[2] => pecl
)


Actual result:
--------------
Array
(
[0] => php
[1] => pear
[2] => pec
)
Array
(
[0] => l
)


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

Reply via email to