Edit report at http://bugs.php.net/bug.php?id=53848&edit=1

 ID:                 53848
 Updated by:         il...@php.net
 Reported by:        andre at webkr dot de
 Summary:            fgetcsv ignores spaces at beginnings of fields
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   Windows 7
 PHP Version:        5.3.5
-Assigned To:        
+Assigned To:        iliaa
 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/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------
[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.

------------------------------------------------------------------------
[2011-04-15 19:40:41] mark dot mccray at tbwachiat dot com

Forgot to add that we are on hp-ux 11.11i. Php ver 5.2.4.

------------------------------------------------------------------------
[2011-04-15 19:40:08] mark dot mccray at tbwachiat dot com

I'm posting a comment here instead of a bug because I feel we may be 

encountering the same issue.



My problem is that fgetcsv seems to trim whitespace at the beginning of
any 

field -- not just at the beginning of a record.



In a record (our files are separated by a pipe symbol):

"001|00005964_154|OGLCV|003| 

174699|USD|0326049|Corporation||000000|11/03/27||11/04/14|1|MPY||CP"



The field " 174699" gets inserted into the array as "174699".



We are expecting the leading whitespace to not be trimmed.

------------------------------------------------------------------------


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

    http://bugs.php.net/bug.php?id=53848


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53848&edit=1

Reply via email to