Bug #27730 (fgetcsv() fails on 2 newlines)

php.internals

Moriyoshi Koizumi

22 years ago
Hi, As this bug was already marked as a documentation problem and handled by Rasmus, but I don't think this is a problem of that kind, because versions prior to 4.3.5 returns an array that contains a null string element and the script supplied by the user on bug #27730 had worked flawlessly. I think this should also be addressed during the RC period of 4.3.6. Regards, Moriyoshi

Moriyoshi Koizumi

22 years ago
> that kind, because versions prior to 4.3.5 returns an array > that contains a null string element and the script supplied > by the user on bug #27730 had worked flawlessly.
Here I mean: because in versions prior to 4.3.5 fgetcsv() returns an array that contains a null string element for an empty line.. Anyway, I might be a bit too late. Moriyoshi

Ilia A.

22 years ago
I've just tried the script an both PHP 4.3.6, 4.2.3 and 5.0 return the same results. <?php $fp = fopen("test.csv", 'w' ); fwrite( $fp, "one;val1\ntwo;val2\n\nthree;val3\n" ); fclose( $fp ); $fp = fopen("test.csv", 'r' ); $items = array( ); while( $d = fgetcsv( $fp, 4096, ';' ) ) { var_dump($d); } fclose( $fp ); ?> Result: array(2) { [0]=> string(3) "one" [1]=> string(4) "val1" } array(2) { [0]=> string(3) "two" [1]=> string(4) "val2" } array(1) { [0]=> string(0) "" } array(2) { [0]=> string(5) "three" [1]=> string(4) "val3" } Ilia

Rasmus Lerdorf

22 years ago
Uh, huh? The behaviour in 4.3.5 is the same as always. Nothing has changed here. It was simple user error in that report. -Rasmus On Fri, 2 Apr 2004, Moriyoshi Koizumi wrote:

Clemens Gutweiler

22 years ago
Hi Rasmus,
> From: Rasmus Lerdorf [mailto:rasmus@php.net]
> Uh, huh? The behaviour in 4.3.5 is the same as always. Nothing has > changed here. It was simple user error in that report.
Result of Ilia's test-script with PHP 4.3.3: array(2) { [0]=> string(3) "one" [1]=> string(4) "val1" } array(2) { [0]=> string(3) "two" [1]=> string(4) "val2" } array(1) { [0]=> string(0) "" } array(2) { [0]=> string(5) "three" [1]=> string(4) "val3" } and with PHP 4.3.5: array(2) { [0]=> string(3) "one" [1]=> string(4) "val1" } array(2) { [0]=> string(3) "two" [1]=> string(4) "val2" } I think the behaviour is NOT the same as always. Clemens

Ilia A.

22 years ago
On April 2, 2004 11:42 am, Clemens Gutweiler wrote:
> > Uh, huh? The behaviour in 4.3.5 is the same as always. Nothing has > > changed here. It was simple user error in that report.
Fixed.

Moriyoshi Koizumi

22 years ago
On 2004/04/03, at 1:55, Ilia Alshanetsky wrote:
> On April 2, 2004 11:42 am, Clemens Gutweiler wrote: >>> Uh, huh? The behaviour in 4.3.5 is the same as always. Nothing has >>> changed here. It was simple user error in that report. > > Fixed.
Since when did people stop believing what I say? Anyway, I'm fine to hear it was fixed :) Moriyoshi