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:
authordizzy <diosmosis@users.noreply.github.com>2021-02-22 07:19:17 +0300
committerGitHub <noreply@github.com>2021-02-22 07:19:17 +0300
commit8048b685fa82ecb21fb6480547ec499862457b93 (patch)
tree1945fc04608720b605195955b4c28e739ea77d07
parent7d801daec95310a8afd7233de237fc76fa6524a0 (diff)
ignore invalid segment when computing hash in SegmentEditor.getAll (#17241)
-rw-r--r--plugins/SegmentEditor/API.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/SegmentEditor/API.php b/plugins/SegmentEditor/API.php
index 0565f29cdc..99f6585039 100644
--- a/plugins/SegmentEditor/API.php
+++ b/plugins/SegmentEditor/API.php
@@ -394,8 +394,12 @@ class API extends \Piwik\Plugin\API
$allIdSites = $model->getSitesId();
foreach ($segments as &$segmentInfo) {
$idSites = !empty($segmentInfo['enable_only_idsite']) ? [(int) $segmentInfo['enable_only_idsite']] : $allIdSites;
- $segmentObj = new Segment(urlencode($segmentInfo['definition']), $idSites);
- $segmentInfo['hash'] = $segmentObj->getHash();
+ try {
+ $segmentObj = new Segment(urlencode($segmentInfo['definition']), $idSites);
+ $segmentInfo['hash'] = $segmentObj->getHash();
+ } catch (\Exception $ex) {
+ $segmentInfo['hash'] = 'INVALID SEGMENT';
+ }
}
return $segments;