-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
Description
Undefined variable: lazy_sources in Image.php on line 273
We need to either move $lazy_sources = 0; outside of if ( preg_match_all()){} or move if ( 0 === $lazy_sources ){} inside of if ( preg_match_all()){} (like we do on WP Rocket).
rocket-lazy-load/src/Dependencies/RocketLazyload/Image.php
Lines 259 to 275 in 4332a0d
| if ( preg_match_all( '#<source(?<atts>\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 ); | |
| unset( $lazyload_srcset ); | |
| $lazy_sources++; | |
| } | |
| } | |
| if ( 0 === $lazy_sources ) { | |
| continue; | |
| } |