Skip to content

Commit

Permalink
ORGU: 42501, use multi byte string when writing the path into the sto…
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastocker authored and klees committed Nov 5, 2024
1 parent cc30fba commit 7e442e7
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -16,6 +17,8 @@
********************************************************************
*/

declare(strict_types=1);

/**
* Class ilOrgUnitPathStorage
* @author Fabian Schmid <[email protected]>
Expand Down Expand Up @@ -150,7 +153,7 @@ public static function writePathByRefId(string $ref_id): void
$last = array_pop($path);
$middle = implode(self::GLUE_SIMPLE, $path);
if (strlen($middle) > self::MAX_MIDDLE_PATH_LENGTH) {
$middle = substr($middle, 0, self::MAX_MIDDLE_PATH_LENGTH) . " ...";
$middle = mb_substr($middle, 0, self::MAX_MIDDLE_PATH_LENGTH) . " ...";

This comment has been minimized.

Copy link
@mjansenDatabay

mjansenDatabay Nov 5, 2024

Contributor

Maybe we should also use mb_strlen above.

And: Is the php-mbstring extension obligatory when installing ILIAS? I am just not sure, so I did some checks in one of my PRs lately.

This comment has been minimized.

Copy link
@klees

klees Nov 5, 2024

Member

Yeah, good catch. @lukastocker Please open an according PR...

This comment has been minimized.

Copy link
@lukastocker

lukastocker Nov 5, 2024

Author Contributor

Done. You can find the PR here:

#8336

This comment has been minimized.

Copy link
@klees

klees Nov 5, 2024

Member

Ok, looking for mb_ on our code base, I found some locations that use multibyte functions, where some of them are guarded by function_exists but some are not. So we low key seem to somehow rely on php-mbstring already, but I could not find any documentation that it should indeed be installed. I'll raise the issue on the JF.

}
$expression = implode(self::GLUE_SIMPLE, [$first, $middle, $last]);
} else {
Expand Down

0 comments on commit 7e442e7

Please sign in to comment.