Support requests in Drupal Core are not well attended. Is this a bug report?
- Status changed to Closed: outdated
about 1 month ago 3:01am 15 November 2024
Hi,
I'm getting this warning:
Warning: Undefined array key "status" in Drupal\Core\Entity\ContentEntityBase->Drupal\Core\Entity\{closure}() (line 1013 of /var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php)
I think it's simple. Can we controle if the "status" key exists to avoid the warning?
I found the warning in the next two cases that I've just controled:
public function getTranslationLanguages($include_default = TRUE) {
$translations = array_filter($this->translations, function ($translation) {
if (array_key_exists('status', $translation)) {
return $translation['status'];
}
});
unset($translations[LanguageInterface::LANGCODE_DEFAULT]);
if ($include_default) {
$translations[$this->defaultLangcode] = TRUE;
}
// Now load language objects based upon translation langcodes.
return array_intersect_key($this->getLanguages(), $translations);
}
public function postSave(EntityStorageInterface $storage, $update = TRUE) {
parent::postSave($storage, $update);
// Update the status of all saved translations.
$removed = [];
foreach ($this->translations as $langcode => &$data) {
if (array_key_exists('status', $data)) {
if ($data['status'] == static::TRANSLATION_REMOVED) {
$removed[$langcode] = TRUE;
}
else {
$data['status'] = static::TRANSLATION_EXISTING;
}
}
}
$this->translations = array_diff_key($this->translations, $removed);
// Reset the new revision flag.
$this->newRevision = FALSE;
// Reset the enforcement of the revision translation affected flag.
$this->enforceRevisionTranslationAffected = [];
}
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Support requests in Drupal Core are not well attended. Is this a bug report?