Closed (fixed)
Project:
Documentation
Component:
API documentation files
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 Feb 2010 at 14:09 UTC
Updated:
3 Jan 2014 at 01:08 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jmcclelland commentedI've found the same problem.
The attached patch fixes it.
jamie
Comment #2
jhodgdonWhere is this documentation that says it should be passed by reference?
Comment #3
yakoub commentedhttp://api.drupal.org/api/drupal/developer--hooks--core.php/function/hoo...
Comment #4
jhodgdonI don't see a problem here.
If you define
mymodule_comment(&$edit, $a2)
then you will receive $edit by reference.
I'm closing this... feel free to reopen and explain the problem you are seeing, if there is a problem.
Comment #5
yakoub commentedhere is the code from line 1184
comment_validate receives a copy of $edit , and calls hook_comment($edit,'validate');
if i declare mymodule_comment(&$edit..); , i receive a reference to a copy that comment_validate received
and not the original $edit array that will be saved latter
Comment #6
yakoub commentedi am not sure how to "reopen" , hope i got it right
Comment #8
jhodgdonAh, ok. Good catch. This does need a documentation fix (not a code fix -- we don't change the behavior of the code in Drupal 6 except for major problems, and this isn't one).
The doc for hook_comment() currently says:
"validate": The user has just finished editing the comment and is trying to preview or submit it. This hook can be used to check or even modify the comment. Errors should be set with form_set_error().
The part about "or even modify" needs to be removed.
Comment #9
jack.r.abbit commentedARGH! Doc is still not changed. I wish I'd found this ticket before banging my head against the problem for a bit. I need to modify the comment after submit and was sooooo happy to have the docs tell me it was simple. The doc lies. :)
Comment #10
jhodgdonSomeone needs to create a patch and then it can be fixed in the doc...
Comment #11
barbi commentedComment #13
jhodgdonThe patch is fine. It failed to apply because the file it is patching is currently part of the Documentation project in D6, not the Drupal Core project. Needs to be committed to the Doc project.
Comment #14
jn2 commentedThis is fixed, patch committed to the D6 docs. (It may take a little while to show up.)