PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB_DataObject_FormBuilder » Bug #2658

preProcessForm doesn't permanently change form values

Details

Submitted2004-11-01 12:02 UTC
Fromkljsavage at netscape dot net
Assignedjustinpatrin
StatusClosed
PackageDB_DataObject_FormBuilder
PHP Version4.3.7
OSLinux
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...