Skip to content

Commit e9d997c

Browse files
committed
Fix logic error for preg_match() return value
1 parent 38b62cd commit e9d997c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plugins/image-prioritizer/class-image-prioritizer-background-image-styled-tag-visitor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __invoke( OD_HTML_Tag_Walker $walker ): bool {
3939
if (
4040
is_string( $style )
4141
&&
42-
false !== preg_match( '/background(-image)?\s*:[^;]*?url\(\s*[\'"]?\s*(?<background_image>.+?)\s*[\'"]?\s*\)/', $style, $matches )
42+
0 < (int) preg_match( '/background(-image)?\s*:[^;]*?url\(\s*[\'"]?\s*(?<background_image>.+?)\s*[\'"]?\s*\)/', $style, $matches )
4343
&&
4444
'' !== $matches['background_image'] // PHPStan should ideally know that this is a non-empty string based on the `.+?` regular expression.
4545
&&

0 commit comments

Comments
 (0)