From a28853d4e8a4accffc89cc5d8c467b1b5cfefe94 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 7 Feb 2018 10:39:03 -0800 Subject: [PATCH] Fix for warning in ForeignAPIFile when no thumbnails Remote audio files have no thumbnails, so this check in ForeignAPIFile for thumbnails by iterating over the result from FileBackend::getFileList() could throw a warning about invalid input to foreach, as it may return null. Change-Id: I07f37ed5a299e1a3c9a1e6bddcbc5582f99e5274 --- includes/filerepo/file/ForeignAPIFile.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/filerepo/file/ForeignAPIFile.php b/includes/filerepo/file/ForeignAPIFile.php index 8dcb289abd..2a40942527 100644 --- a/includes/filerepo/file/ForeignAPIFile.php +++ b/includes/filerepo/file/ForeignAPIFile.php @@ -340,8 +340,10 @@ class ForeignAPIFile extends File { $iter = $this->repo->getBackend()->getFileList( [ 'dir' => $dir ] ); $files = []; - foreach ( $iter as $file ) { - $files[] = $file; + if ( $iter ) { + foreach ( $iter as $file ) { + $files[] = $file; + } } return $files; -- 2.20.1