ID:               26600
 Updated by:       [EMAIL PROTECTED]
 Reported By:      dozoyousan at mail dot goo dot ne dot jp
-Status:           Open
+Status:           Bogus
 Bug Type:         Unknown/Other Function
 Operating System: Win2k,Linux
 PHP Version:      4.3.4
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You need to use filesize() + 1 because the last byte is reserved for
(\0).


Previous Comments:
------------------------------------------------------------------------

[2003-12-12 05:56:32] dozoyousan at mail dot goo dot ne dot jp

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 this bug report at http://bugs.php.net/?id=26600&edit=1

Reply via email to