[TYPO3-core] RFC: #5618: Wrong cropping of multi-byte $TCA field
Michael Miousse
mmiousse at infoglobe.ca
Thu Feb 5 15:03:07 CET 2009
Hi.
This is an SVN patch request.
Type: Bugfix
Bugtracker reference: http://bugs.typo3.org/view.php?id=5618
Branches: trunk (revision 4950)
Problem:
Error while croppring a multi-byte field content on the save in tcemain.
Solution:
use $LANG->csConvObj->substr other than plain old substr
--
cheers,
Michael Miousse
Index: t3lib/class.t3lib_tcemain.php
===================================================================
@@ -1355,8 +1355,11 @@
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']));}
-
+ if (intval($tcaFieldConf['max'])>0)
+ {
+ global $LANG;
+ $value = $LANG->csConvObj->substr($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
if (isset($tcaFieldConf['range']['upper'])&&
$value>$tcaFieldConf['range']['upper']) {$value=$tcaFieldConf['range']
['upper'];}
More information about the TYPO3-team-core
mailing list