Skip to content
Snippets Groups Projects
Commit e3807c29 authored by Demian Katz's avatar Demian Katz Committed by Robert Lange
Browse files

Less ambiguous weight check, for PHP 8 compatibility.

parent 024052c6
No related merge requests found
...@@ -525,8 +525,8 @@ class SearchHandler ...@@ -525,8 +525,8 @@ class SearchHandler
$this->munge($clausearray, $mungeValues, $internalJoin) . $this->munge($clausearray, $mungeValues, $internalJoin) .
')'; ')';
// ...and add a weight if we have one // ...and add a weight if we have one
$weight = $sw[1]; $weight = intval($sw[1] ?? 0);
if (null !== $weight && $weight && $weight > 0) { if ($weight > 0) {
$sstring .= '^' . $weight; $sstring .= '^' . $weight;
} }
// push it onto the stack of clauses // push it onto the stack of clauses
...@@ -539,8 +539,8 @@ class SearchHandler ...@@ -539,8 +539,8 @@ class SearchHandler
$sstring = $field . ':(' . $mungeValues[$spec[0]] . ')'; $sstring = $field . ':(' . $mungeValues[$spec[0]] . ')';
// Add the weight if we have one. Yes, I know, it's redundant // Add the weight if we have one. Yes, I know, it's redundant
// code. // code.
$weight = $spec[1]; $weight = intval($spec[1] ?? 0);
if (null !== $weight && $weight && $weight > 0) { if ($weight > 0) {
$sstring .= '^' . $weight; $sstring .= '^' . $weight;
} }
// ..and push it on the stack of clauses // ..and push it on the stack of clauses
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment