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-&gt;hasTranslation() (line 984 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).<br>Drupal\Core\Entity\ContentEntityBase-&gt;hasTranslation() (Line: 1911)<br>Twig\Extension\CoreExtension::getAttribute() (Line: 46)<br>__TwigTemplate_5e14f0a02c4058d41bf7481384abf802-&gt;doDisplay() (Line: 402)<br>Twig\Template-&gt;yield() (Line: 386)<br>Twig\Template-&gt;render() (Line: 51)<br>Twig\TemplateWrapper-&gt;render() (Line: 35)<br>Drupal\Core\Template\TwigThemeEngine-&gt;renderTemplate() (Line: 428)<br>Drupal\Core\Theme\ThemeManager-&gt;render() (Line: 500)<br>Drupal\Core\Render\Renderer-&gt;doRender() (Line: 230)<br>Drupal\Core\Render\Renderer-&gt;render() (Line: 1809)<br>Drupal\views\Plugin\views\field\FieldPluginBase-&gt;theme() (Line: 778)<br>Drupal\views\Plugin\views\style\StylePluginBase-&gt;elementPreRenderRow()<br>call_user_func_array() (Line: 107)<br>Drupal\Core\Render\Renderer-&gt;doTrustedCallback() (Line: 910)<br>Drupal\Core\Render\Renderer-&gt;doCallback() (Line: 441)<br>Drupal\Core\Render\Renderer-&gt;doRender() (Line: 230)<br>Drupal\Core\Render\Renderer-&gt;render() (Line: 715)<br>Drupal\views\Plugin\views\style\StylePluginBase-&gt;renderFields() (Line: 579)<br>Drupal\views\Plugin\views\style\StylePluginBase-&gt;renderGrouping() (Line: 467)<br>Drupal\views\Plugin\views\style\StylePluginBase-&gt;render() (Line: 2195)<br>Drupal\views\Plugin\views\display\DisplayPluginBase-&gt;render() (Line: 1591)<br>Drupal\views\ViewExecutable-&gt;render() (Line: 201)<br>Drupal\views\Plugin\views\display\Page-&gt;execute() (Line: 1686)<br>Drupal\views\ViewExecutable-&gt;executeDisplay() (Line: 80)<br>Drupal\views\Element\View::preRenderViewElement()<br>call_user_func_array() (Line: 107)<br>Drupal\Core\Render\Renderer-&gt;doTrustedCallback() (Line: 910)<br>Drupal\Core\Render\Renderer-&gt;doCallback() (Line: 441)<br>Drupal\Core\Render\Renderer-&gt;doRender() (Line: 230)<br>Drupal\Core\Render\Renderer-&gt;render() (Line: 242)<br>Drupal\Core\Render\MainContent\HtmlRenderer-&gt;{closure:Drupal\Core\Render\MainContent\HtmlRenderer::prepare():235}() (Line: 634)<br>Drupal\Core\Render\Renderer::{closure:Drupal\Core\Render\Renderer::executeInRenderContext():634}()<br>Fiber-&gt;resume() (Line: 649)<br>Drupal\Core\Render\Renderer-&gt;executeInRenderContext() (Line: 235)<br>Drupal\Core\Render\MainContent\HtmlRenderer-&gt;prepare() (Line: 131)<br>Drupal\Core\Render\MainContent\HtmlRenderer-&gt;renderResponse() (Line: 90)<br>Drupal\Core\EventSubscriber\MainContentViewSubscriber-&gt;onViewRenderArray() (Line: 246)<br>Symfony\Component\EventDispatcher\EventDispatcher::{closure:Symfony\Component\EventDispatcher\EventDispatcher::optimizeListeners():241}() (Line: 206)<br>Symfony\Component\EventDispatcher\EventDispatcher-&gt;callListeners() (Line: 56)<br>Symfony\Component\EventDispatcher\EventDispatcher-&gt;dispatch() (Line: 188)<br>Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw() (Line: 76)<br>Symfony\Component\HttpKernel\HttpKernel-&gt;handle() (Line: 53)<br>Drupal\Core\StackMiddleware\Session-&gt;handle() (Line: 48)<br>Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle() (Line: 28)<br>Drupal\Core\StackMiddleware\ContentLength-&gt;handle() (Line: 32)<br>Drupal\big_pipe\StackMiddleware\ContentLength-&gt;handle() (Line: 118)<br>Drupal\page_cache\StackMiddleware\PageCache-&gt;pass() (Line: 92)<br>Drupal\page_cache\StackMiddleware\PageCache-&gt;handle() (Line: 48)<br>Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle() (Line: 51)<br>Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle() (Line: 53)<br>Drupal\Core\StackMiddleware\AjaxPageState-&gt;handle() (Line: 54)<br>Drupal\Core\StackMiddleware\StackedHttpKernel-&gt;handle() (Line: 745)<br>Drupal\Core\DrupalKernel-&gt;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