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:
authorStefan Giehl <stefan@matomo.org>2021-06-15 01:14:54 +0300
committerGitHub <noreply@github.com>2021-06-15 01:14:54 +0300
commit078909ef807910a1f2a4d93d738306d0bf6a9e04 (patch)
treeb3be00be7800440856057e8b5638beb216f46880 /core/Tracker.php
parent776c8d374aaac02cd47c7f0673730d68cdeb9ab3 (diff)
Ensure DbException is thrown correctly (#17670)
Diffstat (limited to 'core/Tracker.php')
-rw-r--r--core/Tracker.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/Tracker.php b/core/Tracker.php
index 20d83eb5d2..9d813c0796 100644
--- a/core/Tracker.php
+++ b/core/Tracker.php
@@ -223,7 +223,9 @@ class Tracker
try {
self::$db = TrackerDb::connectPiwikTrackerDb();
} catch (Exception $e) {
- throw new DbException($e->getMessage(), $e->getCode());
+ $code = $e->getCode();
+ // Note: PDOException might return a string as code, but we can't use this for DbException
+ throw new DbException($e->getMessage(), is_int($code) ? $code : 0);
}
}