Bug #70491 [NEW]: str_getcsv does not remove double quotes from the first row of a content

From: Date: Mon, 14 Sep 2015 13:39:50 +0000
Subject: Bug #70491 [NEW]: str_getcsv does not remove double quotes from the first row of a content
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195999@lists.php.net to get a copy of this message
From: msecco at gmx dot com Operating system: debian PHP version: 5.6.13 Package: Filesystem function related Bug Type: Bug Bug description:str_getcsv does not remove double quotes from the first row of a content Description: ------------ --- From manual page: http://www.php.net/function.str-getcsv --- Hi I'm using this function and it works well, only the first row for all its fields I need to use str_replace(array('"', "'"), "", $line[1]) and str_replace(array('"', "'"), "", $line[0]) to remove the double quotes. The rest of rows are ok if the line is this $data .= $line[1] . ' - ' . $line[0] . "\n"; I get the double quotes bye Test script: --------------- $content = file_get_contents($url); $rows = explode("\n", $content); foreach ($rows as $row) { if ($row) { $line = str_getcsv($row, "|", '"'); if ($line[1] && $line[0]) $data .= (int)str_replace(array('"', "'"), "", $line[1]) . ' - ' . str_replace(array('"', "'"), "", $line[0]) . "\n"; } } -- Edit bug report at https://bugs.php.net/bug.php?id=70491&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70491&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70491&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70491&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70491&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70491&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70491&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70491&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70491&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70491&r=support Expected behavior: https://bugs.php.net/fix.php?id=70491&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70491&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70491&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70491&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70491&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70491&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70491&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70491&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70491&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70491&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70491&r=mysqlcfg

« previous php.bugs (#195999) next »