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
path: root/core
diff options
context:
space:
mode:
authorStefan Giehl <stefan@piwik.org>2017-09-26 01:28:40 +0300
committerMatthieu Aubry <mattab@users.noreply.github.com>2017-09-26 01:28:40 +0300
commit9c8980844fbdd101975915597b72765e0ef2c7a2 (patch)
treede0968973e178de75835cb540444ece81392e0ce /core
parentda6e68b04ff532d125e2c1e38be23814c5b8ecd9 (diff)
Use mbstring proxy methods (#12104)
* Use mbstring proxy methods * Avoid using strtolower/strtoupper if mbstring is not available to prevent possible unicode problems
Diffstat (limited to 'core')
-rw-r--r--core/Common.php22
1 files changed, 21 insertions, 1 deletions
diff --git a/core/Common.php b/core/Common.php
index f884d9fe2f..7430cc6662 100644
--- a/core/Common.php
+++ b/core/Common.php
@@ -232,7 +232,27 @@ class Common
return mb_strtolower($string, 'UTF-8');
}
- return strtolower($string);
+ // return unchanged string as using `strtolower` might cause unicode problems
+ return $string;
+ }
+
+ /**
+ * Multi-byte strtoupper() - works with UTF-8.
+ *
+ * Calls `mb_strtoupper` if available and falls back to `strtoupper` if not.
+ *
+ * @param string $string
+ * @return string
+ * @api
+ */
+ public static function mb_strtoupper($string)
+ {
+ if (function_exists('mb_strtoupper')) {
+ return mb_strtoupper($string, 'UTF-8');
+ }
+
+ // return unchanged string as using `strtoupper` might cause unicode problems
+ return $string;
}
/*