Closed (fixed)
Project:
Stock API
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Anonymous (not verified)
Created:
30 May 2008 at 23:28 UTC
Updated:
17 May 2020 at 12:23 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
kbahey commentedWell, that works, but I don't like the intermediate file thing. It is slow, and introduces concurrency issues.
Try this instead? http://php.net/manual/en/function.str-getcsv.php
Or something from comments there, or here http://www.php.net/manual/en/function.split.php
Comment #2
Anonymous (not verified) commentedI agree that it's a bit clumsy to save it to a temp file, but str_getcsv says:
(No version information available, might be only in CVS)So fgetcsv is really the only built-in PHP option.
Writing a separate CSV parsing function based on notes in the PHP manual comments is, of course, possible, but not something I will be doing.
Thanks,
Curtis.
Comment #3
andywalters commentedI fixed this bug without using a temporary file. It works on the assumption that commas that need to be escaped will always appear within a set of quotes. Insert the following code after (around line 107):
Insert this code:
and before:
It should at least fix the problems for the yahoo feed.
Comment #4
kbahey commentedPlease submit a working patch for review. See http://drupal.org/patch for details on how to do so.
Comment #5
reaneyk commentedHere's a patch with the code from andywalters.
KC
Comment #6
kbahey commentedThank you for taking the time to create this.
I think that this code is a bit verbose and complicated. Can it be simplified as much of possible so it is maintainable and understandable going forward?
Comment #7
reaneyk commentedHere's an updated simplified version of the patch.
KC
Comment #8
kbahey commentedCommitted.
Thanks