str_replace bug
-
Hello,
Just discovered a bug in
filter_images
method fromBJLL
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.
- The topic ‘str_replace bug’ is closed to new replies.