FIX sanitize must allow space on attribute (#30566)

sanitize must allow space on attribute

otherwhise  "on update CURRENT_TIMESTAMP" for tms fields goes wrong
This commit is contained in:
Charlène Benke 2024-08-11 00:02:05 +02:00 committed by GitHub
parent 1c0e738617
commit 1a3dddb3cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -853,7 +853,7 @@ class DoliDBMysqli extends DoliDB
$sqlfields[$i] .= "(".$this->sanitize($field_desc['value']).")";
}
if (isset($field_desc['attribute']) && $field_desc['attribute'] !== '') {
$sqlfields[$i] .= " ".$this->sanitize($field_desc['attribute']);
$sqlfields[$i] .= " ".$this->sanitize($field_desc['attribute'], 0, 0, 1); // Allow space to accept attributes like "ON UPDATE CURRENT_TIMESTAMP"
}
if (isset($field_desc['default']) && $field_desc['default'] !== '') {
if (in_array($field_desc['type'], array('tinyint', 'smallint', 'int', 'double'))) {