Commit 19508f02925591bb558f8174a9f1d1e8578803eb
1 parent
52e820fc
KTS-3912 - Implemented fixes to check the arrays before using them.
"Problems with the search functionality in web services." Committed by: Megan Watson Reviewed by: Donald Jackson git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/branches/RB_3.5.4a@9623 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
3 changed files
with
11 additions
and
3 deletions
search2/search/expr.inc.php
| ... | ... | @@ -2317,9 +2317,12 @@ class OpExpr extends Expr |
| 2317 | 2317 | } |
| 2318 | 2318 | |
| 2319 | 2319 | $permResults = array(); |
| 2320 | - foreach($result[$resultContext] as $idx=>$item) | |
| 2320 | + if(isset($result[$resultContext])) | |
| 2321 | 2321 | { |
| 2322 | - $permResults[$resultContext][$idx] = $item; | |
| 2322 | + foreach($result[$resultContext] as $idx=>$item) | |
| 2323 | + { | |
| 2324 | + $permResults[$resultContext][$idx] = $item; | |
| 2325 | + } | |
| 2323 | 2326 | } |
| 2324 | 2327 | |
| 2325 | 2328 | return $permResults; | ... | ... |
search2/search/fields/FullPathField.inc.php
search2/search/search.inc.php
| ... | ... | @@ -570,6 +570,11 @@ function processSearchExpression($query) |
| 570 | 570 | |
| 571 | 571 | $rs = $expr->evaluate(ExprContext::DOCUMENT); |
| 572 | 572 | $rs = $rs['docs']; |
| 573 | + | |
| 574 | + if(empty($rs)){ | |
| 575 | + return array(); | |
| 576 | + } | |
| 577 | + | |
| 573 | 578 | usort($rs, 'rank_compare'); |
| 574 | 579 | |
| 575 | 580 | $results = array(); | ... | ... |