Bug #53848 [NEW]: fgetcsv ignores spaces on beginning of line

From: Date: Wed, 26 Jan 2011 12:49:48 +0000
Subject: Bug #53848 [NEW]: fgetcsv ignores spaces on beginning of line
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-158207@lists.php.net to get a copy of this message
From: Operating system: Windows 7 PHP version: 5.3.5 Package: Filesystem function related Bug Type: Bug Bug description:fgetcsv ignores spaces on beginning of line Description: ------------ RFC4180 says: "Spaces are considered part of a field and should not be ignored." However (despite being the only CSV parsing function that fulfils all other requirements), fgetcsv ignores spaces at the very beginning of a record. Test script: --------------- /* Put this in a file: a,b c,d */ $fd = fopen('the_file','r'); $a = fgetcsv($fd); Expected result: ---------------- array( array('a', 'b'), array(' c','d') ) Actual result: -------------- array( array('a', 'b'), array('c','d') ) -- Edit bug report at http://bugs.php.net/bug.php?id=53848&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53848&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53848&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53848&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53848&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53848&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53848&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53848&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53848&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53848&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53848&r=support Expected behavior: http://bugs.php.net/fix.php?id=53848&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53848&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53848&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53848&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53848&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=53848&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53848&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53848&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53848&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53848&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53848&r=mysqlcfg

« previous php.bugs (#158207) next »