• Hello,

    Just discovered a bug in filter_images method from BJLL class.

    This line:
    $replaceHTML = str_replace( 'sizes', 'data-lazy-sizes', $replaceHTML );

    Should be:
    $replaceHTML = str_replace( 'sizes=', 'data-lazy-sizes=', $replaceHTML );

    Otherwise the images with “sizes” keyword in their names will be broken (same with srcset attribute).

    Example:

    domain.com/wp-content/2017/09/Alpine-Hut-Emphasizes-Slovenia.jpg

    domain.com/wp-content/2017/09/Alpine-Hut-Emphadata-lazy-sizes-Slovenia.jpg

    A better approach would be to use DOMDocument.

    Thanks.

    • This topic was modified 7 years, 6 months ago by George J.
    • This topic was modified 7 years, 6 months ago by George J.
    • This topic was modified 7 years, 6 months ago by George J.
    • This topic was modified 7 years, 6 months ago by George J.
    • This topic was modified 7 years, 6 months ago by George J.
  • The topic ‘str_replace bug’ is closed to new replies.