Extension: Helix Ultimate (system plugin)
Version: (latest, Joomla 6)
Description:
The onAfterRender() image lazy loading feature in plugins/system/helixultimate/helixultimate.php has two bugs that break image loading for any component that already uses data-src attributes for its own lazy loading (e.g., EasyStore product thumbnails).
Bug 1: Regex matches data-src inside src pattern
At line ~874:
$imageElement = preg_replace("@src(?=\=[\"\']([^\"\']*)[\"\'])@", "data-src", $imageElement);
The regex src(?=\=...) matches src= inside data-src=, renaming data-src → data-data-src and src → data-src. The component's actual image URL ends up in data-data-src (which no lazy loader reads), and data-src points to the placeholder. Images never load.
Suggested fix: Use a negative lookbehind to exclude data- prefixed attributes:
$imageElement = preg_replace("@(?<!data-)src(?=\=[\"\']([^\"\']*)[\"\'])@", "data-src", $imageElement);
Bug 2: Double slash in generated URLs
At line ~847-849:
if (preg_match("@(^images\/|^\/+images\/).*$@", $match))
{
$update = Uri::base() . $_match;
Uri::base() returns a URL with a trailing slash (e.g., example.com/). When $_match starts with /images/..., the concatenation produces example.com//images/... — a double slash.
Suggested fix: Strip the leading slash before concatenating:
$update = rtrim(Uri::base(), '/') . '/' . ltrim($_match, '/');
Steps to reproduce:
- Enable
image_lazy_loading in Helix Ultimate template settings.
- Install EasyStore and add products with images.
- View a product listing page (e.g.,
/accessories).
- Inspect the image elements —
data-src will point to the placeholder, data-data-src will contain the actual image URL with a double slash, and images will not load.
Expected behavior: Helix's lazy loading should only process <img> tags that use src= (not data-src=), and should not produce URLs with double slashes.
Actual behavior: data-src attributes are renamed to data-data-src, src is renamed to data-src, and URLs contain double slashes. Images fail to load.