diff options
author | Joas Schilling <coding@schilljs.com> | 2023-04-04 10:54:12 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-04-04 10:54:12 +0200 |
commit | 131f481a67766d9bc5629948cc0abe1424308f00 (patch) | |
tree | 2967b50bff1b82239749b9689134759ec6b9676c /lib | |
parent | 7fdb23928f793c8eda6b175a602750c718711cfd (diff) | |
download | nextcloud-server-131f481a67766d9bc5629948cc0abe1424308f00.tar.gz nextcloud-server-131f481a67766d9bc5629948cc0abe1424308f00.zip |
fix(initial-state): Log an error when initial-state can not be JSON encoded
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/InitialStateService.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/InitialStateService.php b/lib/private/InitialStateService.php index 1d997e4133a..c10442a5267 100644 --- a/lib/private/InitialStateService.php +++ b/lib/private/InitialStateService.php @@ -64,7 +64,11 @@ class InitialStateService implements IInitialStateService { if (!isset($this->states[$appName])) { $this->states[$appName] = []; } - $this->states[$appName][$key] = json_encode($data); + try { + $this->states[$appName][$key] = json_encode($data, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + $this->logger->error('Invalid '. $key . ' data provided to provideInitialState by ' . $appName, ['exception' => $e]); + } return; } |