Invalid argument supplied for foreach() in ../sites/all/modules/autotag/autotag.functions.inc on line 193

Getting a lot of these, thanks

CommentFileSizeAuthor
#6 autotag-issue_695120.patch1.6 KBdman

Comments

chrisbuck’s picture

Same problem. Following.

interx’s picture

In autotag.functions.inc on line 193 :

      foreach($_POST['files'] as $fid => $file_details){
        db_query("UPDATE {upload} SET description = '%s', weight = %d, list = %d WHERE fid = %d AND nid = %d AND vid = %d", $file_details['description'], $file_details['weight'], $file_details['list'], $fid, $node->nid, $node->vid);
      }

Just tried this module and encountered the same issue.
Just delete or commenting this block (or ad a check on $_POST['files']).

It is quite strange in the first place why a tagging module updates the upload table.
Also, it doesn't check if the "upload" module is installed, bypasses it's permissions and gets executed on an update of every node type.
Imo the entire update case should be removed or get a comment why it's needed.

Starminder’s picture

interX - Thanks for a simple fix, is there any reason why this little tweak would make my admin menu disappear?

christopherareed’s picture

Same problem.

tobiberlin’s picture

subscribing, same here. Commenting the block solved the error message and nodes are still automatically tagged.

dman’s picture

Version: 6.x-1.27 » 6.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new1.6 KB

Simple patch, and a fix for a warning elsewhere - wrong arguments to variable_get()

oldmoonlake’s picture

After applying the patch, following warning shows up whenever editing any node that is supposed to be autotagged.

warning: preg_match() expects parameter 2 to be string, array given in /home/sirnoa/public_html/includes/bootstrap.inc on line 777.

iantresman’s picture

I initially thought I received this error message, because I had no taxonomy defined. Then I defined one vocabulary and one term, but get the error message:

   * warning: Missing argument 2 for variable_get(), called in /home/public_html/sites/all/modules/autotag/autotag.form_alter.inc on line 46 and defined in /home/public_html/includes/bootstrap.inc on line 502.
    * warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/public_html/sites/all/modules/autotag/autotag.form_alter.inc on line 46.
    * warning: Invalid argument supplied for foreach() in /home/public_html/sites/all/modules/autotag/autotag.form_alter.inc on line 89.

I have no boxes checked in the Autotag settings.

sposob’s picture

i had exactly the same problem, but the patch from #6 took actually care of everything. i didn't get another mistake and it works now.

sdrycroft’s picture

Version: 6.x-1.x-dev » 6.x-2.0
Status: Needs review » Fixed

This should be fixed in v2 of the code, apologies for not getting round to this sooner.

Status: Fixed » Closed (fixed)

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