Fixed bug #5618: Wrong cropping of multi-byte $TCA field (credits Michael Miousse)
authorIngo Renner <ingo.renner@typo3.org>
Fri, 27 Feb 2009 16:02:00 +0000 (16:02 +0000)
committerIngo Renner <ingo.renner@typo3.org>
Fri, 27 Feb 2009 16:02:00 +0000 (16:02 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5096 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tcemain.php

index 7b16e9f..beb480a 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@
        * Fixed bug #10210: Admin tools > User Admin icons point to wrong user in Opera browser (credits David Steeb)
        * Fixed bug #10259: Link to CLI Script in Check DP->ReferenceIndex Script is wrong (credits Daniel Krupke)
        * Fixed bug #10560: element browser title length is hardcoded
+       * Fixed bug #5618: Wrong cropping of multi-byte $TCA field (credits Michael Miousse)
 
 2009-02-27  Francois Suter  <francois@typo3.org>
 
index e77ac10..a500021 100755 (executable)
@@ -1354,8 +1354,10 @@ class t3lib_TCEmain      {
        function checkValue_input($res,$value,$tcaFieldConf,$PP,$field='')      {
                list($table,$id,$curValue,$status,$realPid,$recFID) = $PP;
 
-                       // Secures the string-length to be less than max. Will probably make problems with multi-byte strings!
-               if (intval($tcaFieldConf['max'])>0)     {$value = substr($value,0,intval($tcaFieldConf['max']));}
+                       // Secures the string-length to be less than max.
+               if (intval($tcaFieldConf['max']) > 0) {
+                       $value = $GLOBALS['LANG']->csConvObj->substr($GLOBALS['LANG']->charSet, $value, 0, intval($tcaFieldConf['max']));
+               }
 
                        // Checking range of value:
                if ($tcaFieldConf['range'] && $value!=$tcaFieldConf['checkbox'])        {       // If value is not set to the allowed checkbox-value then it is checked against the ranges