| Project: | Drupal Commons |
| Version: | 7.x-3.x-dev |
| Component: | Posts |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Just did a fresh install of the latest Commons 7 dev (dated Jan 10) and got this when I went to create a new Post:
Warning: Invalid argument supplied for foreach() in og_field_widget_form() (line 69 of /home/clients/websites/w_comm7/public_html/comm7/profiles/commons/modules/contrib/og/includes/og.field.inc).
Warning: Invalid argument supplied for foreach() in entityreference_field_widget_form() (line 815 of /home/clients/websites/w_comm7/public_html/comm7/profiles/commons/modules/contrib/entityreference/entityreference.module).
Warning: Invalid argument supplied for foreach() in entityreference_field_widget_form() (line 815 of /home/clients/websites/w_comm7/public_html/comm7/profiles/commons/modules/contrib/entityreference/entityreference.module).
Comments
#1
On creation of the Post I got two more warning/notices:
Warning: Invalid argument supplied for foreach() in commons_radioactivity_incident_groups() (line 140 of /home/clients/websites/w_comm7/public_html/comm7/profiles/commons/modules/contrib/commons_radioactivity/commons_radioactivity.module).
Notice: Undefined variable: gids in commons_radioactivity_incident_groups() (line 144 of /home/clients/websites/w_comm7/public_html/comm7/profiles/commons/modules/contrib/commons_radioactivity/commons_radioactivity.module).
#2
It looks like some of the errors were already reported: #1837308: Error (unable) in creating New posts
But I'm confused about if there is a fix or not. It is marked as a duplicate of another issue which I am not clear as to whether or not there is a fix for it. The referenced issue is confusing with all of the duplicate references and stuff on it.
As previously mentioned I'm using the latest dev release on a clean install: Commons (commons-7.x-3.0-beta1+14-dev)
#3
@jlea9378, yes it is kind of confusing. I followed the links and it looks like there is a new patch for OG groups. The patch might still need to be reviewed, but I didn't see the new patch after the last patch failed automated testing, so we might have to wait for a release.
#4
ohh it is the patch on here you are referring to I think: #1845050: reference field set to "Autocomplete (Tags style)" not returning any matches
Thanks.
#5
I tried to apply the patch but it said "Reversed (or previously applied) patch detected!". So does the Jan10th dev release already include this patch?
#6
Yeah, sorry about that. I had checked the link again and it said "fixed," and not "needs review." It looks like the patch was applied to Organic Groups 7.x-2.x on Jan 03, so Commons Jan 10 should have it.
#7
Anyone know how to get rid of these errors?
#8
There are 2 elements to this:
1) The og widget isn't testing for if there are actually targets, and running a foreach on a variable that is not an array. I posted a patch over there for that: #1895270: Error when creating content outside of a group.
2) After submitting content without a group associated, commons_radioactivity does something similar. (Even after the patch above is applied)
Attached is a patch for commons_radioactivity that add a test for the array before it runs the foreach.
#9
Updating title to reflect the issue.
#10
We actually do:
<?php// If this node is a member of groups, generate an incident for each group.
if (!empty($node->og_group_ref)) {
commons_radioactivity_incident_groups($node, $value);
}
?>
But this should be a check of
<?phpif (!is_array($node->og_group_ref[LANGUAGE_NONE])) {
?>
Marking "needs work" so we can have a single check for this code. This would likely be resolved in the larger, longer term cleanup effort by #1804888: Commons_radioactivity.module contains group-specific functionality.
#11
For what it's worth, I'm unable to recreate the issue on a newly built Commons site, based on the latest dev release. I was able to add new test posts to the site without any errors, both with and without Groups assigned to the posts.
#12
I get an error when I try to download the latest commons. Looks like there is already an open issue for that though.
#13
@jlea9378, is that using Drush? I just downloaded TTW today.
#14
No, the link on the project page for dev tar.gz file. It didn't work yesterday but now it is working.
#15
Please re-open if you're able to reproduce with the latest nightly dev snapshot.
#16
Automatically closed -- issue fixed for 2 weeks with no activity.