diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-12-24 02:03:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-24 02:03:09 +0300 |
commit | 1c2502b38aeeac68bce6fc411e683b2fd8e61a92 (patch) | |
tree | b67c61d187a871888f13cb593fb27d3a9cb78880 /core | |
parent | 859407538cf999a6afef4063c4a772238629b1d8 (diff) |
Improve action id lookup for segments (#16977)
* Improve action id lookup fog segments
if no id can be found for a segment with the normalized value, try looking it up the the original value
* Adds UI test for opening vlog with outlink containing a &
Diffstat (limited to 'core')
-rw-r--r-- | core/Tracker/TableLogAction.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/core/Tracker/TableLogAction.php b/core/Tracker/TableLogAction.php index fea4cac171..331239f3d9 100644 --- a/core/Tracker/TableLogAction.php +++ b/core/Tracker/TableLogAction.php @@ -43,7 +43,7 @@ class TableLogAction $actionIds = self::queryIdsAction($actionsNameAndType); - list($queriedIds, $fieldNamesToInsert) = self::processIdsToInsert($actionsNameAndType, $actionIds); + [$queriedIds, $fieldNamesToInsert] = self::processIdsToInsert($actionsNameAndType, $actionIds); $insertedIds = self::insertNewIdsAction($actionsNameAndType, $fieldNamesToInsert); $queriedIds = $queriedIds + $insertedIds; @@ -95,7 +95,7 @@ class TableLogAction $inserted = array(); foreach ($fieldNamesToInsert as $fieldName) { - list($name, $type, $urlPrefix) = $actionsNameAndType[$fieldName]; + [$name, $type, $urlPrefix] = $actionsNameAndType[$fieldName]; $actionId = self::getModel()->createNewIdAction($name, $type, $urlPrefix); @@ -116,7 +116,7 @@ class TableLogAction { $toQuery = array(); foreach ($actionsNameAndType as &$actionNameType) { - list($name, $type, $urlPrefix) = $actionNameType; + [$name, $type, $urlPrefix] = $actionNameType; $toQuery[] = array('name' => $name, 'type' => $type); } @@ -184,14 +184,20 @@ class TableLogAction $valueToMatch = preg_replace('@^http[s]?://(www\.)?@i', '', $valueToMatch); } + $unsanitizedValue = $valueToMatch; $valueToMatch = self::normaliseActionString($actionType, $valueToMatch); if ($matchType == SegmentExpression::MATCH_EQUAL || $matchType == SegmentExpression::MATCH_NOT_EQUAL ) { $idAction = self::getModel()->getIdActionMatchingNameAndType($valueToMatch, $actionType); - // Action is not found (eg. &segment=pageTitle==Větrnásssssss) + // If action can't be found normalized try search for it with original value + // This can eg happen for outlinks that contain a & see https://github.com/matomo-org/matomo/issues/11806 if (empty($idAction)) { - $idAction = null; + $idAction = self::getModel()->getIdActionMatchingNameAndType($unsanitizedValue, $actionType); + // Action is not found (eg. &segment=pageTitle==Větrnásssssss) + if (empty($idAction)) { + $idAction = null; + } } return $idAction; } |