-
Couldn't load subscription status.
- Fork 9.4k
Description
Preconditions and environment
- Magento 2.4.8-p1 +
Steps to reproduce
Captcha files are not deleted anymore after update to Magento 2.4.8-p1 causing folder /media/captcha/base to grow over time.
(It IS still reproducible on 2.4-develop)
This commit runed it:
ab0fb9d
Issue is here:
Magento\Captcha\Cron\DeleteExpiredImages::_deleteExpiredImagesForWebsite
if ($this->_mediaDirectory->isFile($filePath)
&& $this->_fileInfo->getPathInfo($filePath, PATHINFO_EXTENSION) == 'png'
&& $this->_mediaDirectory->stat($filePath)['mtime'] < $expire
) {
$this->_mediaDirectory->delete($filePath);
}
this is never gonna be true, because of condition:
$this->_fileInfo->getPathInfo($filePath, PATHINFO_EXTENSION) == 'png'
method getPathInfo always returns array, so comparsion to string "png" will always result in false.
@see Magento\Framework\Filesystem\Io\File::getPathInfo
public function getPathInfo($path)
{
return pathinfo($path);
}
To fix it we should add another optional param to getPathInfo or change condition:
$this->_fileInfo->getPathInfo($filePath, PATHINFO_EXTENSION) == 'png'
to:
$this->_fileInfo->getPathInfo($filePath)['extension'] == 'png'
or bring back as it used to be before commit mentioned above (ab0fb9d):
pathinfo($filePath, PATHINFO_EXTENSION) == 'png'
Expected result
Captcha files are deleted by CRON captcha_delete_expired_images
Actual result
Captcha files are not deleted by captcha_delete_expired_images CRON
Additional information
No response
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status