Doc #61048 [Com]: fgetcsv() length of 0 DOES NOT mean unlimited maximum line length

From: Date: Sun, 12 Feb 2012 05:20:41 +0000
Subject: Doc #61048 [Com]: fgetcsv() length of 0 DOES NOT mean unlimited maximum line length
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7930@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61048&edit=1

 ID:                 61048
 Comment by:         phpmpan at mpan dot pl
 Reported by:        blajoie55 at gmail dot com
 Summary:            fgetcsv() length of 0 DOES NOT mean unlimited
                     maximum line length
 Status:             Open
 Type:               Documentation Problem
 Package:            Documentation problem
 Operating System:   Linux
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Confirmed. 5.0.4 uses code from r181491 (in 5.0 branch), which sets length to 1 if 0 is passed as
the second argument. The behaviour described by the documentation was introduced by r181490 (in
5.1).

Therefore the documentation should be changed to:

"Omitting this parameter (or setting it to 0 in PHP 5.1.0 and later) the maximum line length is
not limited, which is slightly slower."


Previous Comments:
------------------------------------------------------------------------
[2012-02-10 18:43:24] blajoie55 at gmail dot com

updating summary

------------------------------------------------------------------------
[2012-02-10 18:28:32] blajoie55 at gmail dot com

Description:
------------
---
From manual page: http://www.php.net/function.fgetcsv#refsect1-function.fgetcsv-
parameters
---

The documentation states the following for the length parameter for fgetcsv():

"Must be greater than the longest line (in characters) to be found in the CSV 
file (allowing for trailing line-end characters). It became optional in PHP 5. 
Omitting this parameter (or setting it to 0 in PHP 5.0.4 and later) the maximum 
line length is not limited, which is slightly slower."

This is wrong. I have a php 5.0.4 environment using fgetcsv() in a while loop as 
follows:

fgetcsv($csvHandle, 0, self::DELIMITER);

And the 0 does not put no limit on the max line length, instead the fgetcsv() 
call gets each individual character on the line in the file



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61048&edit=1


Thread (6 messages)

« previous php.doc.bugs (#7930) next »