Merge pull request #59566 from nextcloud/bugfix/noid/fix-reverting-multibyte-strings

fix(testing): Fix fake provider reverting strings with emojis
This commit is contained in:
Joas Schilling 2026-04-10 18:14:37 +02:00 committed by GitHub
commit a2bb782f66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,6 +25,14 @@ class FakeTranslationProvider implements ITranslationProvider {
}
public function translate(?string $fromLanguage, string $toLanguage, string $text): string {
return strrev($text);
return $this->mb_strrev($text);
}
protected function mb_strrev(string $str): string {
$r = '';
for ($i = mb_strlen($str); $i >= 0; $i--) {
$r .= mb_substr($str, $i, 1);
}
return $r;
}
}