Properly handle empty logfiles in ExceptionLogUtil::splitLog()
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 23 Feb 2021 14:11:55 +0000 (15:11 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 23 Feb 2021 14:11:55 +0000 (15:11 +0100)
wcfsetup/install/files/lib/util/ExceptionLogUtil.class.php

index a815ecf11c9ff5842408dc1649d0a8d3e151730f..c7440f7fa41c580c823fd6326119e45d456ec79b 100644 (file)
@@ -26,6 +26,10 @@ final class ExceptionLogUtil {
                $split = new Regex('(?:^|\n<<<<\n\n)(?:<<<<<<<<([a-f0-9]{40})<<<<\n|$)');
                $contents = $split->split($contents, Regex::SPLIT_NON_EMPTY_ONLY | Regex::CAPTURE_SPLIT_DELIMITER);
                
+               if (empty($contents)) {
+                       return [];
+               }
+               
                // even items become keys, odd items become values
                return array_merge(...array_map(
                        function($v) {