From 8452b0535eefd9f2d7426500fe96b54c35823067 Mon Sep 17 00:00:00 2001 From: Sebastian Volland Date: Mon, 12 Oct 2020 15:42:17 +0200 Subject: [PATCH] Initialize `$lazy_sources` to avoid PHP notice. --- src/Dependencies/RocketLazyload/Image.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Dependencies/RocketLazyload/Image.php b/src/Dependencies/RocketLazyload/Image.php index bf09538..02e8528 100644 --- a/src/Dependencies/RocketLazyload/Image.php +++ b/src/Dependencies/RocketLazyload/Image.php @@ -256,11 +256,11 @@ public function lazyloadPictures( $html, $buffer ) { continue; } + $lazy_sources = 0; + if ( preg_match_all( '#\s.+)>#iUs', $picture['sources'], $sources, PREG_SET_ORDER ) ) { $sources = array_unique( $sources, SORT_REGULAR ); - $lazy_sources = 0; - foreach ( $sources as $source ) { $lazyload_srcset = preg_replace( '/([\s"\'])srcset/i', '\1data-lazy-srcset', $source[0] ); $html = str_replace( $source[0], $lazyload_srcset, $html );