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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 18:01:28 2024 UTC