[Smush Pro] Bug in Smush with "Excluded Class" detection

I’ve noticed that Smush cannot detect excluded classes when image attributes are written with single quotes.

I.e. I have added the class ‘.mega-menu-logo’ to be excluded.
The website did use following img-tag: < img class='mega-menu-logo' src='mylogo.png' />

After Smush processed that image, the output is:
< img src="image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" />

The problem:

Smush does not detect single quotes in attributes.
The bug is in file wp-smush-pro/core/moduless/helpers/class-parser.php
The function “get_attribute()” has a bug in the regex.

My suggestion is this Regex: "/{$name}=(['\"])(.+?)\1/is"
https://www.screencast.com/t/l669nhb2
(when using my suggestion, please remember to also change $value[1] to $value[2] in the line after the regex)

I hope this helps :slight_smile:
Philipp