diff options
author | Stefan Giehl <stefan@matomo.org> | 2021-06-15 01:14:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-15 01:14:54 +0300 |
commit | 078909ef807910a1f2a4d93d738306d0bf6a9e04 (patch) | |
tree | b3be00be7800440856057e8b5638beb216f46880 /core/Tracker.php | |
parent | 776c8d374aaac02cd47c7f0673730d68cdeb9ab3 (diff) |
Ensure DbException is thrown correctly (#17670)
Diffstat (limited to 'core/Tracker.php')
-rw-r--r-- | core/Tracker.php | 4 |
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); } } |