Non-object error - hack to get round it
jo1ene - June 28, 2007 - 22:23
| Project: | NodeReview |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
On submitting and editing review node. Not on preview. Two for each axis defined:
warning: Attempt to assign property of non-object in /www/modules/contrib/nodereview/nodereview_node_nodereview.inc on line 282.
Latest versions of everything. It didn't do this when I first added the dummy review in question. I did add a new axis in between first creting said dummy review and editing it when I got this error. Tried deleting node and starting over.
Related?
http://drupal.org/node/150213

#1
I'm having the same problem now I've added a new axis
#2
Last night's last ditch effort: I deleted the node. Uninstalled both the nodereview and votingapi modules - with the uninstall tab and everything. Then I reinstalled everything. Defined my desired six axes, created a review, and I still get the same problem. This time I did NOT defines 5 axes, submit a review node, then define another axis like last time. The data is saved and everything. I get the errors on creation and editing.
#3
I tried the same - even deleted the tables and then re-installed them and I still get the error too
#4
I got my husband to have a look as he knows lots more than me - he managed to hack it so it works for me - here's what he said and did:
He made the following change:
# diff nodereview_node_nodereview.inc nodereview_node_nodereview.inc.original.20070726
282,284c282
< if(is_object($node->reviews[$aids[$i]]->review)) {
< $node->reviews[$aids[$i]]->review = check_markup($node->reviews[$aids[$i]]->review);
< }
---
> $node->reviews[$aids[$i]]->review = check_markup($node->reviews[$aids[$i]]->review);
He Says:
I suspect that this is a filthy hack that is working around something more serious underneath, but the data structures are quite complicated with the axes, versions, metadata, and all! Couldn't really understand whether I fixed it properly, but at least the errors have gone away now and it seems to accept edits.
So, goodness Knows whether my database is getting in an awful mess or not - but at least I can use the functionality which is great
Regards
Debs
#5
I had different code in my version. I didn't have the if statement mentioned in #4:
<?php// Do a markup check on the fields
for ($i=0; $i < $num_aids; $i++) {
$node->reviews[$aids[$i]]->review = check_markup($node->reviews[$aids[$i]]->review);
}
?>
So I added it and it works for me:
<?php// Do a markup check on the fields
for ($i=0; $i < $num_aids; $i++) {
if(is_object($node->reviews[$aids[$i]]->review)) {
$node->reviews[$aids[$i]]->review = check_markup($node->reviews[$aids[$i]]->review);
}
}
?>
#6
I'm getting the error too
"warning: Attempt to assign property of non-object in"
Is there a final solution/suggestion to fix this ?
#7
On solution would be to turn off error reporting to the screen. But that would not be elegant...