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/Request.php')
-rw-r--r--core/Tracker/Request.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/Tracker/Request.php b/core/Tracker/Request.php
index 48fecc103b..77c5795804 100644
--- a/core/Tracker/Request.php
+++ b/core/Tracker/Request.php
@@ -13,6 +13,7 @@ use Piwik\Common;
use Piwik\Config;
use Piwik\Container\StaticContainer;
use Piwik\Cookie;
+use Piwik\DbHelper;
use Piwik\Exception\InvalidRequestParameterException;
use Piwik\Exception\UnexpectedWebsiteFoundException;
use Piwik\IP;
@@ -87,13 +88,19 @@ class Request
}
}
- // check for 4byte utf8 characters in all tracking params and replace them with �
- // @TODO Remove as soon as our database tables use utf8mb4 instead of utf8
+ // check for 4byte utf8 characters in all tracking params and replace them with � if not support by database
$this->params = $this->replaceUnsupportedUtf8Chars($this->params);
}
protected function replaceUnsupportedUtf8Chars($value, $key=false)
{
+ $dbSettings = new \Piwik\Db\Settings();
+ $charset = $dbSettings->getUsedCharset();
+
+ if ('utf8mb4' === $charset) {
+ return $value; // no need to replace anything if utf8mb4 is supported
+ }
+
if (is_string($value) && preg_match('/[\x{10000}-\x{10FFFF}]/u', $value)) {
Common::printDebug("Unsupported character detected in $key. Replacing with \xEF\xBF\xBD");
return preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $value);