I just noticed that when I go to my Mollom settings that I get the following warning

"warning: Invalid argument supplied for foreach() in /home/public_html/sites/all/modules/mollom/mollom.module on line 1785."

From what I can tell, it might have something to do with cycling through CCK fields.

Files: 
CommentFileSizeAuthor
#31 mollom.orphan.31.patch8.42 KBsun
PASSED: [[SimpleTest]]: [MySQL] 5,809 pass(es).
[ View ]
#30 mollom.orphan.30.patch7.25 KBsun
PASSED: [[SimpleTest]]: [MySQL] 6,477 pass(es).
[ View ]
#29 mollom.orphan.29.patch8.21 KBsun
PASSED: [[SimpleTest]]: [MySQL] 6,137 pass(es).
[ View ]
#26 mollom.deleted-forms.26.patch1.81 KBsun
PASSED: [[SimpleTest]]: [MySQL] 6,149 pass(es).
[ View ]
#22 mollom.deleted-forms.22.patch1.78 KBsun
FAILED: [[SimpleTest]]: [MySQL] 5,956 pass(es), 1 fail(s), and 0 exception(s).
[ View ]
#9 mollom-DRUPAL-6--1.cck_.9.patch1.16 KBsun
PASSED: [[SimpleTest]]: [MySQL] 1,500 pass(es).
[ View ]

Comments

sun’s picture

Status:Active» Postponed (maintainer needs more info)

Hm, that's the foreach line in

