diff options
author | Marc Alexander <admin@m-a-styles.de> | 2019-10-20 20:59:06 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2019-10-20 20:59:06 +0200 |
commit | e75071fbd224f555309a91897efa10f2c4a9e90a (patch) | |
tree | d0082446accd777f6471049d54a0e774afd779e8 /phpBB/phpbb | |
parent | 0a133fe009bc2896c0407f6ab968bb0bebe9ef3a (diff) | |
parent | 4e3b22b33241c7237ad2e007a7fa3be4f1b38d09 (diff) | |
download | forums-e75071fbd224f555309a91897efa10f2c4a9e90a.tar forums-e75071fbd224f555309a91897efa10f2c4a9e90a.tar.gz forums-e75071fbd224f555309a91897efa10f2c4a9e90a.tar.bz2 forums-e75071fbd224f555309a91897efa10f2c4a9e90a.tar.xz forums-e75071fbd224f555309a91897efa10f2c4a9e90a.zip |
Merge branch '3.2.x' into 3.3.x
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/plupload/plupload.php | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php index 9ad12b1082..5a5b8a1874 100644 --- a/phpBB/phpbb/plupload/plupload.php +++ b/phpBB/phpbb/plupload/plupload.php @@ -274,22 +274,37 @@ class plupload } /** - * Checks various php.ini values and the maximum file size to determine - * the maximum size chunks a file can be split up into for upload - * - * @return int - */ + * Checks various php.ini values to determine the maximum chunk + * size a file should be split into for upload. + * + * The intention is to calculate a value which reflects whatever + * the most restrictive limit is set to. And to then set the chunk + * size to half that value, to ensure any required transfer overhead + * and POST data remains well within the limit. Or, if all of the + * limits are set to unlimited, the chunk size will also be unlimited. + * + * @return int + * + * @access public + */ public function get_chunk_size() { - $max = min( + $max = 0; + + $limits = [ + $this->php_ini->getBytes('memory_limit'), $this->php_ini->getBytes('upload_max_filesize'), $this->php_ini->getBytes('post_max_size'), - max(1, $this->php_ini->getBytes('memory_limit')), - $this->config['max_filesize'] - ); + ]; + + foreach ($limits as $limit_type) + { + if ($limit_type > 0) + { + $max = ($max !== 0) ? min($limit_type, $max) : $limit_type; + } + } - // Use half of the maximum possible to leave plenty of room for other - // POST data. return floor($max / 2); } |