I have a relatively clean Drupal install which I started building from scratch yesterday. I've created a block (containing only plain text) and used context_og to create a Context to show the block when I'm in a Group. I've used the "OG - group type context" condition, and set it for the single Group type I currently have - "Client".
Now, when I browse to a "Client" Group, I get a white screen of death. Enabling PHP error messsages gives me the following:
Fatal error: Cannot use object of type OgGroup as array in /home/mark/public_html/seedling.d7.lan/htdocs/sites/all/modules/context_og/plugins/context_og_condition_group_node.inc on line 42
Something else which may be of note - when I enabled context_og, I started getting the following the following warning when editing any Context, repeated 5 times:
Notice: Trying to get property of non-object in context_og_condition_group_node->condition_values() (line 14 of /home/mark/public_html/seedling.d7.lan/htdocs/sites/all/modules/context_og/plugins/context_og_condition_group_node.inc).
For further info on my install, I have attached the results of a phpinfo() file in plain text. The relevant module versions I'm using are all the recommended versions, downloaded with drush (eg drush dl context context_og og
etc.):
- context 7.x-3.0-beta2
- context_og 7.x-1.0
- og 7.x-1.3
Comment | File | Size | Author |
---|---|---|---|
#17 | 1487440-context_og-og_group-as-array.patch | 640 bytes | snufkin |
#4 | context_og-context-7.x-3.x-API_update.patch | 1.6 KB | dman |
phpinfo.txt | 23.78 KB | Mark Nielsen |
Comments
Comment #1
realnerd CreditAttribution: realnerd commentedHi Mark,
I encountered the exact same problem, it was solved for me by installing the latest dev-version (7.x-1.x-dev)
Comment #2
zengenuity CreditAttribution: zengenuity commentedI can confirm that 7.x-1.0 crashes as described. Even after I fixed those specific issues, there were still more problems because 1.0 has code that mixes up node NIDs and group GIDs, trying to do stuff like node_load($gid). It's strange because the latest 1.x-dev is a few month older than 7.x-1.0. Looks like some code from the 6.x series got moved into here somehow.
Regardless, 7.x-1.x-dev from 2011-Nov-22 works for me.
Comment #3
dman CreditAttribution: dman commentedI just got this on the stable. (new site)
I tried shifting to the -dev and while it didn't break any more, the conditions I was hoping to trigger
OG - group type context
* In any group
don't seem to fire.
I also tried the group-node-type option
I'm testing with 'debug' as a reaction.
EDIT: MY BAD. Looks like it was the 1.x/2.x change that got me there. RTFM :-}
Comment #4
dman CreditAttribution: dman commentedNot all my bad.
Same error exists in 7.x-2.x dev.
I had to fix it with the following patch.
THIS PATCH IS FOR 7.x-2.x-dev, but I won't switch the version here, as it's still current on the stable 7.x-1.0
Comment #5
jgraham CreditAttribution: jgraham commentedHi all can you post more details with the versions and issues you are experiencing?
Please note that context_og 2.x is for og 2.x, and context_og 1.x is for og 1.x.
If you are using the corresponding versions please follow up with more details here on the issues you are having.
Comment #6
mrfelton CreditAttribution: mrfelton commentedI got this problem with 1.0. Using 7.x-dev resolves.
Comment #7
jramby CreditAttribution: jramby commentedsame as #6
Comment #8
snufkin CreditAttribution: snufkin commentedIts really easy to reproduce, just create a context, even without any conditions and reactions. Create a group content type: poof error.
The issue is that $group in execute($group) is not an array, but an object.
I tested with context og 7.x-1.0 with og 7.x-1.3
The patch above does resolve this issue however.
Comment #9
veades CreditAttribution: veades commentedThe problem appears to be generated in the
execute($group)
functions in the two condition classes.$group
being passed in is an object so the first if statement with$group['group_type'] =='node'
is throwing the error.I'm debugging my copy. Changing to
$group->entity_type =='node'
seems to be fixing it.Then can get node by:
$node = node_load($group->etid);
Comment #10
dman CreditAttribution: dman commented@veades Um yeah.
See #4 http://drupal.org/files/context_og-context-7.x-3.x-API_update.patch
Comment #11
veades CreditAttribution: veades commentedThanks. Good to know. Sorry I'm new at this. Not sure how to use the patches yet, my bad.
Comment #12
dman CreditAttribution: dman commented@veades
It's no biggie, as soon as anyone works up the courage to actually *look* at a raw patch file (especially a nice simple example like this one) and doesn't go "Z0MG, scary code!" you'll see it's actually pretty damn obvious to see what's going on with the naked eye.
Just look fot the '+' and '-' signs.
Comment #13
pav CreditAttribution: pav commentedSame error on attempting to create a new context accompanied by:
Tried patch in #4 with no result.
Current 7.x-1.x-dev works for me (but not 7.x-2.x-dev).
Comment #14
jgraham CreditAttribution: jgraham commentedFrom my experience and testing I cannot get this bug to trigger with og 2.x and context_og 2.x.
1. The current 1.0 release is bad, it should be 2.0 (if anything) as such I have unpublished it. I messed up the packaging on this and I am terribly sorry for the confusion and problems this has caused.
2. If you are using og 1.x. I can't get the dev release to show up. Maybe because I'm not the primary maintainer, and as such the nightly's for the dev release are not building. http://drupal.org/node/1348756 I will try to get a new 1.1 release out so that you can download this directly and/or get the 1.x-dev release rebuilding properly.
Comment #15
jgraham CreditAttribution: jgraham commentedFor those of you on the 1.x branch can you please test with the 1.x-dev version. Right now the best way to do this is via git.
The following will get the latest 1.x-dev from git for you. Just cd into your modules directory first and remove the existing context_og.
git clone --recursive --branch 7.x-1.x http://git.drupal.org/project/context_og.git
Comment #16
jgraham CreditAttribution: jgraham commentedThe tarball/zip builds of the dev branch should build soon so you should be able to grab those if you wait instead of going the git route.
If you could please postback to indicate if the latest dev builds work for you that would be great.
Comment #17
snufkin CreditAttribution: snufkin commentedI can confirm that using context_og 7.x-2.x-dev throws the error: Cannot use object of type OgGroup as array, but I am using og-7.x-1.3, so I guess thats expected.
While context_og-7.x-1.x-dev throws the following notices:
Notice: Undefined variable: acontext in context_og_condition_group_type->execute() (line 57 of /Users/balu/Sites/pixelpark/sites/all/modules/context_og/plugins/context_og_condition_group_type.inc).
Notice: Trying to get property of non-object in context_condition->condition_met() (line 141 of /Users/balu/Sites/pixelpark/sites/all/modules/context/plugins/context_condition.inc).
Notice: Trying to get property of non-object in context_condition_met() (line 375 of /Users/balu/Sites/pixelpark/sites/all/modules/context/context.module).
Notice: Trying to get property of non-object in context_condition_met() (line 387 of /Users/balu/Sites/pixelpark/sites/all/modules/context/context.module).
This is because on line 57 the variable is misspelled ($acontext instead of $context). Once I fixed that it works fine, so attaching the patch that changes this, so marking it as RTBC.
Comment #18
play4quarters CreditAttribution: play4quarters commentedThanks much to both of you! That cleared up the errors I was seeing as well. Very appreciated.
Comment #19
jgraham CreditAttribution: jgraham commentedThanks for the catch snufkin. This has been committed and a 1.1 release has been made.
Thanks for everyone's patience as we sorted out the issues here.
The 2.x branch will remain without a release until og has a stable release. The API in og is still changing and may break stuff.
Comment #21
jayaram CreditAttribution: jayaram commentedI got this error after updating the entity module. Does this require any fix ?
Comment #22
kclarkson CreditAttribution: kclarkson commentedI too am receiving this error when trying to create a new context.
I updated the entity module to fix another issue.
Comment #23
kclarkson CreditAttribution: kclarkson commentedset to active
Comment #24
St.Ego CreditAttribution: St.Ego commentedOrganic groups 7.x-2.0-rc2
Entity API 7.x-1.0-rc3+11-dev
Context OG 7.x-2.1
Notice: Trying to get property of non-object in context_og_condition_group_node->execute() (line 42)
Line 42 is looking for $group->entity_type (ie: $group as an object), but it is getting an array. Interestingly, line 54, later in the same function, it is looking for $group['gid'], which it would be able to find, if it didn't error out first...
Comment #25
jpwester CreditAttribution: jpwester commentedI'm seeing the same thing.
Organic groups: 7.x-2.0-rc3
Context: 7.x-3.0-beta6
Context OG: 7.x-2.1
Entity API: 7.x-1.0
Comment #26
kclarkson CreditAttribution: kclarkson commentedJust wondering if anybody else is still receiving this error. I have cleared my cache, updated entity api and am still receiving this error.
Here are my errors:
Notice: Trying to get property of non-object in context_og_condition_group_node->condition_values() (line 14 of /sites/all/modules/contrib/context_og/plugins/context_og_condition_group_node.inc).
Notice: Trying to get property of non-object in context_og_reaction_set_group_context->options_form() (line 16 of/sites/all/modules/contrib/context_og/plugins/context_og_reaction_set_group_context.inc).