diff --git a/core/ajax/share.php b/core/ajax/share.php
index 2831d42a3670665493edb0d6f9327d7f54ca4423..1a2faa75dace4b7f2b0d1deeb912fb50107db794 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -73,9 +73,9 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
 				$return = OCP\Share::setPermissions(
 					$_POST['itemType'],
 					$_POST['itemSource'],
-					$_POST['shareType'],
+					(int)$_POST['shareType'],
 					$_POST['shareWith'],
-					$_POST['permissions']
+					(int)$_POST['permissions']
 				);
 				($return) ? OC_JSON::success() : OC_JSON::error();
 			}