php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60121 fgetcsv ignores empty columns
Submitted: 2011-10-24 14:43 UTC Modified: 2011-10-25 06:49 UTC
From: roborg at hotmail dot com Assigned: laruence (profile)
Status: Closed Package: Filesystem function related
PHP Version: 5.3.8 OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: roborg at hotmail dot com
New email:
PHP Version: OS:

 

 [2011-10-24 14:43 UTC] roborg at hotmail dot com
Description:
------------
The patch to bug #53848 has broken fgetcsv when it reads "empty" fields and an 
enclosure is used. Before this patch, the actual result was the same as the 
expected result.

Test script:
---------------
print_r(str_getcsv("1\t2\t3", "\t", "'"));    // This works
print_r(str_getcsv("1\t\t3", "\t", ""));      // This works
print_r(str_getcsv("'1'\t\t'3'", "\t", "'")); // This one is broken (used to work)

Expected result:
----------------
Array
(
    [0] => 1
    [1] => 2
    [2] => 3
)
Array
(
    [0] => 1
    [1] => 
    [2] => 3
)
Array
(
    [0] => 1
    [1] => 
    [2] => 3
)

Actual result:
--------------
Array
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] => 3
)
Array
(
    [0] => 1
    [1] => 
    [2] => 3
)
Array
(
    [0] => 1
    [1] => 3
)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-10-25 06:49 UTC] laruence@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: laruence
 [2011-10-25 06:49 UTC] laruence@php.net
This bug has been fixed in SVN.

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/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

see #55674,  this has been fixed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 17:01:30 2025 UTC