Make WordPress Core


Ignore:
Timestamp:
07/07/2024 12:42:44 PM (9 months 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.

File:
1 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 ( 'Windows' === PHP_OS_FAMILY ) {
    22612261        return win_is_writable( $path );
    2262     } else {
    2263         return @is_writable( $path );
    2264     }
     2262    }
     2263
     2264    return @is_writable( $path );
    22652265}
    22662266
Note: See TracChangeset for help on using the changeset viewer.