Using null as an array offset is deprecated error on admin/content and admin/people
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3583491. -->
Reported by: [rkoller](https://www.drupal.org/user/3217695)
Related to !785
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Initial report was in <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-3"><a href="https://www.drupal.org/project/drupal/issues/3580668" title="Status: Closed (duplicate)">#3580668: Using null as an array offset is deprecated error on admin/content and admin/people</a></span> but it turns out as @jurgenhaas suspected that the problem applies to Gin5.x as well. Problem is, when visiting <code>admin/content</code> and creating a new node the following errors is returned (on drupal 11.3.5, Gin 5.x using php 8.5.3):</p>
<pre>Deprecated function: Using null as an array offset is deprecated, use an empty string instead in Drupal\Core\Entity\ContentEntityBase->hasTranslation() (line 984 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).<br>Drupal\Core\Entity\ContentEntityBase->hasTranslation() (Line: 1911)<br>Twig\Extension\CoreExtension::getAttribute() (Line: 46)<br>__TwigTemplate_5e14f0a02c4058d41bf7481384abf802->doDisplay() (Line: 402)<br>Twig\Template->yield() (Line: 386)<br>Twig\Template->render() (Line: 51)<br>Twig\TemplateWrapper->render() (Line: 35)<br>Drupal\Core\Template\TwigThemeEngine->renderTemplate() (Line: 428)<br>Drupal\Core\Theme\ThemeManager->render() (Line: 500)<br>Drupal\Core\Render\Renderer->doRender() (Line: 230)<br>Drupal\Core\Render\Renderer->render() (Line: 1809)<br>Drupal\views\Plugin\views\field\FieldPluginBase->theme() (Line: 778)<br>Drupal\views\Plugin\views\style\StylePluginBase->elementPreRenderRow()<br>call_user_func_array() (Line: 107)<br>Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 910)<br>Drupal\Core\Render\Renderer->doCallback() (Line: 441)<br>Drupal\Core\Render\Renderer->doRender() (Line: 230)<br>Drupal\Core\Render\Renderer->render() (Line: 715)<br>Drupal\views\Plugin\views\style\StylePluginBase->renderFields() (Line: 579)<br>Drupal\views\Plugin\views\style\StylePluginBase->renderGrouping() (Line: 467)<br>Drupal\views\Plugin\views\style\StylePluginBase->render() (Line: 2195)<br>Drupal\views\Plugin\views\display\DisplayPluginBase->render() (Line: 1591)<br>Drupal\views\ViewExecutable->render() (Line: 201)<br>Drupal\views\Plugin\views\display\Page->execute() (Line: 1686)<br>Drupal\views\ViewExecutable->executeDisplay() (Line: 80)<br>Drupal\views\Element\View::preRenderViewElement()<br>call_user_func_array() (Line: 107)<br>Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 910)<br>Drupal\Core\Render\Renderer->doCallback() (Line: 441)<br>Drupal\Core\Render\Renderer->doRender() (Line: 230)<br>Drupal\Core\Render\Renderer->render() (Line: 242)<br>Drupal\Core\Render\MainContent\HtmlRenderer->{closure:Drupal\Core\Render\MainContent\HtmlRenderer::prepare():235}() (Line: 634)<br>Drupal\Core\Render\Renderer::{closure:Drupal\Core\Render\Renderer::executeInRenderContext():634}()<br>Fiber->resume() (Line: 649)<br>Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 235)<br>Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 131)<br>Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)<br>Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() (Line: 246)<br>Symfony\Component\EventDispatcher\EventDispatcher::{closure:Symfony\Component\EventDispatcher\EventDispatcher::optimizeListeners():241}() (Line: 206)<br>Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)<br>Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 188)<br>Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)<br>Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)<br>Drupal\Core\StackMiddleware\Session->handle() (Line: 48)<br>Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)<br>Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)<br>Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 118)<br>Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 92)<br>Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)<br>Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)<br>Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)<br>Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 54)<br>Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 745)<br>Drupal\Core\DrupalKernel->handle() (Line: 19)</pre><p>in contrast to drupal core and the default_admin theme where the errors are shown all the time on every page load, for gin 5.x and drupal 11 the error is only shown after you revisit <code>admin/content</code> for the first time after a new node was created. after reloading the page the error is not displayed again. Visiting <code>admin/people</code> the error is shown as well. I am not sure if there are more entities aside those two that are affected by this problem. </p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<ul>
<li>on an install of drupal 11 set the administration theme to gin on <code>admin/appearance</code></li>
<li>go to <code>admin/content</code></li>
<li>create one or two new nodes and revisit the node list page right after each creation.</li>
<li>go to <code>admin/people</code></li>
<li>create one or two more users and revisit the user list page right after each creation</li>
</ul>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Fix the deprecation on <code>admin/content</code> and <code>admin/people</code> and ensure that no other entities are affected alongside as well. if that is the case fix the deprecation for those as well.</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<h3 id="summary-ui-changes">User interface changes</h3>
<h3 id="summary-api-changes">API changes</h3>
<h3 id="summary-data-model-changes">Data model changes</h3>
> Related issue: [Issue #3580668](https://www.drupal.org/node/3580668)
> Related issue: [Issue #3580733](https://www.drupal.org/node/3580733)
issue