Bug #23541
closedHeadline in non latin charsets will break after 100 - substr is not multibyte safe use mb_substr instead
0%
Description
Expperienced on T4.1, but should be the same in 4.2,4.3 and 4.4
Creating grafic headlines gives problems with non latin charsets, breaks in between, because of the use of substr, and then displays chars which do not belong to the language.
Example TS:
styles.header.typ1 >
styles.header.typ1 = IMAGE
styles.header.typ1 {
file = GIFBUILDER
file {
XY = [10.w]+10, 52
backColor = {$HEADER_BACKCOLOR}
transparentColor = {$HEADER_TRANSCOLOR}
10 = TEXT
10 {
niceText = 1
antiAlias = 1
text.current = 1
offset = 0, 37
fontSize = {$HEADER_FONTSIZE}
fontFile = {$HEADER_FONTFILE} # russian font here
fontColor = {$HEADER_FONTCOLOR}
text.HTMLparser = 1
text.HTMLparser.htmlSpecialChars = -1
}
}
}
lib.stdheader.10.1 >
lib.stdheader.10.1 < styles.header.typ1
So now this will be processed in class.tslib_gifbuilder.php in line 511.
$tlen = intval($conf['textMaxLength']) ? intval($conf['textMaxLength']) : 100;
Here 100 is hardcoded.
In the next line, which is 512, it sais:
$conf['text'] = substr($conf['text'],0,$tlen);
IMHO this should be rewritten using mb_substr (http://de3.php.net/manual/de/function.mb-substr.php) so it will be multibyte safe.
=)
As is:
$conf['text'] = substr($conf['text'],0,$tlen);
Should be replaced through.
$conf['text'] = mb_substr($conf['text'],0,$tlen);
(issue imported from #M15712)
Files