From 3043fe924d17638ccdbd607dd59d135346e7e47e Mon Sep 17 00:00:00 2001 From: Matt Clarkson Date: Wed, 13 Sep 2017 12:50:29 +1200 Subject: [PATCH] MDL-60105 search: Fix fatal error If an indexed file has been modified or deleted the search index will still reference the old file. Remove the file from search results until the change has been indexed. --- search/classes/document.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/search/classes/document.php b/search/classes/document.php index 7ed70558781..97cdc7b9396 100644 --- a/search/classes/document.php +++ b/search/classes/document.php @@ -231,6 +231,8 @@ class document implements \renderable, \templatable { if ($file = $fs->get_file_by_id($id)) { $this->files[$id] = $file; + } else { + unset($this->files[$id]); // Index is out of date and referencing a file that does not exist. } } }