diff options
author | Stefan Giehl <stefan@matomo.org> | 2021-08-16 19:14:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-16 19:14:02 +0300 |
commit | 8c7fa7d8d414b5201c36661fb4828d14e4c33c53 (patch) | |
tree | 95a65fdf0c71dd4c28c78ba7fd7d1620d8892905 | |
parent | 331e69eb1f2c022afb943114000aa60a4d93b1ac (diff) |
Fix possible notices (#17886)
* Fix possible notices
* Ensure to query hash for deleted segments
-rw-r--r-- | core/DataAccess/Model.php | 4 | ||||
-rw-r--r-- | plugins/SegmentEditor/Model.php | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/core/DataAccess/Model.php b/core/DataAccess/Model.php index 3848c6defa..e6e821e1a6 100644 --- a/core/DataAccess/Model.php +++ b/core/DataAccess/Model.php @@ -632,10 +632,10 @@ class Model private function getDeletedSegmentWhereClause(array $segment) { $idSite = (int)$segment['enable_only_idsite']; - $segmentHash = $segment['hash']; + $segmentHash = $segment['hash'] ?? ''; // Valid segment hashes are md5 strings - just confirm that it is so it's safe for SQL injection if (!ctype_xdigit($segmentHash)) { - throw new Exception($segment . ' expected to be an md5 hash'); + throw new Exception($segmentHash . ' expected to be an md5 hash'); } $nameClause = 'name LIKE "done' . $segmentHash . '%"'; diff --git a/plugins/SegmentEditor/Model.php b/plugins/SegmentEditor/Model.php index f876d2a46c..dcd18c1e3b 100644 --- a/plugins/SegmentEditor/Model.php +++ b/plugins/SegmentEditor/Model.php @@ -139,7 +139,7 @@ class Model public function getSegmentsDeletedSince(Date $date) { $dateStr = $date->getDatetime(); - $sql = "SELECT DISTINCT definition, enable_only_idsite FROM " . Common::prefixTable('segment') + $sql = "SELECT DISTINCT `definition`, `enable_only_idsite`, `hash` FROM " . Common::prefixTable('segment') . " WHERE deleted = 1 AND ts_last_edit >= ?"; $deletedSegments = Db::fetchAll($sql, array($dateStr)); |