diff --git a/apps/dav/lib/Connector/Sabre/ShareTypeList.php b/apps/dav/lib/Connector/Sabre/ShareTypeList.php index bacbdc99a7398..49b167a0be75a 100644 --- a/apps/dav/lib/Connector/Sabre/ShareTypeList.php +++ b/apps/dav/lib/Connector/Sabre/ShareTypeList.php @@ -86,7 +86,7 @@ public static function xmlDeserialize(Reader $reader) { */ public function xmlSerialize(Writer $writer) { foreach ($this->shareTypes as $shareType) { - $writer->writeElement('{' . self::NS_OWNCLOUD . '}share-type', $shareType); + $writer->writeElement('{' . self::NS_OWNCLOUD . '}share-type', (string)$shareType); } } } diff --git a/apps/dav/lib/Connector/Sabre/ShareeList.php b/apps/dav/lib/Connector/Sabre/ShareeList.php index e43f552a8ccb3..ea29ea74a0407 100644 --- a/apps/dav/lib/Connector/Sabre/ShareeList.php +++ b/apps/dav/lib/Connector/Sabre/ShareeList.php @@ -55,7 +55,7 @@ public function xmlSerialize(Writer $writer) { $writer->startElement('{' . self::NS_NEXTCLOUD . '}sharee'); $writer->writeElement('{' . self::NS_NEXTCLOUD . '}id', $share->getSharedWith()); $writer->writeElement('{' . self::NS_NEXTCLOUD . '}display-name', $share->getSharedWithDisplayName()); - $writer->writeElement('{' . self::NS_NEXTCLOUD . '}type', $share->getShareType()); + $writer->writeElement('{' . self::NS_NEXTCLOUD . '}type', (string)$share->getShareType()); $writer->endElement(); } } diff --git a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php index c5e1a8b4e7e9e..1651fb819afdf 100644 --- a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php +++ b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php @@ -134,7 +134,7 @@ public function createShare() { $owner = isset($_POST['owner']) ? $_POST['owner'] : null; $sharedBy = isset($_POST['sharedBy']) ? $_POST['sharedBy'] : null; $shareWith = isset($_POST['shareWith']) ? $_POST['shareWith'] : null; - $remoteId = isset($_POST['remoteId']) ? (int)$_POST['remoteId'] : null; + $remoteId = isset($_POST['remoteId']) ? (string)($_POST['remoteId']) : null; $sharedByFederatedId = isset($_POST['sharedByFederatedId']) ? $_POST['sharedByFederatedId'] : null; $ownerFederatedId = isset($_POST['ownerFederatedId']) ? $_POST['ownerFederatedId'] : null; @@ -186,7 +186,7 @@ public function createShare() { * * create re-share on behalf of another user * - * @param int $id + * @param string $id * @return Http\DataResponse * @throws OCSBadRequestException * @throws OCSException @@ -195,13 +195,10 @@ public function createShare() { public function reShare($id) { $token = $this->request->getParam('token', null); $shareWith = $this->request->getParam('shareWith', null); - $permission = (int)$this->request->getParam('permission', null); - $remoteId = (int)$this->request->getParam('remoteId', null); + $remoteId = $this->request->getParam('remoteId', null); - if ($id === null || - $token === null || + if ($token === null || $shareWith === null || - $permission === null || $remoteId === null ) { throw new OCSBadRequestException(); @@ -210,7 +207,7 @@ public function reShare($id) { $notification = [ 'sharedSecret' => $token, 'shareWith' => $shareWith, - 'senderId' => $remoteId, + 'senderId' => (int)$remoteId, 'message' => 'Recipient of a share ask the owner to reshare the file' ]; @@ -239,7 +236,7 @@ public function reShare($id) { * * accept server-to-server share * - * @param int $id + * @param string $id * @return Http\DataResponse * @throws OCSException * @throws ShareNotFound @@ -274,7 +271,7 @@ public function acceptShare($id) { * * decline server-to-server share * - * @param int $id + * @param string $id * @return Http\DataResponse * @throws OCSException */ @@ -307,7 +304,7 @@ public function declineShare($id) { * * remove server-to-server share if it was unshared by the owner * - * @param int $id + * @param string $id * @return Http\DataResponse * @throws OCSException */ @@ -343,7 +340,7 @@ private function cleanupRemote($remote) { * * federated share was revoked, either by the owner or the re-sharer * - * @param int $id + * @param string $id * @return Http\DataResponse * @throws OCSBadRequestException */ @@ -384,7 +381,7 @@ private function isS2SEnabled($incoming = false) { * * update share information to keep federated re-shares in sync * - * @param int $id + * @param string $id * @return Http\DataResponse * @throws OCSBadRequestException */ @@ -437,7 +434,7 @@ protected function ncPermissions2ocmPermissions($ncPermissions) { * * change the owner of a server-to-server share * - * @param int $id + * @param string $id * @return Http\DataResponse * @throws \InvalidArgumentException * @throws OCSException diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index b4fedecfd4214..360e05bfd77e6 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -229,7 +229,7 @@ public function create(IShare $share) { if ($remoteShare) { try { $ownerCloudId = $this->cloudIdManager->getCloudId($remoteShare['owner'], $remoteShare['remote']); - $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time(), $shareType, $expirationDate); + $shareId = (string)$this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time(), $shareType, $expirationDate); $share->setId($shareId); [$token, $remoteId] = $this->askOwnerToReShare($shareWith, $share, $shareId); // remote share was create successfully if we get a valid token as return @@ -312,7 +312,7 @@ protected function createFederatedShare(IShare $share) { } if ($failure) { - $this->removeShareFromTableById($shareId); + $this->removeShareFromTableById((string)$shareId); $message_t = $this->l->t('Sharing %1$s failed, could not find %2$s, maybe the server is currently unreachable or uses a self-signed certificate.', [$share->getNode()->getName(), $share->getSharedWith()]); throw new \Exception($message_t); @@ -901,7 +901,7 @@ private function getRawShare($id) { */ private function createShareObject($data) { $share = new Share($this->rootFolder, $this->userManager); - $share->setId((int)$data['id']) + $share->setId((string)$data['id']) ->setShareType((int)$data['share_type']) ->setPermissions((int)$data['permissions']) ->setTarget($data['file_target']) diff --git a/apps/federatedfilesharing/lib/Notifications.php b/apps/federatedfilesharing/lib/Notifications.php index 2a162abcd76ba..93b998f66eea6 100644 --- a/apps/federatedfilesharing/lib/Notifications.php +++ b/apps/federatedfilesharing/lib/Notifications.php @@ -90,7 +90,7 @@ public function __construct( * @param string $token * @param string $shareWith * @param string $name - * @param string $remoteId + * @param int $remoteId * @param string $owner * @param string $ownerFederatedId * @param string $sharedBy diff --git a/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php b/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php index 370ef8dc32a56..c448316b14c8b 100644 --- a/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php +++ b/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php @@ -378,7 +378,7 @@ private function shareAccepted($id, array $notification) { $token = $notification['sharedSecret']; - $share = $this->federatedShareProvider->getShareById($id); + $share = $this->federatedShareProvider->getShareById((int)$id); $this->verifyShare($share, $token); $this->executeAcceptShare($share); @@ -448,7 +448,7 @@ protected function shareDeclined($id, array $notification) { $token = $notification['sharedSecret']; - $share = $this->federatedShareProvider->getShareById($id); + $share = $this->federatedShareProvider->getShareById((int)$id); $this->verifyShare($share, $token); @@ -515,7 +515,7 @@ private function undoReshare($id, array $notification) { } $token = $notification['sharedSecret']; - $share = $this->federatedShareProvider->getShareById($id); + $share = $this->federatedShareProvider->getShareById((int)$id); $this->verifyShare($share, $token); $this->federatedShareProvider->removeShareFromTable($share); @@ -637,7 +637,7 @@ protected function reshareRequested($id, array $notification) { } $senderId = $notification['senderId']; - $share = $this->federatedShareProvider->getShareById($id); + $share = $this->federatedShareProvider->getShareById((int)$id); // We have to respect the default share permissions $permissions = $share->getPermissions() & (int)$this->config->getAppValue('core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL); diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index af3d14b49bcb6..9436d45382c6c 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -758,7 +758,7 @@ protected function addShareToDB( * @return IShare The share object */ public function update(IShare $share, $plainTextPassword = null) { - $originalShare = $this->getShareById($share->getId()); + $originalShare = $this->getShareById((int)$share->getId()); // a real password was given $validPassword = $plainTextPassword !== null && $plainTextPassword !== ''; @@ -1029,7 +1029,7 @@ protected function removeShareFromTable(int $shareId): void { */ protected function createShareObject($data) { $share = new Share($this->rootFolder, $this->userManager); - $share->setId((int)$data['id']) + $share->setId((string)$data['id']) ->setShareType((int)$data['share_type']) ->setPermissions((int)$data['permissions']) ->setTarget($data['file_target']) diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 9dd862abb3175..48f036062158b 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -255,7 +255,7 @@ public function create(\OCP\Share\IShare $share) { * @throws \OCP\Files\NotFoundException */ public function update(\OCP\Share\IShare $share) { - $originalShare = $this->getShareById($share->getId()); + $originalShare = $this->getShareById((int)$share->getId()); $shareAttributes = $this->formatShareAttributes($share->getAttributes()); @@ -593,7 +593,7 @@ public function restore(IShare $share, string $recipient): IShare { $qb->execute(); - return $this->getShareById($share->getId(), $recipient); + return $this->getShareById((int)$share->getId(), $recipient); } /** @@ -1070,7 +1070,7 @@ public function getShareByToken($token) { */ private function createShare($data) { $share = new Share($this->rootFolder, $this->userManager); - $share->setId((int)$data['id']) + $share->setId((string)$data['id']) ->setShareType((int)$data['share_type']) ->setPermissions((int)$data['permissions']) ->setTarget($data['file_target']) diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 1661b1d6a61bd..69e969b50cc03 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -1455,7 +1455,7 @@ public function getShareById($id, $recipient = null) { throw new ShareNotFound(); } - $share = $provider->getShareById($id, $recipient); + $share = $provider->getShareById((int)$id, $recipient); $this->checkExpireDate($share);