node_validate is called once by node_form_validate, then again by node_form_execute. This is cruft from long ago, and can cause problems with node module altering the node twice on hook_validate. The root problem is that hook_validate is used to both validate and set form errors, and also alter the node object before node_save. This patch decouples the two operations, so that hook_validate only is used to validate form fields and set form errors, and a new node module hook hook_execute is called to allow node modules to alter the node object prior to node_save. This issue is even more apparent with the new form api, where you have two distinct validate and execute functions. Node modules will need to be updated if they modify the node object on hook_validate.
Comment | File | Size | Author |
---|---|---|---|
#2 | strip_tags_by_default.diff | 2.05 KB | adrian |
#1 | node_validate.patch | 11.37 KB | crunchywelch |
node_42.patch | 4.9 KB | crunchywelch | |
Comments
Comment #1
crunchywelch CreditAttribution: crunchywelch commentedHere is a patch which includes the required changes to the affected core node modules. Most just removed the pass by refernece of the node object on hook_validate
Comment #2
adrian CreditAttribution: adrian commented+1
Aaron is right, the only reason the function is called twice is cruft related.
Comment #3
adrian CreditAttribution: adrian commentedThat was weird. i meant to upload that patch to a issue on another tab. did i upload it to the wrong one, or did it pick it out of the session ?
Comment #4
Steven CreditAttribution: Steven commentedCommitted to head.
Comment #5
(not verified) CreditAttribution: commented