From d83368a475103da04af8af962db4a522f894f60a Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Thu, 17 Nov 2022 16:00:44 +0100 Subject: [PATCH] MDL-76362 mustache: Override parent method to avoid PHP notices Parent method checks baseDir that is null in this case. This shows notices under PHP 8.1 --- lib/classes/output/mustache_filesystem_loader.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/classes/output/mustache_filesystem_loader.php b/lib/classes/output/mustache_filesystem_loader.php index f90623ce47a..e79b479fed5 100644 --- a/lib/classes/output/mustache_filesystem_loader.php +++ b/lib/classes/output/mustache_filesystem_loader.php @@ -53,4 +53,16 @@ class mustache_filesystem_loader extends \Mustache_Loader_FilesystemLoader { // Call the Moodle template finder. return mustache_template_finder::get_template_filepath($name); } + + /** + * Only check if baseDir is a directory and requested templates are files if + * baseDir is using the filesystem stream wrapper. + * + * Always check path for mustache_filesystem_loader. + * + * @return bool Whether to check `is_dir` and `file_exists` + */ + protected function shouldCheckPath() { + return true; + } }