|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-02-10 04:09 UTC] felipe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 13:00:01 2025 UTC |
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)