Closed (fixed)
Project:
Drupal core
Version:
6.x-dev
Component:
user system
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Jul 2007 at 18:15 UTC
Updated:
30 Aug 2007 at 10:02 UTC
Jump to comment: Most recent file
Comments
Comment #1
gábor hojtsyAs far as I see, this gets invoked with
comment_invoke_comment($comment, 'view')(without caring about the return value), and comment_invoke_comment() takes $comment by reference and passes it on, so user_comment() can modify it. This code also needs a fix in the function comment, as far as I see.Comment #2
dvessel commentedBut nothing is passed by reference here. This looks dangerous. Marking as critical.
Comment #3
dvessel commentederr, sorry about that.
Finally checked and it isn't an issue. I'm quite baffled on how this works.
Comment #4
dvessel commentedOkay, one more time. Checked the output of comment_invoke_comment(). With user_comment() returning nothing comment_invoke_comment also returns nothing.
This patch just returns a value for user_comment making comment_invoke_comment work as expected.
The signature is getting cleaned up elsewhere before output under comments which confused me.
Comment #5
dvessel commentedMore appropriate title?
Comment #6
gábor hojtsyWell, my observations above showed that &$comment should be used, as we get the comment to modify. Trace through the path I explained. The function also needs a fix in the phpdoc comment.
Comment #7
dvessel commentedOkay, I see now that it has to be passed as reference in "user_comment(&$comment, $op)". It looks like it's optional depending on what the hook is doing.
But this is really bizarre. Even when *not* passing as reference, it gets cleaned. I even tried removing the reference inside comment_invoke_comment just to see and it still gets cleaned. Also tried removing user_comment. It didn't clean the sig so that tells me that that's the only place it's cleaning up the sig..
I think I'll leave this one alone. I didn't think this was possible.
Comment #8
dvessel commentedYou were right Gábor Hojtsy, but I didn't know why. I just learned that objects always gets passed by reference in these cases for PHP5.
So here it is so it'll work in php4 also.
Comment #9
dvessel commentedWhoops, phpdoc fixed.
Comment #10
gábor hojtsyThanks, committed!
Comment #11
(not verified) commented