Project

General

Profile

Actions

Bug #23541

closed

Headline in non latin charsets will break after 100 - substr is not multibyte safe use mb_substr instead

Added by C. Schnetter about 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2010-09-15
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

15712.patch (798 Bytes) 15712.patch Administrator Admin, 2011-01-02 09:52

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #24182: class.tslib_gifbuilder.php default fallback for textMaxLength is to lowClosed2010-11-23

Actions
Actions

Also available in: Atom PDF