diff -u b/core/modules/views/src/Plugin/views/HandlerBase.php b/core/modules/views/src/Plugin/views/HandlerBase.php --- b/core/modules/views/src/Plugin/views/HandlerBase.php +++ b/core/modules/views/src/Plugin/views/HandlerBase.php @@ -735,12 +735,12 @@ // Determine if the string has 'or' operators (plus signs) or 'and' // operators (commas) and split the string accordingly. - if (preg_match(HandlerBase::generatePattern('+'), $str)) { + if (preg_match(HandlerBase::generatePattern('+', '+'), $str)) { // The '+' character in a query string may be parsed as ' '. $operator = 'or'; $value = preg_split('/[+ ]/', $str); } - elseif (preg_match(HandlerBase::generatePattern(','), $str)) { + elseif (preg_match(HandlerBase::generatePattern(), $str)) { $operator = 'and'; $value = explode(',', $str); } @@ -875,10 +875,16 @@ } /** - * Pass in a string to be added to an auto generated pattern. + * Pass in a string to be added to an auto generated pattern. That will be + * used to find patterns such as x,y,z and x+y+z. + * + * @param string $string + * (Optional) A string to use for searching in the pattern. Defaults to ','. + * @param string $op + * (Optional) A string used for searching what operation the regex pattern + * will look for. Defaults to '*'. */ - private static function generatePattern($string = ',') { - $op = ($string === ',') ? '*' : '+'; + private static function generatePattern(string $string = ',', string $op = '*') { return '/^([\w0-9-_\.\#\&\/\(\)]+[' . $string . ' ]+)' . $op . '[\w0-9-_\.\#\&\/\(\)]+$/u'; }