Language::truncate(): don't chop up multibyte characters when input contains newlines
authorRoan Kattouw <roan.kattouw@gmail.com>
Tue, 27 Oct 2015 03:17:37 +0000 (20:17 -0700)
committerRoan Kattouw <roan.kattouw@gmail.com>
Tue, 27 Oct 2015 03:17:37 +0000 (20:17 -0700)
commite4d6238c00466c3c374313def97b32b55070661d
tree8446281cf451db8e6623910eb23837dd543594a2
parent36c237a3863773b13e4ce5cf0568513c8d1993ee
Language::truncate(): don't chop up multibyte characters when input contains newlines

To detect whether the truncation had chopped up a multibyte
character after the first byte, a regex was used. But in this
regex, the dot (.) didn't match newlines, so it failed to
detect chopped multibyte characters (after the first byte)
if there was a newline preceding the chopped character.

Bug: T116693
Change-Id: I66e4fd451acac0a1019da7060d5a37d70963a15a
languages/Language.php
tests/phpunit/languages/LanguageTest.php