diff options
author | dizzy <diosmosis@users.noreply.github.com> | 2021-02-22 07:19:17 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-22 07:19:17 +0300 |
commit | 8048b685fa82ecb21fb6480547ec499862457b93 (patch) | |
tree | 1945fc04608720b605195955b4c28e739ea77d07 /plugins/SegmentEditor | |
parent | 7d801daec95310a8afd7233de237fc76fa6524a0 (diff) |
ignore invalid segment when computing hash in SegmentEditor.getAll (#17241)
Diffstat (limited to 'plugins/SegmentEditor')
-rw-r--r-- | plugins/SegmentEditor/API.php | 8 |
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; |