Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter drinkmaker

    (@drinkmaker)

    Thank you for taking the time to look into this issue.

    I have prepared a small test site with a live example where the problem can be clearly seen:
    https://speed-optimizer-bug.instawp.site/

    In this test I am using the official SiteGround logo image. The important part is that the filename contains the word logo, and at the same time the image has a CSS class logo. When both conditions are met, the image URL gets modified incorrectly and the image becomes broken.

    In the example you shared, the issue does not appear because the image has multiple classes, for example:
    wp-image-6 ls-is-cached lazyloaded
    With these classes, the bug is not triggered.

    However, if you replace those classes with a single class like logo, the issue can be reproduced on your side as well.

    When images are inserted via the WordPress editor, they usually have multiple classes, so the problem does not show up there, which matches your example. In our case, the issue appears in a custom template where the image is rendered like this:

    echo wp_get_attachment_image( $image_id, ‘full’, false, [
    ‘alt’ => $image_alt,
    ‘class’ => ‘logo’,
    ] );

    If the filename contains the word logo, the image is not displayed.

    Thank you again for your attention to this problem, and I hope this example helps to clarify when and why the issue occurs.

    This is not a bug, it’s a feature 🙂
    Codex:

    NOTE: Since 4.8.3, ‘%’ characters will be replaced with a placeholder string, this prevents certain SQLi attacks from taking place. This change in behaviour may cause issues for code that expects the return value of esc_sql() to be useable for other purposes.

Viewing 2 replies - 1 through 2 (of 2 total)