Make WordPress Core

Changeset 38101


Ignore:
Timestamp:
07/19/2016 11:54:09 AM (8 years ago)
Author:
ocean90
Message:

Filesystem API: Ensure memory limit calculations by PclZip are using integers.

This prevents a warning in PHP trunk, see https://wiki.php.net/rfc/invalid_strings_in_arithmetic.

See #36435.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-pclzip.php

    r32990 r38101  
    18401840    $v_memory_limit = ini_get('memory_limit');
    18411841    $v_memory_limit = trim($v_memory_limit);
     1842    $v_memory_limit_int = (int) $v_memory_limit;
    18421843    $last = strtolower(substr($v_memory_limit, -1));
    18431844
    18441845    if($last == 'g')
    1845         //$v_memory_limit = $v_memory_limit*1024*1024*1024;
    1846         $v_memory_limit = $v_memory_limit*1073741824;
     1846        //$v_memory_limit_int = $v_memory_limit_int*1024*1024*1024;
     1847        $v_memory_limit_int = $v_memory_limit_int*1073741824;
    18471848    if($last == 'm')
    1848         //$v_memory_limit = $v_memory_limit*1024*1024;
    1849         $v_memory_limit = $v_memory_limit*1048576;
     1849        //$v_memory_limit_int = $v_memory_limit_int*1024*1024;
     1850        $v_memory_limit_int = $v_memory_limit_int*1048576;
    18501851    if($last == 'k')
    1851         $v_memory_limit = $v_memory_limit*1024;
    1852 
    1853     $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
     1852        $v_memory_limit_int = $v_memory_limit_int*1024;
     1853
     1854    $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit_int*PCLZIP_TEMPORARY_FILE_RATIO);
    18541855
    18551856
Note: See TracChangeset for help on using the changeset viewer.