Problem/Motivation
Webform elements and handlers "preSave" method are called twice in WebformEncryptSubmissionStorage::doPreSave()
.
This is because they are first called on parent::doPresave()
and then at the end of the method too.
Proposed resolution
The best solution could be to let the parent class running the preSave, so handlers in pre-save can benefit from having unencrypted values.
We then encrypt after the parent::doPreSave
has ran, so anything accessing the value after that will see encrypted data.
Remaining tasks
Validating if there is a reason for double running, otherwise fix the issue. Adding test coverage would be ideal.
User interface changes
Nope.
API changes
No, if double running is unwanted. Otherwise this should be documented.
Data model changes
No.
Comment | File | Size | Author |
---|---|---|---|
#7 | 2943469-7.patch | 6.05 KB | gambry |
| |||
#7 | interdiff-3-7.txt | 1.52 KB | gambry |
Comments
Comment #2
gambryThis is the incriminated bit from
WebformEncryptSubmissionStorage::doPreSave()
:Comment #3
gambryAttached test-only - to demonstrate the issue - and full patch.
Comment #5
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedThanks @gambry I have done some thinking/digging, and I don't see why would we want to run these twice.
Would it make sense to name this something more specific, say
test_webform_handler_presave_counter
? We we may want to track other things in the future.Comment #6
gambryIt totally does make sense. I will do the change ASAP.
Tagging OpenSourceSprint as I've done the work during the event.
Comment #7
gambryPatch addressing #5 attached.
Comment #9
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedCommitted, thanks!