Make WordPress Core

Ticket #55635: 55635.3.diff

File 55635.3.diff, 2.1 KB (added by dd32, 4 years ago)
  • wp-includes/load.php

    function is_ssl() { 
    14171417
    14181418                if ( '1' == $_SERVER['HTTPS'] ) {
    14191419                        return true;
    14201420                }
    14211421        } elseif ( isset( $_SERVER['SERVER_PORT'] ) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
    14221422                return true;
    14231423        }
    14241424        return false;
    14251425}
    14261426
    14271427/**
    14281428 * Converts a shorthand byte value to an integer byte value.
    14291429 *
    14301430 * @since 2.3.0
    14311431 * @since 4.6.0 Moved from media.php to load.php.
     1432 * @since 6.1.0 More closely resembles PHP parsing.
    14321433 *
    14331434 * @link https://www.php.net/manual/en/function.ini-get.php
    14341435 * @link https://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
    14351436 *
    14361437 * @param string $value A (PHP ini) byte value, either shorthand or ordinary.
    14371438 * @return int An integer byte value.
    14381439 */
    14391440function wp_convert_hr_to_bytes( $value ) {
    1440         $value = strtolower( trim( $value ) );
    1441         $bytes = (int) $value;
    1442 
    1443         if ( false !== strpos( $value, 'g' ) ) {
    1444                 $bytes *= GB_IN_BYTES;
    1445         } elseif ( false !== strpos( $value, 'm' ) ) {
    1446                 $bytes *= MB_IN_BYTES;
    1447         } elseif ( false !== strpos( $value, 'k' ) ) {
     1441        $value = rtrim( $value );
     1442        $multi = strtolower( substr( $value, -1 );
     1443        $value = rtrim( $value, 'GgMmKk' ); // not technically needed, as intval will skip invalid chars.
     1444        $bytes = intval( $value, 0 );
     1445
     1446        if ( 'g' === $multiplier ) {
     1447                $bytes *= GB_IN_BYES;
     1448        } elseif ( 'm' === $multiplier ) {
     1449                $bytes *= MB_IN_BYES;
     1450        } elseif ( 'k' === $multiplier ) {
    14481451                $bytes *= KB_IN_BYTES;
    14491452        }
    14501453
    1451         // Deal with large (float) values which run into the maximum integer size.
    1452         return min( $bytes, PHP_INT_MAX );
     1454        return (int) $bytes;
    14531455}
    14541456
    14551457/**
    14561458 * Determines whether a PHP ini value is changeable at runtime.
    14571459 *
    14581460 * @since 4.6.0
    14591461 *
    14601462 * @link https://www.php.net/manual/en/function.ini-get-all.php
    14611463 *
    14621464 * @param string $setting The name of the ini setting to check.
    14631465 * @return bool True if the value is changeable at runtime. False otherwise.
    14641466 */
    14651467function wp_is_ini_value_changeable( $setting ) {
    14661468        static $ini_all;
    14671469