mirror of
https://github.com/friendica/friendica
synced 2024-11-19 09:03:42 +00:00
Separate the char from the binary handling
This commit is contained in:
parent
da8d5f5015
commit
4d4544ada3
1 changed files with 3 additions and 1 deletions
|
@ -242,8 +242,10 @@ class DBStructure
|
||||||
foreach ($fieldnames as $field) {
|
foreach ($fieldnames as $field) {
|
||||||
if (isset($data[$field])) {
|
if (isset($data[$field])) {
|
||||||
// Limit the length of varchar, varbinary, char and binrary fields
|
// Limit the length of varchar, varbinary, char and binrary fields
|
||||||
if (is_string($data[$field]) && preg_match("/[char|binary]\((\d*)\)/", $definition[$table]['fields'][$field]['type'], $result)) {
|
if (is_string($data[$field]) && preg_match("/char\((\d*)\)/", $definition[$table]['fields'][$field]['type'], $result)) {
|
||||||
$data[$field] = mb_substr($data[$field], 0, $result[1]);
|
$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]);
|
||||||
}
|
}
|
||||||
$fields[$field] = $data[$field];
|
$fields[$field] = $data[$field];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue