Upgrade from book 2.0.x fails with TypeError type string on string in book_post_update_allowed_child_type_default6
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3563266. -->
Reported by: [joseph.olstad](https://www.drupal.org/user/1321830)
Related to !154 !160
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Upgrading from a fresh book 2.0.x installation.</p>
<p>Getting this error:<br>
<code>TypeError: Cannot access offset of type string on string in book_post_update_allowed_child_type_default6</code></p>
<p>Stack of errors:</p>
<pre> [error] TypeError: Cannot access offset of type string on string in book_post_update_allowed_child_type_default6() (line 148 of /www/web/modules/contrib/book/book.post_update.php) #0 /www/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(291): book_post_update_allowed_child_type_default6(Array)<br>> #1 /www/vendor/drush/drush/includes/batch.inc(257): Drush\Commands\core\UpdateDBCommands::updateDoOnePostUpdate('book_post_updat...', Array)<br>> #2 /www/vendor/drush/drush/includes/batch.inc(204): _drush_batch_worker()<br>> #3 /www/vendor/drush/drush/includes/batch.inc(75): _drush_batch_command('1')<br>> #4 /www/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(145): drush_batch_command('1')<br>> #5 [internal function]: Drush\Commands\core\UpdateDBCommands->process('1', Array)<br>> #18 {main}.<br>> TypeError: Cannot access offset of type string on string in /www/web/modules/contrib/book/book.post_update.php on line 148 #0 /www/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(291): book_post_update_allowed_child_type_default6(Array)<br>> #1 /www/vendor/drush/drush/includes/batch.inc(257): Drush\Commands\core\UpdateDBCommands::updateDoOnePostUpdate('book_post_updat...', Array)<br>> [warning] Drush command terminated abnormally.<br><br>In ProcessBase.php line 171:<br><br>Unable to decode output into JSON: Syntax error<br><br>TypeError: Cannot access offset of type string on string in book_post_update_allowed_child_type_default6() (line 148 of /www/html/modules/contrib/book/book.post_update.php).</pre><h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<p>Install book 2.0.x with this configuration:<br>
<code>book.settings.yml</code></p>
<pre>allowed_type_book: 1<br>block:<br> navigation:<br> mode: 'all pages'<br>child_type_book: book</pre><p>
Then upgrade to book 3.0.x</p>
<p>Then observe bug.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>See code in merge request</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<p>Review code in merge request</p>
<h3 id="summary-ui-changes">User interface changes</h3>
<p>Allows upgrades without crashing</p>
<h3 id="summary-api-changes">API changes</h3>
<p>See merge request</p>
<h3 id="summary-data-model-changes">Data model changes</h3>
<p>See merge request</p>
issue