Skip to content
Snippets Groups Projects
Commit 43daa83a authored by Pjotr Savitski's avatar Pjotr Savitski Committed by catch
Browse files

Issue #3281812 by pjotr.savitski, Daniel Kulbe, sourabhjain, apaderno,...

Issue #3281812 by pjotr.savitski, Daniel Kulbe, sourabhjain, apaderno, jukka792, Ammaletu: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated
parent d6dfe842
No related branches found
No related tags found
1 merge request!21Issue #3281812 by pjotr.savitski, Daniel Kulbe, sourabhjain, apaderno,...
......@@ -127,7 +127,7 @@ class H5PEditorDrupalStorage implements \H5peditorStorage {
$library->title = $details->title;
$library->runnable = $details->runnable;
$library->restricted = $super_user ? FALSE : ($details->restricted === '1' ? TRUE : FALSE);
$library->metadataSettings = json_decode($details->metadata_settings);
$library->metadataSettings = json_decode($details->metadata_settings ?? '');
$librariesWithDetails[] = $library;
}
}
......@@ -153,7 +153,7 @@ class H5PEditorDrupalStorage implements \H5peditorStorage {
// Convert result object properties to camelCase.
$library = \H5PCore::snakeToCamel($library, true);
$library->metadataSettings = json_decode($library->metadataSettings);
$library->metadataSettings = json_decode($library->metadataSettings ?? '');
// Make sure we only display the newest version of a library.
foreach ($libraries as $existingLibrary) {
......
......@@ -246,7 +246,7 @@ class H5PContent extends ContentEntityBase implements ContentEntityInterface {
public function getMetadata() {
$metadata = [
'title' => $this->get('title')->value,
'authors' => json_decode($this->get('authors')->value),
'authors' => json_decode($this->get('authors')->value ?? ''),
'source' => $this->get('source')->value,
'yearFrom' => $this->get('year_from')->value,
'yearTo' => $this->get('year_to')->value,
......@@ -255,7 +255,7 @@ class H5PContent extends ContentEntityBase implements ContentEntityInterface {
'licenseExtras' => $this->get('license_extras')->value,
'authorComments' => $this->get('author_comments')->value,
'defaultLanguage' => $this->get('default_language')->value,
'changes' => json_decode($this->get('changes')->value),
'changes' => json_decode($this->get('changes')->value ?? ''),
];
foreach ($metadata as $key => $data) {
if (is_null($data)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment