Download & Extend

warning: implode() [function.implode]: Bad arguments. in asin.module on line 206.

Project:ASIN Field
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

I believe the fix discussed in Error in asin.module on line 205 (http://drupal.org/node/126436) inadvertently introduced another issue. Since updating to 1.4, ASIN has been throwing an implode error:

warning: implode() [function.implode]: Bad arguments. in PATH/asin.module on line 206.

After reviewing the 1.4 changes and the above issue, it looks to me like the object name was switched mid-line from $product to $asin. In 1.4, lines 205 - 208 read thus:
      if (!empty($product->author)) {
        $output .= '<p class="asin-author">by '. is_array($product->author) ? check_plain(implode(', ', $asin->author)) : check_plain($asin->author) .'</p>';
      }

Those $asin->author calls are the trouble. I believe they should read $product->author.

      if (!empty($product->author)) {
        $output .= '<p class="asin-author">by '. is_array($product->author) ? check_plain(implode(', ', $product->author)) : check_plain($product->author) .'</p>';
      }

That change is resolving the problem in our environment.
Drew

Comments

#1

Thanks for the resolution Drew.

Having the same problem my first step was to switch to the development version but i still had the same problem. After making the two corrections Drew suggests everything works fine.

#2

This seems to work for me as well. I'm including a patch for it.

AttachmentSize
asin.patch 981 bytes

#3

I just want to add my thanks to Drew also. This was driving me crazy!

-David

#4

Title:ASIN 1.4: use of $asin->author vs. $product->author» warning: implode() [function.implode]: Bad arguments. in asin.module on line 206.

Changing the name to make the issue easier to locate.

#5

Version:5.x-1.4» 5.x-1.x-dev

I didn't test it before, but chellman's attached patch doesn't work correctly when the path is different. I've attached a patch that should. I created it against 5.x-1.x-dev, but it applies cleanly to 5.x-1.4.

AttachmentSize
implode-error.patch 1.29 KB

#6

Hi,

The changes suggested by Drew worked fro me. Thanks!!

Imran Khan
Project Manager
New Earth Marketing