Edit report at https://bugs.php.net/bug.php?id=53848&edit=1
ID: 53848
Comment by: roborg at hotmail dot com
Reported by: andre at webkr dot de
Summary: fgetcsv ignores spaces at beginnings of fields
Status: Closed
Type: Bug
Package: Filesystem function related
Operating System: Windows 7
PHP Version: 5.3.5
Assigned To: iliaa
Block user comment: N
Private report: N
New Comment:
Please reopen this bug - it's not working when the delimiter is a tab and an
enclosure is used.
Test script:
------------
print_r(str_getcsv("1\t2\t3", "\t", "'"));
print_r(str_getcsv("1\t\t3", "\t", ""));
print_r(str_getcsv("'1'\t\t'3'", "\t", "'"));
Expected result:
----------------
Array
(
[0] => 1
[1] => 2
[2] => 3
)
Array
(
[0] => 1
[1] =>
[2] => 3
)
Array
(
[0] => 1
[1] =>
[2] => 3
)
Actual result (PHP 5.3.8)
-------------------------
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 3
)
Array
(
[0] => 1
[1] =>
[2] => 3
)
Array
(
[0] => 1
[1] => 3
)
Before this patch, the actual result was the same as the expected result.
Thanks,
Greg
Previous Comments:
------------------------------------------------------------------------
[2011-05-29 12:23:08] [email protected]
Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&revision=311543
Log: Fixed bug #53848 (fgetcsv() ignores spaces at beginnings of fields).
------------------------------------------------------------------------
[2011-05-29 12:21:28] [email protected]
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/.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2011-04-21 00:51:19] dave at roweware dot com
Same problem for me on Ubuntu 10.04 - PHP 5.3.2
I would much prefer to control if/when the fields are trimmed via trimming them
myself, or via a flag.
------------------------------------------------------------------------
[2011-04-16 19:51:33] andre at webkr dot de
Indeed, I overlooked that.
I added your data to my test (without the quotes and line break, of course) and
I can confirm that issue. I changed the summary accordingly.
------------------------------------------------------------------------
[2011-04-15 19:49:51] mark dot mccray at tbwachiat dot com
Same issue on Mac OS X 10.6.7 running PHP ver 5.3.4.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=53848
--
Edit this bug report at https://bugs.php.net/bug.php?id=53848&edit=1