Skip to content

Commit 6e04c8e

Browse files
committed
[PHP] Replace substr(PHP_OS) calls with PHP_OS_FAMILY in PHP 7.2
1 parent aa11864 commit 6e04c8e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/wp-includes/functions.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,11 +2257,11 @@ function get_temp_dir() {
22572257
* @return bool Whether the path is writable.
22582258
*/
22592259
function wp_is_writable( $path ) {
2260-
if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) {
2260+
if ( PHP_OS_FAMILY === 'Windows' ) {
22612261
return win_is_writable( $path );
2262-
} else {
2263-
return @is_writable( $path );
22642262
}
2263+
2264+
return @is_writable( $path );
22652265
}
22662266

22672267
/**

tests/phpunit/tests/filesystem/wpFilesystemDirect/base.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function create_file_if_needed( $path, $contents = '' ) {
160160
* @return bool Whether the operating system is Windows.
161161
*/
162162
public static function is_windows() {
163-
return 'WIN' === substr( PHP_OS, 0, 3 );
163+
return 'Windows' === PHP_OS_FAMILY;
164164
}
165165

166166
/**

0 commit comments

Comments
 (0)