Home » Database » DB_DataObject_FormBuilder » Bug #2658
preProcessForm doesn't permanently change form values
Details
| Submitted | 2004-11-01 12:02 UTC |
|---|---|
| From | kljsavage at netscape dot net |
| Assigned | justinpatrin |
| Status | Closed |
| Package | DB_DataObject_FormBuilder |
| PHP Version | 4.3.7 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2004-11-01 12:02 UTC] kljsavage at netscape dot net
Description:
------------
I am using preProcessForm() to generate and md5 digest of the submitted password field, however this is not passed onto the processForm() method. ie. it would appear that the form values array is being passed by value.
Reproduce code:
---------------
function preProcessForm(&$values) {
$password = $values['password'];
if(isset($password)) {
$values['password'] = md5($password);
}
}
Expected result:
----------------
$values['password'] should have the value of md5($password)
Actual result:
--------------
$values['password'] has the original value of $password
[2004-11-01 12:12 UTC] kljsavage at netscape dot net
It appears that changing the call at line 1761 of FormBuilder.php to a call time pass by reference call 'fixes/hacks around' the problem.
[2004-11-02 03:31 UTC] kljsavage at netscape dot net
Thanks, that appears to be the problem. Unfortunately, losing all the get/set methods is going to require a significant amount of refactoring...