Fix warning in toDBArray()

Prevent accessing keys of metadata that don't exist
semi-fullscreen
Oliver Tacke 2018-10-26 09:35:24 +02:00
parent 2e305ded71
commit 066ea94b11
1 changed files with 1 additions and 1 deletions

View File

@ -85,7 +85,7 @@ abstract class H5PMetadata {
continue; continue;
} }
if ($metadata[$key] === null || isset($metadata[$key])) { if (array_key_exists($key, $metadata) && ($metadata[$key] === null || isset($metadata[$key]))) {
$value = $metadata[$key]; $value = $metadata[$key];
$db_field_name = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $key)); $db_field_name = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $key));