php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #31192 fgetcsv optional parameter length cannot be set to -1
Submitted: 2004-12-20 08:15 UTC Modified: 2005-03-07 19:41 UTC
From: markus at fischer dot name Assigned: helly (profile)
Status: Closed Package: Feature/Change Request
PHP Version: 5.0.3 OS: Any
Private report: No CVE-ID: None
 [2004-12-20 08:15 UTC] markus at fischer dot name
Description:
------------
The default bahavior auf fgetcsv() is, if no parameter but the first is given, that it automatically adjusts the buffer size when reading the stream. Internally this is done by setting length to -1.

However, when you start to provide a custom delimiter or enclosure, you also have to specify the length. It is not possible to set length to -1 (the C code prevents this), therefore the feature that the buffer adjusts its size automatically cannot be used.

This is pretty much the same http://php.net/preg_split handles 
limit and flags parameter. If you want to specify "flags" but no "limit", you set limit to -1.

This should be possible for fgetcsv() too.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-07 19:41 UTC] helly@php.net
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.

You have to use limit=0 for default. Setting it to -1 still won't work.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 11:01:31 2024 UTC