From 93fa7a46ce637b16cf54fb2270a0847d2fb5f575 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sat, 19 Jun 2021 23:16:08 +0900 Subject: [PATCH] Fix FileHandler::checkMemoryLoadImage() returning false if memory_limit is actually unlimited --- classes/file/FileHandler.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/classes/file/FileHandler.class.php b/classes/file/FileHandler.class.php index eb096b37f..9328cf792 100644 --- a/classes/file/FileHandler.class.php +++ b/classes/file/FileHandler.class.php @@ -467,8 +467,13 @@ class FileHandler $channels = 6; //for png } $memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64 ) * $TWEAKFACTOR); - $memoryLimit = self::returnBytes(ini_get('memory_limit')); - if($memoryLimit < 0) + $memoryLimit = ini_get('memory_limit'); + if($memoryLimit <= 0) + { + return true; + } + $memoryLimit = self::returnBytes($memoryLimit); + if($memoryLimit <= 0) { return true; }