Edit report at https://bugs.php.net/bug.php?id=55674&edit=1
ID: 55674 Updated by: larue...@php.net Reported by: keith at iveys dot org Summary: fgetcsv & str_getcsv skip empty fields in some tab-separated records -Status: Open +Status: Closed Type: Bug Package: Strings related Operating System: Linux (Centos 5.5) PHP Version: 5.3.8 -Assigned To: +Assigned To: laruence Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2011-09-13 12:43:57] larue...@php.net Automatic comment from SVN on behalf of laruence Revision: http://svn.php.net/viewvc/?view=revision&revision=316618 Log: Fixed Bug #55674 (fgetcsv & str_getcsv skip empty fields in some tab-separated records) which was introduced by r311543 ------------------------------------------------------------------------ [2011-09-12 16:42:27] keith at iveys dot org 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 this bug report at https://bugs.php.net/bug.php?id=55674&edit=1