Getting a Notice: Undefined variable: addthis_share in AddThisScriptManager->getJsAddThisShare() (line 240 of CONTRIB_MODULE_PATH/addthis/classes/Services/AddThisScriptManager.php).
when I visit a node that has the addthis block placed on it.
Patch that checks if the variable is set is attached.

CommentFileSizeAuthor
#2 undefined_variable-2655316-1.patch458 bytescarsonblack
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

carsonblack created an issue. See original summary.

carsonblack’s picture

SocialNicheGuru’s picture

Status: Active » Needs review
gisle’s picture

Status: Needs review » Postponed (maintainer needs more info)

I understand what your patch does (i.e.: it checks if the $addthis_share array has been set and does not return a value if it hasn't, thereby making the error notice go away).

However, I am not sure if returning nothing in this case is correct behavior. From reading the code it looks like returning an empty array would be more correct.

Can you provide some additional information about the steps required to trigger this error on a clean install. I want to make sure that making the function return nothing does not create other problems in the module.