og_nodeapi('validate') warning: array_filter(): The first argument should be an array in og.module on line 1211
markus_petrux - September 19, 2009 - 01:08
| Project: | Organic groups |
| Version: | 6.x-2.x-dev |
| Component: | og.module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
This PHP notice happens when submitting a node edit form for content types not related to OG groups. The reason is the $form['og_groups'] element is not populated for this kind of content types. But the fix is pretty simple:
<?php
- $og_groups_filtered = array_filter($node->og_groups);
+ $og_groups_filtered = isset($node->og_groups) ? array_filter($node->og_groups) : array();
?>
#1
Actually, there's a better way.
#2
This PHP notice happens when OG is installed and a node of a type not related to OG is saved, which is a little bit annoying.
Is there any problem with the patch in #1? :-/
#3
Seems to be working fine so far on my 2 og sites. It's a tiny change and matches the 'proper' way to avoid such notices. I say go for it.
#4
+1 to commit
#5
It works fine!
+1 to commit
#6
OK for me
+1
#7
This does not work for me :(
#8
committed. thx.
#9
Automatically closed -- issue fixed for 2 weeks with no activity.