Exclude images based on their image style regex error.

Created on 13 January 2016, almost 9 years ago
Updated 10 August 2023, over 1 year ago

When using image lazyloader and the "Exclude images based on their image style" function i got this error.
Error: "Compilation failed: range out of order in character class at offset 121". This is because in lazyloader_excluded_by_image_style function

This is because the regex in lazyloader_excluded_by_image_style will fail if Image style name contains certain non escaped characters, in my case a hyphen "-".
Looking closer at the code there was more stuff going on...for example the enabled image style names were compared to the current image url - but we have access to the current image style name through $variables['style_name'].

see patch attached.

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇦🇹Austria office@w3k.at

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024