From 35c80a9fb9cf1aada1bc8f36eff82069f669b1ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=8Ceslav=20Przywara?= Date: Fri, 23 Feb 2018 13:28:56 +0100 Subject: [PATCH] Correctly handle plugin checksums with multiple md5 checksums for single file. Fixes #40. --- classes/BlueChip/Security/Modules/Checksums/Verifier.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/classes/BlueChip/Security/Modules/Checksums/Verifier.php b/classes/BlueChip/Security/Modules/Checksums/Verifier.php index a07eb9f..f91bf05 100644 --- a/classes/BlueChip/Security/Modules/Checksums/Verifier.php +++ b/classes/BlueChip/Security/Modules/Checksums/Verifier.php @@ -42,7 +42,9 @@ protected static function checkDirectoryForModifiedFiles(string $path, $checksum } // Compare MD5 hashes. - if (md5_file($pathname) !== $checksum) { + // Note that there can be multiple checksums provided for a single file (at least in plugin checksums). + $md5 = md5_file($pathname); + if (is_array($checksum) ? !in_array($md5, $checksum, true) : ($md5 !== $checksum)) { $modified_files[] = $filename; } }