Undefined array key "depth" BookManager.php
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3553911. --> Reported by: [liam morland](https://www.drupal.org/user/493050) Related to !145 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>During migrations, I am getting a bunch of warnings 'Undefined array key "depth" BookManager.php'. They refer to this line: <code>$book['depth'] = $parent['depth'] + 1;</code></p> <p>I don't know in detail what is causing this. It may be that migration code ought to be setting the <code>depth</code>. However, I noticed that this code has no protection against <code>depth</code> not being set. Indeed <code>$parent</code> could be an empty array (that is the default). If it was, there would also be other errors about undefined array keys.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>If <code>depth</code> must be set, log and display a better error message. Otherwise, fallback to a sensible default.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <p>Figure out what should be done. Implement.</p> <h3 id="summary-ui-changes">User interface changes</h3> <p>None.</p> <h3 id="summary-api-changes">API changes</h3> <p>None except that these warnings would not appear.</p> <h3 id="summary-data-model-changes">Data model changes</h3> <p>None.</p>
issue