I created a field with the type enum('one', 'two', 'three') and tested it with both NULL and NOT NULL. The field was displayed as a dropdown list, and in one test I obtained the values using
function _cm_getValRep ($item='', $where)
{
if ($item == 'enum_test') {
$array = $this->getEnum($item);
return $array;
} // if
}
and in another test using
function _cm_getValRep ($item='', $where)
{
if ($item == 'enum_test') {
$array['one'] = 'un';
$array['two'] = 'deux';
$array['three'] = 'trois';
return $array;
} // if
}
In neither test did I have the need to change line 111 to
if (!in_array($fieldvalue, $enum, true))
I did see, however, the need to insert
before
default:
// perform validation if field type is numeric (integer, decimal)
$fieldvalue = $this->validateNumber($fieldname, $fieldvalue, $fieldspec);
} // switch
I also found and fixed a problem in file 'include.xml.php4/5.inc' which inserted a blank entry into the lookup array even if there was one already there. My changed files are attached.