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
path: root/core
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2019-05-16 05:58:44 +0300
committerGitHub <noreply@github.com>2019-05-16 05:58:44 +0300
commited823e9c1521a6a5aada6fc1572433845322967f (patch)
tree3c273d4e972206930661b22312c4ca7175fc2dda /core
parent05017ba88ec611f63bf223728990351212ff560f (diff)
Ignore variables that start w/ @ when auto-detecting tables in segment sql expressions. (#14425)
* Ignore variables that start w/ @ when auto-detecting tables in segment sql expressions. * Add test & fix * Make sure column detection excludes decimal numbers.
Diffstat (limited to 'core')
-rw-r--r--core/Segment/SegmentExpression.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/Segment/SegmentExpression.php b/core/Segment/SegmentExpression.php
index 997d7e7b5f..ae4225006f 100644
--- a/core/Segment/SegmentExpression.php
+++ b/core/Segment/SegmentExpression.php
@@ -315,8 +315,11 @@ class SegmentExpression
*/
public static function parseColumnsFromSqlExpr($field)
{
- preg_match_all('/\b`?([a-zA-Z0-9_]+`?\.`?[a-zA-Z0-9_`]+)`?\b/', $field, $matches);
+ preg_match_all('/[^@a-zA-Z0-9_]?`?([@a-zA-Z_][@a-zA-Z0-9_]*`?\.`?[a-zA-Z0-9_`]+)`?\b/', $field, $matches);
$result = isset($matches[1]) ? $matches[1] : [];
+ $result = array_filter($result, function ($value) { // remove uses of session vars
+ return strpos($value, '@') === false;
+ });
$result = array_map(function ($item) {
return str_replace('`', '', $item);
}, $result);