Commit eecf5e01 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'B3850-change-set-maxlength' into 'master'

B3850 - Change set input maxlength - refs #3850, closes #3850

See merge request !105
parents d536b47b 69f3eac4
Pipeline #1008 passed with stage
in 1 minute and 39 seconds
......@@ -1093,27 +1093,34 @@ class Support {
}
/**
* Get the strlen of the longest element in enum('val1','val2',...,'valn') or set('val1','val2',...,'valn')
* Get the strlen of the longest element in enum('val1','val2',...,'valn')
* or the maximum total length of a set('val1','val2',...,'valn')
*
* @param string $typeSpec
*
* @return int
*/
private static function maxLengthSetEnum($typeSpec) {
$startPos = (substr($typeSpec, 0, 4) === 'set(') ? 4 : 5;
$isSet = substr($typeSpec, 0, 4) === 'set(';
$startPos = $isSet ? 4 : 5;
$max = 0;
$valueList = substr($typeSpec, $startPos, strlen($typeSpec) - $startPos - 1);
$valueArr = explode(',', $valueList);
foreach ($valueArr as $value) {
$value = trim($value, "'");
$len = strlen($value);
if ($len > $max) {
$max = $len;
if ($isSet) { // set
return strlen(implode(', ', $valueArr));
} else { // enum
foreach ($valueArr as $value) {
$value = trim($value, "'");
$len = strlen($value);
if ($len > $max) {
$max = $len;
}
}
}
return $max;
return $max;
}
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment