Make WordPress Core

Changeset 58684

Timestamp:
07/07/2024 12:42:44 PM (10 days ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Replace substr( PHP_OS, 0, 3 ) calls with PHP_OS_FAMILY.

The PHP_OS_FAMILY constant indicates the operating system family PHP was built for, and is available as of PHP 7.2.0.

Reference: PHP Manual: Predefined Constants: PHP_OS_FAMILY.

Follow-up to [23255], [57753], [57985], [58678].

Props ayeshrajans, jrf.
See #61574.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r58570 r58684  
    22582258 */
    22592259function wp_is_writable( $path ) {
    2260     if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) {
     2260    if ( 'W ) {
    22612261        return win_is_writable( $path );
    2262     } else {
    2263         return @is_writable( $path );
    2264     }
     2262    }
     2263
     2264   
    22652265}
    22662266
  • trunk/tests/phpunit/tests/filesystem/wpFilesystemDirect/base.php

    r57753 r58684  
    161161     */
    162162    public static function is_windows() {
    163         return 'WIN' === substr( PHP_OS, 0, 3 );
     163        return 'W;
    164164    }
    165165
Note: See TracChangeset for help on using the changeset viewer.