From: nikhil dot gupta at in dot ibm dot com Operating system: Linux, Win32-xp PHP version: 6CVS-2007-08-07 (snap) PHP Bug Type: Filesystem function related Bug description: fgetcsv() behaves differently for a file containing '\n' with php5 and php6.
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 bug report at http://bugs.php.net/?id=42229&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42229&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42229&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42229&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42229&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42229&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42229&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42229&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42229&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42229&r=support Expected behavior: http://bugs.php.net/fix.php?id=42229&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42229&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42229&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42229&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42229&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42229&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42229&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42229&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42229&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42229&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42229&r=mysqlcfg