diff --git a/vendor/magento/module-captcha/Cron/DeleteExpiredImages.php b/vendor/magento/module-captcha/Cron/DeleteExpiredImages.php index c63fbe0215183..00c97b05bec65 100644 --- a/vendor/magento/module-captcha/Cron/DeleteExpiredImages.php +++ b/vendor/magento/module-captcha/Cron/DeleteExpiredImages.php @@ -8,6 +8,7 @@ use Magento\Captcha\Cron\Magento\Framework\Filesystem\Io\File; use Magento\Captcha\Helper\Data; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Exception\FileSystemException; use Magento\Framework\Filesystem; use Magento\Framework\Filesystem\DriverPool; use Magento\Store\Model\StoreManager; @@ -69,6 +70,7 @@ public function __construct( * Delete Expired Captcha Images * * @return \Magento\Captcha\Cron\DeleteExpiredImages + * @throws FileSystemException */ public function execute() { @@ -87,17 +89,18 @@ public function execute() * @param \Magento\Store\Model\Website|null $website * @param \Magento\Store\Model\Store|null $store * @return void + * @throws FileSystemException */ protected function _deleteExpiredImagesForWebsite( \Magento\Captcha\Helper\Data $helper, ?\Magento\Store\Model\Website $website = null, ?\Magento\Store\Model\Store $store = null ) { - $expire = time() - $helper->getConfig('timeout', $store) * 60; + $expire = time() - (int)$helper->getConfig('timeout', $store) * 60; $imageDirectory = $this->_mediaDirectory->getRelativePath($helper->getImgDir($website)); foreach ($this->_mediaDirectory->read($imageDirectory) as $filePath) { if ($this->_mediaDirectory->isFile($filePath) - && $this->_fileInfo->getPathInfo($filePath, PATHINFO_EXTENSION) == 'png' + && $this->_fileInfo->getPathInfo($filePath)['extension'] === 'png' && $this->_mediaDirectory->stat($filePath)['mtime'] < $expire ) { $this->_mediaDirectory->delete($filePath);