MDL-33007 add workaround for broken iconv //IGNORE

This patch adds mbstring utf-8 cleanup fallback and admin warning if no utf-8 cleanup possible in user submitted data.
This commit is contained in:
Petr Skoda 2012-05-15 23:07:10 +02:00
parent 3681e78429
commit 0aff15c2c9
6 changed files with 48 additions and 15 deletions

View file

@ -301,6 +301,7 @@ class moodlelib_testcase extends advanced_testcase {
$this->assertSame(1.1, fix_utf8(1.1));
$this->assertSame(true, fix_utf8(true));
$this->assertSame('', fix_utf8(''));
$this->assertSame('abc', fix_utf8('abc'));
$array = array('do', 're', 'mi');
$this->assertSame($array, fix_utf8($array));
$object = new stdClass();
@ -312,7 +313,7 @@ class moodlelib_testcase extends advanced_testcase {
$this->assertSame("žlutý koníček přeskočil potůček \n\t\r\0", fix_utf8("žlutý koníček přeskočil potůček \n\t\r\0"));
// invalid utf8 string
$this->assertSame('aaabbb', fix_utf8('aaa'.chr(130).'bbb'));
$this->assertSame('aš', fix_utf8('a'.chr(130).'š'), 'This fails with buggy iconv() when mbstring extenstion is not available as fallback.');
}
function test_optional_param() {