// Assign all field that are present in the table
foreach ($fieldNames as $field) {
if (isset($data[$field])) {
- // Limit the length of varchar, varbinary, char and binrary fields
+ // Limit the length of varchar, varbinary, char and binary fields
if (is_string($data[$field]) && preg_match("/char\((\d*)\)/", $definition[$table]['fields'][$field]['type'], $result)) {
$data[$field] = mb_substr($data[$field], 0, $result[1]);
} elseif (is_string($data[$field]) && preg_match("/binary\((\d*)\)/", $definition[$table]['fields'][$field]['type'], $result)) {