$data[$field] = mb_substr($data[$field], 0, $result[1]);
} elseif (is_string($data[$field]) && preg_match("/binary\((\d*)\)/", $definition[$table]['fields'][$field]['type'], $result)) {
$data[$field] = substr($data[$field], 0, $result[1]);
+ } elseif (is_numeric($data[$field]) && $definition[$table]['fields'][$field]['type'] === 'int') {
+ $data[$field] = min(max((int)$data[$field], -2147483648), 2147483647);
+ } elseif (is_numeric($data[$field]) && $definition[$table]['fields'][$field]['type'] === 'int unsigned') {
+ $data[$field] = min(max((int)$data[$field], 0), 4294967295);
}
$fields[$field] = $data[$field];
}