ID: 42219 Updated by: [EMAIL PROTECTED] Reported By: nikhil dot gupta at in dot ibm dot com -Status: Open +Status: Closed Bug Type: Filesystem function related Operating System: Linux PHP Version: 6CVS-2007-08-06 (CVS) New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2007-08-06 12:01:48] nikhil dot gupta at in dot ibm dot com Description: ------------ while using length argument value less than the line size to be read, fgetcsv() outputs result without considering the length value that is passed and assumes the maximum length always. This behaviour is correct in PHP5. Reproduce code: --------------- <?php $csv_string = 'water,fruit'; $filename = "file.tmp"; $file_handle = fopen($filename, "w"); fwrite($file_handle, $csv_string ); fclose($file_handle); $file_handle = fopen($filename, "r"); // use length as less than the actual size of the line fseek($file_handle, 0, SEEK_SET); var_dump( fgetcsv($file_handle, 9) ); // read rest of the line var_dump( fgetcsv($file_handle, 1024) ); // close the file fclose($file_handle); //delete file unlink($filename); ?> Expected result: ---------------- array(2) { [0]=> string(5) "water" [1]=> string(3) "fru" } array(1) { [0]=> string(2) "it" } Actual result: -------------- array(2) { [0]=> string(5) "water" [1]=> string(5) "fruit" } bool(false) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42219&edit=1