Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Fix casting error on Utils::wp_version_compare (#11802)
Browse files Browse the repository at this point in the history
* Fix casting on Utils::wp_version_compare

* Fix linting issue

* Apply version number fix on current wp version

* Fix linter errors

* Fix linter errors
  • Loading branch information
alefesouza authored Dec 7, 2023
1 parent 2beb08a commit 9149b67
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Utils/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public static function wp_version_compare( $version, $operator = null ) {
$current_wp_version = (float) $matches[1];
}

// Replace non-alphanumeric characters with a dot.
$current_wp_version = preg_replace( '/[^0-9a-zA-Z\.]+/i', '.', $current_wp_version );
$version = preg_replace( '/[^0-9a-zA-Z\.]+/i', '.', $version );

return version_compare( $current_wp_version, $version, $operator );
}
}

0 comments on commit 9149b67

Please sign in to comment.