Trying this module out and used a list of symbols with a comma delimiter (whoops). This caused the function stockapi_load in the stockapi to go into an infinite loop. In the stockapi_load function I modified this line

$stock = stockapi_load($symbol);

to

$stock = stockapi_load($stock[0]);

but perhaps the stock.module needs to clean the symbols or modified to use different delimiters? Thanks.

CommentFileSizeAuthor
#4 yh.patch682 bytesyhager
#1 stock.patch.txt422 bytesoadaeh
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

oadaeh’s picture

FileSize
422 bytes

Your suggestion didn't work for me. I'm sure there's a "correct" way to do this, but a quick and easy fix would be to just give the field a description which specifies to use spaces. The patch I have posted does just that (plus removes some trailing white space).

I am going to be doing some tweaking for my own benefit in this module. If I find a real fix for this problem, I'll post that patch also.

kbahey’s picture

Commited instruction enhancement to HEAD and 4.7.

Leaving issue open for tracking and patches from someone else.

agentrickard’s picture

I had the same problem and added this line.
function stock_do_quote

    if (!empty($symbol)) {
      $symbol = rtrim($symbol, ',');    
      $stock = stockapi_load($symbol); 

Added as line 238 of stock.module (Using 5.x.1-dev).

There may need to be some regex checking against the user-inserted strings.

That might happen within stockapi_load(), as there it would be a universal fix.

yhager’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Status: Active » Needs review
FileSize
682 bytes

I was getting the same issue.
Users will not always do as they are requested and might add commas although they are told to use spaces.
The attached patch works for me.

kbahey’s picture

Status: Needs review » Fixed

Committed. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.