mirror of
https://github.com/processwire/processwire.git
synced 2025-08-15 19:24:28 +02:00
Improve operator extraction in Selectors class so that it doesn't potentially match non-existent operators and throw an unnecessary "unknown operator - selector value property escaped?" error message
This commit is contained in:
@@ -531,8 +531,15 @@ class Selectors extends WireArray {
|
||||
protected function extractOperator(&$str, array $operatorChars) {
|
||||
$n = 0;
|
||||
$operator = '';
|
||||
$lastOperator = '';
|
||||
while(isset($str[$n]) && in_array($str[$n], $operatorChars) && $n < self::maxOperatorLength) {
|
||||
$operator .= $str[$n];
|
||||
if(self::isOperator($operator)) {
|
||||
$lastOperator = $operator;
|
||||
} else if($lastOperator) {
|
||||
$operator = $lastOperator;
|
||||
break;
|
||||
}
|
||||
$n++;
|
||||
}
|
||||
if($operator) $str = substr($str, $n);
|
||||
|
Reference in New Issue
Block a user