Bug #55674 [NEW]: fgetcsv & str_getcsv skip empty fields in some tab-separated records
| From: | keith at iveys dot org | Date: | Mon, 12 Sep 2011 16:42:27 +0000 |
| Subject: | Bug #55674 [NEW]: fgetcsv & str_getcsv skip empty fields in some tab-separated records | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-163470@lists.php.net to get a copy of this message | ||
From:
Operating system: Linux (Centos 5.5)
PHP version: 5.3.8
Package: Strings related
Bug Type: Bug
Bug description:fgetcsv & str_getcsv skip empty fields in some tab-separated records
Description:
------------
If the record contains an (unquoted) empty field followed by a quoted
field, the
empty field is skipped, so all following column positions are off. This
happens
when the delimiter is "\t" but not when it's ",", so it probably has
something to
do with changes related to trimming whitespace. This problem seems to have
been
introduced between 5.3.6 and 5.3.8.
Test script:
---------------
$s = "0\t\t\"2\"\n";
$a = str_getcsv($s, "\t");
var_export($a);
Expected result:
----------------
array (
0 => '0',
1 => '',
2 => '2',
)
Actual result:
--------------
array (
0 => '0',
1 => '2',
)
--
Edit bug report at https://bugs.php.net/bug.php?id=55674&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55674&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55674&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55674&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=55674&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55674&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=55674&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=55674&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=55674&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=55674&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=55674&r=support
Expected behavior: https://bugs.php.net/fix.php?id=55674&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=55674&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=55674&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=55674&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55674&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55674&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=55674&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=55674&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=55674&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=55674&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=55674&r=mysqlcfg