diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index ed41eed8c7..c2fe1228bf 100644
--- a/src/wp-includes/functions.php
+++ b/src/wp-includes/functions.php
@@ -2257,11 +2257,11 @@ function get_temp_dir() {
  * @return bool Whether the path is writable.
  */
 function wp_is_writable( $path ) {
-	if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) {
+	if ( 'Windows' === PHP_OS_FAMILY ) {
 		return win_is_writable( $path );
-	} else {
-		return @is_writable( $path );
 	}
+
+	return @is_writable( $path );
 }
 
 /**
diff --git a/tests/phpunit/tests/filesystem/wpFilesystemDirect/base.php b/tests/phpunit/tests/filesystem/wpFilesystemDirect/base.php
index dc1252bd3a..97165de5c8 100644
--- a/tests/phpunit/tests/filesystem/wpFilesystemDirect/base.php
+++ b/tests/phpunit/tests/filesystem/wpFilesystemDirect/base.php
@@ -160,7 +160,7 @@ abstract class WP_Filesystem_Direct_UnitTestCase extends WP_UnitTestCase {
 	 * @return bool Whether the operating system is Windows.
 	 */
 	public static function is_windows() {
-		return 'WIN' === substr( PHP_OS, 0, 3 );
+		return 'Windows' === PHP_OS_FAMILY;
 	}
 
 	/**