]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix: The check if upload_max_filesize or post_max_size is 0 fails if only one of...
authorRoland Hager <roland.hager@tu-berlin.de>
Thu, 13 Jun 2013 07:18:50 +0000 (09:18 +0200)
committerRoland Hager <roland.hager@tu-berlin.de>
Fri, 21 Jun 2013 07:33:06 +0000 (09:33 +0200)
$upload_max_filesize and $post_max_size need to be casted to (int) to match "=== 0"

lib/helper.php

index a315c640d1a70c006adb9cb8a5bd6035173c675e..1860a55fc8fd7a3515341d5ad8ebbc534ed8bacf 100644 (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);