[Formsess-devel] possible assign force bug
Status: Beta
Brought to you by:
mrkatana
|
From: Zilvinas S. <ar...@es...> - 2004-06-13 12:36:43
|
Hello,
I was trying to do the following:
$new = $this->module->getNew($gid);
$fs->reset();
$fs->assignArray($new);
$fs->assign('body', preg_replace('!<br.*>!iU', "", $fs->get_value('body')), true);
Reassigning the body does not work in 2.0.0-pre. The assign function is in this chain:
assign->_save_fields->_read_field_value
In the read_field_value:
// first check within the cached values so that we don't read twice
if (isset($this->_fieldvalues[$field])) {
return $this->_fieldvalues[$field];
}
This couses the problem. I was able to fix this by adding an elseif under the first if sentence:
// If overwrite was not asked, we test if a value exists
if (!$force && (isset($this->_sess_space['values'][$field]) && !empty($this->_sess_space['values'][$field]))) {
return;
}
elseif ($force && isset($this->_fieldvalues[$field]))
{
unset($this->_fieldvalues[$field]);
}
Maybe i fooled my self and this is not a bug and i don't know something :) Please tell me.
Bye
|