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@matomo.org>2021-01-15 10:53:48 +0300
committerGitHub <noreply@github.com>2021-01-15 10:53:48 +0300
commitb38578b468d694534db5fabe356db5ffdc58bd6e (patch)
treef9d0307513b614d966075d946ac5e68bed1c660a /core
parent6f957d15b4db3b0d8d54f046de33207044f87681 (diff)
Introduce PHP CS to improve code quality (#16755)
* Adds PHP CS with a basic config * automatically check coding style for pull requests * Disallow usage of eval & create_function and force using Common::safe_unserialize instead of unserialize * Forbid inline control structures * fix test
Diffstat (limited to 'core')
-rw-r--r--core/Common.php1
-rw-r--r--core/Updates/3.8.0-b3.php2
2 files changed, 2 insertions, 1 deletions
diff --git a/core/Common.php b/core/Common.php
index fd67308062..7085aea33f 100644
--- a/core/Common.php
+++ b/core/Common.php
@@ -319,6 +319,7 @@ class Common
public static function safe_unserialize($string, $allowedClasses = [], $rethrow = false)
{
try {
+ // phpcs:ignore Generic.PHP.ForbiddenFunctions
return unserialize($string, ['allowed_classes' => empty($allowedClasses) ? false : $allowedClasses]);
} catch (\Throwable $e) {
if ($rethrow) {
diff --git a/core/Updates/3.8.0-b3.php b/core/Updates/3.8.0-b3.php
index 93a29a94a2..967533cbb2 100644
--- a/core/Updates/3.8.0-b3.php
+++ b/core/Updates/3.8.0-b3.php
@@ -49,7 +49,7 @@ class Updates_3_8_0_b3 extends PiwikUpdates
if (Plugin\Manager::getInstance()->isPluginActivated('GoogleAuthenticator')) {
foreach (Option::getLike('GoogleAuthentication.%') as $name => $value) {
- $value = @unserialize($value);
+ $value = @Common::safe_unserialize($value);
if (!empty($value['isActive']) && !empty($value['secret'])) {
$login = str_replace('GoogleAuthentication.', '', $name);