Commit 7b6aeb81 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fixes #13030 - line endings \r\n has been counted as two chars. During input...

Fixes #13030 - line endings \r\n has been counted as two chars. During input they are counted as 1 and therefore on data load the string has been cutted.
parent 7e3c677a
Pipeline #5466 passed with stages
in 6 minutes and 19 seconds
......@@ -18,10 +18,10 @@ use IMATHUZH\Qfq\Core\Helper\KeyValueStringParser;
use IMATHUZH\Qfq\Core\Helper\Ldap;
use IMATHUZH\Qfq\Core\Helper\Logger;
use IMATHUZH\Qfq\Core\Helper\OnArray;
use IMATHUZH\Qfq\Core\Helper\OnString;
use IMATHUZH\Qfq\Core\Helper\Path;
use IMATHUZH\Qfq\Core\Helper\Sanitize;
use IMATHUZH\Qfq\Core\Helper\Support;
use IMATHUZH\Qfq\Core\Helper\OnString;
use IMATHUZH\Qfq\Core\Report\Link;
use IMATHUZH\Qfq\Core\Report\Report;
use IMATHUZH\Qfq\Core\Store\Sip;
......@@ -1346,8 +1346,11 @@ abstract class AbstractBuildForm {
}
if ($formElement[FE_MAX_LENGTH] > 0 && $value !== '') {
// Check if there are \r\n > those should be counted as one char, not two. #13030
$crlf = substr_count($value, "\r\n");
$max = $formElement[FE_MAX_LENGTH] + $crlf;
// crop string only if it's not empty (substr returns false on empty strings)
$value = mb_substr($value, 0, $formElement[FE_MAX_LENGTH]);
$value = mb_substr($value, 0, $max);
}
if ($formElement[FE_HIDE_ZERO] != '0' && $value == '0') {
......@@ -2465,7 +2468,7 @@ abstract class AbstractBuildForm {
private function getSubrecordColumnControl(array $titleRaw) {
$control = array();
foreach ($titleRaw AS $columnName) {
foreach ($titleRaw as $columnName) {
switch ($columnName) {
case SUBRECORD_COLUMN_ROW_CLASS:
......
Markdown is supported
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