Home » Database » DB_DataObject_FormBuilder » Bug #6980
processForm() saves original after preProcessFormCallback(), which is wrong
Details
| Submitted | 2006-03-01 18:46 UTC |
|---|---|
| From | vl dot homutov at gmail dot com |
| Assigned | justinpatrin |
| Status | Closed |
| Package | DB_DataObject_FormBuilder |
| PHP Version | Irrelevant |
| OS | Gentoo |
| Roadmaps | (Not assigned) |
Comments
[2006-03-01 18:46 UTC] vl dot homutov at gmail dot com
Description:
------------
file Formbuilder.php:2551 contains:
$origDo = clone($this->_do);
which is used to save 'original' state of object, before processing. But object can be changed in preProcessForm, which causes some fields not to update in database.
Solution is to call the line above before preProcessFormCallback.
Test script:
---------------
what is the reason to change DO in preProcessFormCallback()?
imagine a table with users, storing among other, passwords. Password is md5 hash and also there is field, named 'salt', containing random string to ensure password randomness.
we don`t want 'salt' to be on the form and we want it to be generated before going to database.
since 'salt' field is not in 'fb_fieldsToRender', it is not shown on a form and not gets submitted.
Because in preProcessFormCallback 'original' object saved after modification(made in preProcess), field we changed not gets updated.
Expected result:
----------------
successfull update of 'salt' field.