Fix: The check if upload_max_filesize or post_max_size is 0 fails if only one of them is 0.

$upload_max_filesize and $post_max_size need to be casted to (int) to match "=== 0"
This commit is contained in:
Roland Hager 2013-06-13 09:18:50 +02:00
parent 8c923a85de
commit a06d901e37
1 changed files with 2 additions and 2 deletions

View File

@ -787,9 +787,9 @@ class OC_Helper {
$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
$freeSpace = \OC\Files\Filesystem::free_space($dir);
if ($upload_max_filesize == 0 and $post_max_size == 0) {
if ((int)$upload_max_filesize === 0 and (int)$post_max_size === 0) {
$maxUploadFilesize = \OC\Files\FREE_SPACE_UNLIMITED;
} elseif ($upload_max_filesize === 0 or $post_max_size === 0) {
} elseif ((int)$upload_max_filesize === 0 or (int)$post_max_size === 0) {
$maxUploadFilesize = max($upload_max_filesize, $post_max_size); //only the non 0 value counts
} else {
$maxUploadFilesize = min($upload_max_filesize, $post_max_size);