Add extra check so we don't error out on type

json_decode can return false if we have invalid data.
In that case just assume there was nothing cached

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-01-16 22:06:57 +01:00
parent cdfffe7bda
commit 569b8413d4
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 4 additions and 1 deletions

View File

@ -65,7 +65,10 @@ class DiscoveryService implements IDiscoveryService {
// Check the cache first
$cacheData = $this->cache->get($remote . '#' . $service);
if($cacheData) {
return json_decode($cacheData, true);
$data = json_decode($cacheData, true);
if (\is_array($data)) {
return $data;
}
}
$discoveredServices = [];