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.

git-svn-id: https://develop.svn.wordpress.org/trunk@38101 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling 2016-07-19 11:54:09 +00:00
parent b92c1c58b3
commit b9606d3c4a

View File

@ -1839,18 +1839,19 @@
// ----- Get 'memory_limit' configuration value // ----- Get 'memory_limit' configuration value
$v_memory_limit = ini_get('memory_limit'); $v_memory_limit = ini_get('memory_limit');
$v_memory_limit = trim($v_memory_limit); $v_memory_limit = trim($v_memory_limit);
$v_memory_limit_int = (int) $v_memory_limit;
$last = strtolower(substr($v_memory_limit, -1)); $last = strtolower(substr($v_memory_limit, -1));
if($last == 'g') if($last == 'g')
//$v_memory_limit = $v_memory_limit*1024*1024*1024; //$v_memory_limit_int = $v_memory_limit_int*1024*1024*1024;
$v_memory_limit = $v_memory_limit*1073741824; $v_memory_limit_int = $v_memory_limit_int*1073741824;
if($last == 'm') if($last == 'm')
//$v_memory_limit = $v_memory_limit*1024*1024; //$v_memory_limit_int = $v_memory_limit_int*1024*1024;
$v_memory_limit = $v_memory_limit*1048576; $v_memory_limit_int = $v_memory_limit_int*1048576;
if($last == 'k') if($last == 'k')
$v_memory_limit = $v_memory_limit*1024; $v_memory_limit_int = $v_memory_limit_int*1024;
$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO); $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit_int*PCLZIP_TEMPORARY_FILE_RATIO);
// ----- Sanity check : No threshold if value lower than 1M // ----- Sanity check : No threshold if value lower than 1M