ID: 42229 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, Win32-xp PHP Version: 6CVS-2007-08-07 (snap) 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-07 05:54:36] nikhil dot gupta at in dot ibm dot com Description: ------------ fgetcsv() behaves differently for a file which has '\n' characters for php5 and php6. php5 output is correct because the characters are given in single quotes hence these characters will not be interpreted as newline and taken as normal characters. Hence fgetcsv() should print the characters which is happening on php5 and not on php6. Reproduce code: --------------- <?php $fp = fopen("file2.tmp", "w"); $csv_string = '\n'; fwrite($fp, $csv_string); fclose($fp); $fp = fopen("file2.tmp", "r"); var_dump( ftell($fp) ); var_dump( fgetcsv($fp) ); var_dump( ftell($fp) ); var_dump( feof($fp) ); var_dump( fseek($fp, 0, SEEK_END) ); var_dump( ftell($fp) ); var_dump( feof($fp) ); fclose($fp); ?> Expected result: ---------------- int(0) array(1) { [0]=> string(2) "\n" } int(2) bool(true) int(0) int(2) bool(true) Actual result: -------------- int(0) array(0) { } int(2) bool(true) int(0) int(2) bool(false) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42229&edit=1
