PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject_FormBuilder » Bug #6980

processForm() saves original after preProcessFormCallback(), which is wrong

Details

Submitted2006-03-01 18:46 UTC
Fromvl dot homutov at gmail dot com
Assignedjustinpatrin
StatusClosed
PackageDB_DataObject_FormBuilder
PHP VersionIrrelevant
OSGentoo
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.