Closed (fixed)
Project:
Comment Notify
Version:
5.x-1.3
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Nov 2007 at 21:30 UTC
Updated:
9 Feb 2008 at 03:21 UTC
Jump to comment: Most recent file
Comments
Comment #1
michal.cihar commentedAttaching patch which fixes this issue for me.
Comment #2
curtbeckmann commentedI think I encountered this same issue, but not 100% sure. Still, I thought it fair to add the full error message that I received:
* warning: Invalid argument supplied for foreach() in /home/.jong/curtbeckmann/worldenhancing.org/forums/drupal-5.1/modules/node/node.module on line 521.
* warning: implode() [function.implode]: Bad arguments. in /home/.jong/curtbeckmann/worldenhancing.org/forums/drupal-5.1/modules/node/node.module on line 525.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in /home/.jong/curtbeckmann/worldenhancing.org/forums/drupal-5.1/includes/database.mysql.inc on line 172.
For experienced folks like michal.cihar, this may not be necessary.
I shall go attempt Michal's patch (if there is enough documentation on patch installation :-))
Comment #3
curtbeckmann commentedI attempted the patch (actually, did it manually using VI after saving the original file), and seems to fix my problem, so I guess it was the same problem :-)
(I used "reply" this time, so I hope my note is indented...sorry about entering my last comment the wrong way)
Comment #4
gregglesIt appears this was fixed in the latest commit http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/comment_not...
Comment #5
junyor commented@greggles: That's the commit that *introduced* this issue!
Comment #6
gregglesHa, right. I was thinking the reverse. Sorry!
Comment #7
gregglesWell, actually I think this depends on some other factors, perhpas, like whether you are using comment moderation or not. I use comment moderation and when my $comment variable gets there it is an object.
When I apply the patch as proposed in #1 (actually, slightly modified to use '' around the array keys) and then go to admin/content/comment/list/approval I get the error
So....if someone can test this out then I will commit it (cristoph gave me commit access so I can help out with things like this)
Comment #8
junyor commentedI haven't tested, but I had a look at the code. I don't think this is the correct solution. The $comment variable comes from
hook_comment(). The documentation forcomment_invoke_comment()says the $comment variable is "A comment object". I've checked around in comment.module and this doesn't really seem to be consistent. In other words, I think the correct fix is to getcomment_invoke_comment()to always send an object rather than having every module have to convert to object just in case. Fixing this in core will probably be a bit tricky, though, since the casting can't be done incomment_invoke_comment()since the $comment variable is passed by reference. It'll have to be done in each function that callscomment_invoke_comment(), as far as I can tell.I'm not sure it even makes sense for the $comment variable to be passed by reference.
comment_invoke_comment()doesn't pass the variable to the functions it calls by reference, so it's a dead end. The casting probably could be done incomment_invoke_comment()if the pass by reference is removed.That said, the patch in #7 does solve the PHP error, so it's an acceptable work-around for now.
Comment #9
junyor commentedComment #10
gregglesCool - thanks for the review. In php5 all objects are always passed by reference which often causes unintended problems. I guess that given that it could be passed by reference all the way down we should be doing a drupal_clone first and then the cast.
Comment #11
gregglesI applied this to DRUPAL-5. I realized we don't need to worry about cloning because: if it's passed as an array, it's not by reference and that's no problem. If it is passed as an object then it's already an object and the cast doesn't change anything. Sweet.
Comment #12
gabiroba commentedHi, I fell it is a bit confusing. I have the problem described in the first post and I'm not a PHP coder.
So can anyone explain me what I should do?
Thanks in advance.
Gabriela
Comment #13
gregglesI suggest you try the 5.x-1.x-dev release of this module. Let us know if that fixes it for you (or not).
Comment #14
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.