diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index ed41eed8c791d..c2fe1228bf1d6 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 dc1252bd3a29c..97165de5c88df 100644 --- a/tests/phpunit/tests/filesystem/wpFilesystemDirect/base.php +++ b/tests/phpunit/tests/filesystem/wpFilesystemDirect/base.php @@ -160,7 +160,7 @@ public function create_file_if_needed( $path, $contents = '' ) { * @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; } /**