ÃÛ¶¹ÊÓÆµ

[PaaS only]{class="badge informative" title="Applies to ÃÛ¶¹ÊÓÆµ Commerce on Cloud projects (ÃÛ¶¹ÊÓÆµ-managed PaaS infrastructure) and on-premises projects only."}

ACSD-58131: Old media gallery fails to load images due to 0-byte image file

The ACSD-58131 patch fixes the issue where the old media gallery fails to render images when a 0-byte image is present in the directory. This patch is available when the Quality Patches Tool (QPT) 1.1.68 is installed. The patch ID is ACSD-58131. Please note that this issue is scheduled to be fixed in ÃÛ¶¹ÊÓÆµ Commerce 2.5.0.

Affected products and versions

The patch is created for ÃÛ¶¹ÊÓÆµ Commerce version:

  • ÃÛ¶¹ÊÓÆµ Commerce (all deployment methods) 2.4.6-p4

Compatible with ÃÛ¶¹ÊÓÆµ Commerce versions:

  • ÃÛ¶¹ÊÓÆµ Commerce (all deployment methods) 2.4.4 - 2.4.7-p6
NOTE
The patch might become applicable to other versions with new Quality Patches Tool releases. To check if the patch is compatible with your ÃÛ¶¹ÊÓÆµ Commerce version, update the magento/quality-patches package to the latest version and check the compatibility on the Quality Patches Tool: Search for patches page. Use the patch ID as a search keyword to locate the patch.

Issue

When a 0-byte image is placed in the media gallery directory, the old media gallery fails to render any images. The updated system now skips invalid 0-byte files, displays valid images as expected, and logs a warning for each invalid file.

[2024-05-02T14:00:39.616459+00:00] report.WARNING: The image empty2.jpg is invalid and cannot be displayed in the gallery. [] []

Steps to reproduce:

  1. Go to Stores > Configuration > Advanced > System > Media Gallery.

  2. Set Enable Old Media Gallery to Yes.

  3. Place a few images in the pub/media/wysiwyg directory.

  4. Create a 0-byte image in the same directory using touch pub/media/wysiwyg/empty_image.png.

  5. Add an image from the wysiwyg directory via Page Builder under any content (for example, a CMS Block):

    1. Create a new block. Go to Content > Elements > Blocks and click Add New Block.
    2. Edit the content section using Page Builder.
    3. Under Layout, drag a new Row to the stage.
    4. Expand Media and drag an Image placeholder into the row.
    5. Click Select from Gallery.
    6. Select the wysiwyg directory if it’s not selected by default.

Expected results:

The media gallery remains functional even if a 0-byte image (or any other file) exists.

Actual results:

The media gallery fails to load any images from the wysiwyg directory due to a critical error logged in var/log/system.log:

[2024-03-22T05:00:55.100934+00:00] report.CRITICAL: Exception: Notice: getimagesizefromstring(): Error reading from ! in /app/project/vendor/magento/module-cms/Model/Wysiwyg/Images/Storage.php on line 426 in /app/project/vendor/magento/framework/App/ErrorHandler.php:62

Apply the patch

To apply individual patches, use the following links depending on your deployment method:

To learn more about Quality Patches Tool, refer to:

recommendation-more-help
c2d96e17-5179-455c-ad3a-e1697bb4e8c3