From ca28df6fcc633a1e6a93bd2e19714e64899cd134 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Fri, 12 Jan 2018 16:30:35 +0100 Subject: [PATCH 1/2] Adds type hinting for scalar types in ICrypto->decrypt Signed-off-by: Morris Jobke --- lib/private/Security/Crypto.php | 2 +- lib/public/Security/ICrypto.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/Security/Crypto.php b/lib/private/Security/Crypto.php index 1dd680ea13..d2be148427 100644 --- a/lib/private/Security/Crypto.php +++ b/lib/private/Security/Crypto.php @@ -108,7 +108,7 @@ class Crypto implements ICrypto { * @return string plaintext * @throws \Exception If the HMAC does not match */ - public function decrypt($authenticatedCiphertext, $password = '') { + public function decrypt(string $authenticatedCiphertext, string $password = ''): string { if($password === '') { $password = $this->config->getSystemValue('secret'); } diff --git a/lib/public/Security/ICrypto.php b/lib/public/Security/ICrypto.php index 0de2e47b75..aa2b9eed2c 100644 --- a/lib/public/Security/ICrypto.php +++ b/lib/public/Security/ICrypto.php @@ -61,5 +61,5 @@ interface ICrypto { * @throws \Exception If the HMAC does not match * @since 8.0.0 */ - public function decrypt($authenticatedCiphertext, $password = ''); + public function decrypt(string $authenticatedCiphertext, string $password = ''): string; } From 8d1dd1945fa6f5f382224da6bbd333ded8f2a31f Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Sat, 13 Jan 2018 13:58:06 +0100 Subject: [PATCH 2/2] Fix tests Signed-off-by: Roeland Jago Douma --- tests/Core/Controller/LostControllerTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php index 1e51de649e..f35d3b37b8 100644 --- a/tests/Core/Controller/LostControllerTest.php +++ b/tests/Core/Controller/LostControllerTest.php @@ -653,14 +653,14 @@ class LostControllerTest extends \Test\TestCase { public function testIsSetPasswordWithoutTokenFailing() { $this->config->method('getUserValue') ->with('ValidTokenUser', 'core', 'lostpassword', null) - ->will($this->returnValue(null)); + ->willReturn('aValidtoken'); $this->userManager->method('get') ->with('ValidTokenUser') ->willReturn($this->existingUser); $this->crypto->method('decrypt') ->with( - $this->equalTo(''), + $this->equalTo('aValidtoken'), $this->equalTo('test@example.comSECRET') )->willThrowException(new \Exception());