<?php
function node_mollom_form_info($form_id) {
...
 
// Add CCK fields by default.
 
if (module_exists('content')) {
   
$content_info = content_types($type->type);
    foreach (
$content_info['fields'] as $field_name => $field) {
     
// We only consider text fields for text analysis.
     
if ($field['type'] == 'text') {
       
$form_info['elements'][$field_name] = check_plain(t($field['widget']['label']));
      }
    }
  }
?>

However, looking at CCK's _content_type_info() function, I fail to see how the 'fields' key could ever be not an array.

Do you have any special modules and/or versions and/or patches installed?

Starminder’s picture

Subscribe - getting the same thing here

kirkcaraway’s picture

Same error showing up here as well. Subscribing

sun’s picture

Thanks for subscribing. However, we need more debugging info in order to be able to replicate this bug. Any information you can provide would helpful. Starting from your Drupal core version, potentially applied patches, the version of CCK and Mollom modules, links to any applied patches for them, your web server + version, the version of PHP, the list of other installed/enabled modules, aso.

Starminder’s picture

I was getting it in offline mode for what's it worth.

sparkymark’s picture

me too

sun’s picture

- What kind of an "offline mode"?

- Do you get the same error message as the original poster?

- Do you have a content type that does not use any CCK fields?

Starminder’s picture

- "Maintenance Mode"

- Yes, exactly the same error

- That's a good question, most of mine got updated to include this or that along the way.

sun’s picture

Status:Postponed (maintainer needs more info)» Reviewed & tested by the community
StatusFileSize
new1.16 KB
PASSED: [[SimpleTest]]: [MySQL] 1,500 pass(es).
[ View ]

Although it is technically impossible, here is a patch to avoid this error.

sun’s picture

Version:6.x-1.13» 6.x-1.x-dev

meh.

sun’s picture

#9: mollom-DRUPAL-6--1.cck_.9.patch queued for re-testing.

Dries’s picture

Status:Reviewed & tested by the community» Postponed (maintainer needs more info)

Not going to commit this -- we need to figure out the real bug IMO.

Dave Reid’s picture

Status:Postponed (maintainer needs more info)» Active

I'm also able to reproduce this PHP notice, and I *do* have a anonymous user record in {users}.

Dave Reid’s picture

I have this figured out. I had deleted a content type, but the record for the node type form is still in {mollom_form}. So now when I try to load the admin page, we're trying to invoke cck details about a node type that does not exist. There seems to be no handling of hook_node_type('delete') to clean up when node types are deleted. Once I removed the record from {mollom_form} the PHP notice went away.

Dave Reid’s picture

Title:Warning in Mollom settings» Mollom does not clean up after deleted content types

Retitling

rootwork’s picture

So, was this ever committed?

yktdan’s picture

Upgraded from 1.16 to 2.1 and bug still there. I have probably deleted content types at some point.

rootwork’s picture

Version:6.x-1.x-dev» 6.x-2.1

yktdan, does it give the same line number as the original bug?

I'm changing the version based on your report to see if this can get more attention, but additional data from you would be helpful to confirm that this bug is still active in the 2.x branch.

yktdan’s picture

Yes different line numbers on 2.1
warning: Invalid argument supplied for foreach() in /home/nynjtc/public_html/sites/all/modules/mollom/mollom.module on line 2576.
warning: Invalid argument supplied for foreach() in /home/nynjtc/public_html/sites/all/modules/mollom/mollom.module on line 2576.
warning: Invalid argument supplied for foreach() in /home/nynjtc/public_html/sites/all/modules/mollom/mollom.module on line 2576.
warning: Invalid argument supplied for foreach() in /home/nynjtc/public_html/sites/all/modules/mollom/mollom.module on line 2576.
warning: Invalid argument supplied for foreach() in /home/nynjtc/public_html/sites/all/modules/mollom/mollom.module on line 2576.
warning: Invalid argument supplied for foreach() in /home/nynjtc/public_html/sites/all/modules/mollom/mollom.module on line 2576.
warning: Invalid argument supplied for foreach() in /home/nynjtc/public_html/sites/all/modules/mollom/mollom.module on line 2576.
warning: Invalid argument supplied for foreach() in /home/nynjtc/public_html/sites/all/modules/webform/webform.module on line 3682.
warning: Invalid argument supplied for foreach() in /home/nynjtc/public_html/sites/all/modules/webform/webform.module on line 3693.
warning: Invalid argument supplied for foreach() in /home/nynjtc/public_html/sites/all/modules/mollom/mollom.module on line 2576.
warning: Invalid argument supplied for foreach() in /home/nynjtc/public_html/sites/all/modules/mollom/mollom.module on line 2576.

sun’s picture

Title:Mollom does not clean up after deleted content types» Deleted forms of other modules are not cleaned up
Version:6.x-2.1» 6.x-2.x-dev
Status:Active» Needs review
StatusFileSize
new1.78 KB
FAILED: [[SimpleTest]]: [MySQL] 5,956 pass(es), 1 fail(s), and 0 exception(s).
[ View ]

Attached patch does not automatically clean up forms that have vanished or been deleted, but at least it improves the error reporting on Mollom's form listing page.

In D7, the handling for vanished/deleted forms has been improved already. In D6, the general APIs provided by Drupal core do not really allow for sophisticated maintenance of configuration references.

In any case, I consider this patch just as a first step. If it comes back green, I'm planning to commit to it soonish.

Status:Needs review» Needs work

The last submitted patch, mollom.deleted-forms.22.patch, failed testing.

Max_Headroom’s picture

Status:Needs work» Needs review

#22: mollom.deleted-forms.22.patch queued for re-testing.

Status:Needs review» Needs work

The last submitted patch, mollom.deleted-forms.22.patch, failed testing.

sun’s picture

Status:Needs work» Needs review
StatusFileSize
new1.81 KB
PASSED: [[SimpleTest]]: [MySQL] 6,149 pass(es).
[ View ]

Status:Needs review» Needs work

The last submitted patch, mollom.deleted-forms.26.patch, failed testing.

sun’s picture

Status:Needs work» Needs review

#26: mollom.deleted-forms.26.patch queued for re-testing.

sun’s picture

Title:Deleted forms of other modules are not cleaned up» Orphan forms of other modules cause errors on administration page
Version:6.x-2.x-dev» 7.x-2.x-dev
StatusFileSize
new8.21 KB
PASSED: [[SimpleTest]]: [MySQL] 6,137 pass(es).
[ View ]

Further investigation revealed that #2039155: Notice: Trying to get property of non-object in node_mollom_form_info() was a duplicate of this issue.

Attached patch merges both approaches + ensures that the code base between D7 and D6 stays synced.

sun’s picture

StatusFileSize
new7.25 KB
PASSED: [[SimpleTest]]: [MySQL] 6,477 pass(es).
[ View ]
-  function testFormFieldsConfiguration() {
+  function xtestFormFieldsConfiguration() {

whoopsie ;)

sun’s picture

Version:7.x-2.x-dev» 6.x-2.x-dev
StatusFileSize
new8.42 KB
PASSED: [[SimpleTest]]: [MySQL] 5,809 pass(es).
[ View ]

Backported to D6.

sun’s picture

Version:6.x-2.x-dev» 7.x-2.x-dev
Status:Needs review» Fixed

Thanks for reporting, reviewing, and testing! Committed to all branches.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

Status:Fixed» Closed (fixed)

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

  • Commit c9adb5f on 7.x-2.x, 8.x-2.x, fbajs, actions by sun:
    - #804466 by sun: Fixed Orphan forms of other modules cause errors on...

  • Commit c9adb5f on 7.x-2.x, 8.x-2.x, fbajs, actions by sun:
    - #804466 by sun: Fixed Orphan forms of other modules cause errors on...