Skip to content

Commit

Permalink
Object: Fix MB Safety for Titles
Browse files Browse the repository at this point in the history
  • Loading branch information
kergomard committed Oct 2, 2024
1 parent 81045ee commit 414e80d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Services/Object/classes/class.ilObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@ public function cloneObject(int $target_id, int $copy_id = 0, bool $omit_tree =
$this->obj_log->debug("omit_tree: " . $omit_tree);
if (!$options->isTreeCopyDisabled() && !$omit_tree) {
$title_with_suffix = $this->appendCopyInfo($target_id, $copy_id);
$title = strlen($title_with_suffix) < self::TITLE_LENGTH ? $title_with_suffix : $title;
$title = mb_strlen($title_with_suffix) < self::TITLE_LENGTH ? $title_with_suffix : $title;
$this->obj_log->debug("title incl. copy info: " . $title);

}
Expand Down Expand Up @@ -1705,7 +1705,7 @@ private function appendCopyInfoToTranslations(

$new_languages = [];
$installed_langs = $this->lng->getInstalledLanguages();
foreach($obj_translations->getLanguages() as $language) {
foreach ($obj_translations->getLanguages() as $language) {
$lang_code = $language->getLanguageCode();
$suffix_lang = $lang_code;
if (!in_array($suffix_lang, $installed_langs)) {
Expand All @@ -1730,7 +1730,7 @@ private function getCallbackForTitlesPerLanguageTransformation(): callable
{
return function (array $npl, ?ilObjectTranslation $nt): array {
$langs = $nt->getLanguages();
foreach($langs as $lang) {
foreach ($langs as $lang) {
if (!array_key_exists($lang->getLanguageCode(), $npl)) {
$npl[$lang->getLanguageCode()] = [];
}
Expand Down

0 comments on commit 414e80d

Please sign in to comment.