Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/Tracker/PageUrl.php')
-rw-r--r--core/Tracker/PageUrl.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/core/Tracker/PageUrl.php b/core/Tracker/PageUrl.php
index 7bf7b9bb92..a28d66f579 100644
--- a/core/Tracker/PageUrl.php
+++ b/core/Tracker/PageUrl.php
@@ -237,9 +237,14 @@ class PageUrl
{
if (is_string($value)) {
$decoded = urldecode($value);
- if (function_exists('mb_check_encoding')
- && @mb_check_encoding($decoded, $encoding)) {
- $value = urlencode(mb_convert_encoding($decoded, 'UTF-8', $encoding));
+ try {
+ if (function_exists('mb_check_encoding')
+ && @mb_check_encoding($decoded, $encoding)) {
+ $value = urlencode(mb_convert_encoding($decoded, 'UTF-8', $encoding));
+ }
+ } catch (\Error $e) {
+ // mb_check_encoding might throw an ValueError on PHP 8 if the given encoding does not exist
+ // we can't simply catch ValueError as it was introduced in PHP 8
}
}