Skip to content

EspoCRM – Open Source CRM Application

Formula trim mb_trim

Yurii68bdbc3172ac
diff --git a/application/Espo/Core/Formula/Functions/StringGroup/TrimType.php b/application/Espo/Core/Formula/Functions/StringGroup/TrimType.php
index fa650f8400..635ffe188a 100644
--- a/application/Espo/Core/Formula/Functions/StringGroup/TrimType.php
+++ b/application/Espo/Core/Formula/Functions/StringGroup/TrimType.php
@@ -29,11 +29,12 @@
namespace Espo\Core\Formula\Functions\StringGroup;
-use Espo\Core\Formula\{
- Functions\BaseFunction,
- ArgumentList,
-};
+use Espo\Core\Formula\ArgumentList;
+use Espo\Core\Formula\Functions\BaseFunction;
+/**
+ * @noinspection PhpUnused
+ */
class TrimType extends BaseFunction
{
public function process(ArgumentList $args)
@@ -50,6 +51,16 @@ class TrimType extends BaseFunction
$value = strval($value);
}
+ return self::trim($value);
+ }
+
+ private static function trim(string $value): string
+ {
+ // @todo Remove check when PHP 8.4 is min supported.
+ if (function_exists('mb_trim')) {
+ return mb_trim($value);
+ }
+
return trim($value);
}
}