@@ -244,6 +244,20 @@ class BaseBuilder
244244 'RIGHT OUTER ' ,
245245 ];
246246
247+ /**
248+ * Strings that determine if a string represents a literal value or a field name
249+ *
250+ * @var string[]
251+ */
252+ protected $ isLiteralStr = [];
253+
254+ /**
255+ * RegExp used to get operators
256+ *
257+ * @var string[]
258+ */
259+ protected $ pregOperators = [];
260+
247261 /**
248262 * Constructor
249263 *
@@ -2515,13 +2529,11 @@ protected function isLiteral(string $str): bool
25152529 return true ;
25162530 }
25172531
2518- static $ _str ;
2519-
2520- if (empty ($ _str )) {
2521- $ _str = ($ this ->db ->escapeChar !== '" ' ) ? ['" ' , "' " ] : ["' " ];
2532+ if (empty ($ this ->isLiteralStr )) {
2533+ $ this ->isLiteralStr = ($ this ->db ->escapeChar !== '" ' ) ? ['" ' , "' " ] : ["' " ];
25222534 }
25232535
2524- return in_array ($ str [0 ], $ _str , true );
2536+ return in_array ($ str [0 ], $ this -> isLiteralStr , true );
25252537 }
25262538
25272539 /**
@@ -2610,11 +2622,9 @@ protected function hasOperator(string $str): bool
26102622 */
26112623 protected function getOperator (string $ str , bool $ list = false )
26122624 {
2613- static $ _operators ;
2614-
2615- if (empty ($ _operators )) {
2625+ if (empty ($ this ->pregOperators )) {
26162626 $ _les = ($ this ->db ->likeEscapeStr !== '' ) ? '\s+ ' . preg_quote (trim (sprintf ($ this ->db ->likeEscapeStr , $ this ->db ->likeEscapeChar )), '/ ' ) : '' ;
2617- $ _operators = [
2627+ $ this -> pregOperators = [
26182628 '\s*(?:<|>|!)?=\s* ' , // =, <=, >=, !=
26192629 '\s*<>?\s* ' , // <, <>
26202630 '\s*>\s* ' , // >
@@ -2630,7 +2640,7 @@ protected function getOperator(string $str, bool $list = false)
26302640 ];
26312641 }
26322642
2633- return preg_match_all ('/ ' . implode ('| ' , $ _operators ) . '/i ' , $ str , $ match ) ? ($ list ? $ match [0 ] : $ match [0 ][0 ]) : false ;
2643+ return preg_match_all ('/ ' . implode ('| ' , $ this -> pregOperators ) . '/i ' , $ str , $ match ) ? ($ list ? $ match [0 ] : $ match [0 ][0 ]) : false ;
26342644 }
26352645
26362646 /**
0 commit comments