aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-02-21 21:09:08 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2018-02-21 21:09:08 +0100
commit72e745be26647b1ce1ca3240cb2ffbe20cfe91dc (patch)
tree1c223aeb0c2a1081409e6acaaf67c11eb7cf5071
parent4d5f2e64a5c6b76d4c74b595b93bfcfc850f553a (diff)
downloadnextcloud-server-72e745be26647b1ce1ca3240cb2ffbe20cfe91dc.tar.gz
nextcloud-server-72e745be26647b1ce1ca3240cb2ffbe20cfe91dc.zip
Handle strict typing in Checker and fix tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r--lib/private/IntegrityCheck/Checker.php7
-rw-r--r--tests/lib/IntegrityCheck/CheckerTest.php3
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/private/IntegrityCheck/Checker.php b/lib/private/IntegrityCheck/Checker.php
index f1a04d0eac4..44544b6770e 100644
--- a/lib/private/IntegrityCheck/Checker.php
+++ b/lib/private/IntegrityCheck/Checker.php
@@ -333,7 +333,12 @@ class Checker {
return [];
}
- $signatureData = json_decode($this->fileAccessHelper->file_get_contents($signaturePath), true);
+ $content = $this->fileAccessHelper->file_get_contents($signaturePath);
+ $signatureData = null;
+
+ if (\is_string($content)) {
+ $signatureData = json_decode($content, true);
+ }
if(!\is_array($signatureData)) {
throw new InvalidSignatureException('Signature data not found.');
}
diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php
index 09e6990a0f3..71a9935008b 100644
--- a/tests/lib/IntegrityCheck/CheckerTest.php
+++ b/tests/lib/IntegrityCheck/CheckerTest.php
@@ -58,6 +58,9 @@ class CheckerTest extends TestCase {
$this->cacheFactory = $this->createMock(ICacheFactory::class);
$this->appManager = $this->createMock(IAppManager::class);
+ $this->config->method('getAppValue')
+ ->will($this->returnArgument(2));
+
$this->cacheFactory
->expects($this->any())
->method('createDistributed')