diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index cb490ee176..c6a295802b 100644
a
|
b
|
function clean_dirsize_cache( $path ) { |
8713 | 8713 | function is_wp_version_compatible( $required ) { |
8714 | 8714 | global $wp_version; |
8715 | 8715 | |
| 8716 | $valid_required = preg_replace( '/^(\d+)\.(\d+)\.0$/','$1.$2',$required ); |
| 8717 | if( is_string( $required ) && $valid_required !== $required ) { |
| 8718 | _doing_it_wrong( __FUNCTION__,'Invalid version string','X.X' ); |
| 8719 | $required = $valid_required; |
| 8720 | } |
| 8721 | |
8716 | 8722 | // Strip off any -alpha, -RC, -beta, -src suffixes. |
8717 | 8723 | list( $version ) = explode( '-', $wp_version ); |
8718 | 8724 | |
diff --git a/tests/phpunit/tests/functions/isWpVersionCompatible.php b/tests/phpunit/tests/functions/isWpVersionCompatible.php
index a6491b66e8..46d1f16e03 100644
a
|
b
|
class Tests_Functions_IsWpVersionCompatible extends WP_UnitTestCase { |
182 | 182 | ), |
183 | 183 | ); |
184 | 184 | } |
| 185 | |
| 186 | /** |
| 187 | * Tests is_wp_version_compatible() with invalid version notation like x.y.0. |
| 188 | * |
| 189 | * @expectedIncorrectUsage is_wp_version_compatible |
| 190 | */ |
| 191 | public function test_is_wp_version_compatible_with_wrong_version_notation() { |
| 192 | global $wp_version; |
| 193 | $wp_version = '6.3'; |
| 194 | $this->assertSame( true, is_wp_version_compatible( '6.3.0' ) ); |
| 195 | $wp_version = '6.3.1'; |
| 196 | $this->assertSame( false, is_wp_version_compatible( '6.3.2' ) ); |
| 197 | } |
185 | 198 | } |