Howdy Folks!

I started getting this message several times on every Cron run all of a sudden:

warning: Invalid argument supplied for foreach() in /usr/local/apache2/htdocs/horrorviewnet/modules/amazon/amazon.module on line 292.

I updated to the 6.x-1.0-beta7 version, but the error's still there.

I opened the amazon.module file and on line 292 it reads foreach($results->Items->Item as $xml) {

I wouldn't even begin to pretend I knew whether or not something was wrong with that snippet of code! LOL. Any ideas?

The module still seems to work fine for my needs, but, when I see an error, I panic!

Thanks in Advance!
JIM

Comments

7mefree’s picture

I get the same error when I try to test the amazon module.

I've also registred to aws to get the key ids.

my version is amazon-6.x-1.0-beta7 too.

Thanks.

horrorview’s picture

Hmmmm....Now it's not letting me add items to my CCK field. Any help??

jerome72’s picture

I get the same problem on every cron run... Very annoying.

horrorview’s picture

I've discovered a temporary work around. For some reason, emptying the cache, followed by a trip to PHPMyadmin for a more thorough cache clearing, allows me to run cron without seeing the error. From here, I can add the ISBN numbers and have the items post. Eventually, though, the pink block of errors return, and, if I want to add any more items, I need to dump the cache all over again. For the short term, however, this isn't a major issue, as I only post maybe six or seven reviews a week that I feel the need to include an Amazon "buy it" link to.

aharown07’s picture

I began getting this error also as soon as I upgraded to 1.0 beta 7

horrorview’s picture

Yeah, it's sporadic as long as a I do a cache sweep and cron run prior to attempting to add any items. Hopefully someone sees this thread. LOL

asb’s picture

Hi,

I'm encountering a similar and possibly related issue on every Cron run: Amazon items could not be updated. Watchdog (./admin/reports/dblog) doesn't give more information. Issue for that: #572048: Improve "Amazon Items could not be updated" message from cron.

Well, the "Amazon" module still is beta software and, I'm afraid, not yet production ready.

Greetings, -asb

rfay’s picture

Status: Active » Postponed (maintainer needs more info)

What goes on here is it's not always predictable what information is going to come back from Amazon.com. In this case, there are no items.

If you have enough code skill to hack your Amazon module you can get me the information needed to understand this one.

Right before the line in question, you need to put:

if (empty($results->Items->Item)) {
drupal_set_message("Item is empty: " . var_dump($results->Items,TRUE));
}

And post the results. It's probably better to attach a text file with the results in it.

rfay’s picture

Status: Postponed (maintainer needs more info) » Fixed

I do in fact believe this is fixed by http://drupal.org/cvs?commit=270970.

The check to see if there was an error was not correct, so it continued on even with an error.

I'm marking this fixed, and it will be in the next release. I'd appreciate if you'd check the dev release tomorrow and let me know.

Status: Fixed » Closed (fixed)

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

webwriter’s picture

Module unusable for me.

This error received when inputting a test:

warning: Invalid argument supplied for foreach() in /var/www/vhosts/domain.org/httpdocs/sites/all/modules/amazon/amazon.module on line 348.

I tried the beta, upgraded to the dev... the message above says it should be fixed in the current releases.

rfay’s picture

Status: Closed (fixed) » Fixed

@webwriter, this issue was about a cron problem, unrelated to something you may have doing test.

I believe the issue you want is #608624: Test should detect and report invalid credentials. This has turned out to be 2 issues:

1. Invalid credentials in the AWS keys.
2. Webhost blocking access to Amazon.

Status: Fixed » Closed (fixed)

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