mirror of
https://github.com/processwire/processwire.git
synced 2025-08-16 11:44:42 +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) {
|
protected function extractOperator(&$str, array $operatorChars) {
|
||||||
$n = 0;
|
$n = 0;
|
||||||
$operator = '';
|
$operator = '';
|
||||||
|
$lastOperator = '';
|
||||||
while(isset($str[$n]) && in_array($str[$n], $operatorChars) && $n < self::maxOperatorLength) {
|
while(isset($str[$n]) && in_array($str[$n], $operatorChars) && $n < self::maxOperatorLength) {
|
||||||
$operator .= $str[$n];
|
$operator .= $str[$n];
|
||||||
|
if(self::isOperator($operator)) {
|
||||||
|
$lastOperator = $operator;
|
||||||
|
} else if($lastOperator) {
|
||||||
|
$operator = $lastOperator;
|
||||||
|
break;
|
||||||
|
}
|
||||||
$n++;
|
$n++;
|
||||||
}
|
}
|
||||||
if($operator) $str = substr($str, $n);
|
if($operator) $str = substr($str, $n);
|
||||||
|
Reference in New Issue
Block a user