WSOD saving book menu items with no title

Created on 12 September 2024, 2 months ago

Problem/Motivation

When a book menu tree exists a user is able to have empty title fields when saving the book order. This leads to a WSOD.

Steps to reproduce

Install the book module.
Add a top level book page.
Create 1 or more child pages of the new top level book item
e.g.
Top level book
- Child page 1
- Child page 2
Navigate to the book menu tree
Delete one or both of the child book titles in the draggable tree
Save the book pages

A user is able to change the title of a node using the book admin edit page. So they are essentially saving a node with no title, it seems to bypass the required title status of the node edit form. This is the error that is produced.
Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'title' cannot be null: INSERT INTO "node_field_data" ("nid", "vid", "type", "langcode", "status", "uid", "title", "created", "changed", "promote", "sticky", "default_langcode", "revision_translation_affected") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12); Array ( [:db_insert_placeholder_0] => 83 [:db_insert_placeholder_1] => 1357 [:db_insert_placeholder_2] => basic_page [:db_insert_placeholder_3] => und [:db_insert_placeholder_4] => 1 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => [:db_insert_placeholder_7] => 1479117403 [:db_insert_placeholder_8] => 1715849224 [:db_insert_placeholder_9] => 0 [:db_insert_placeholder_10] => 0 [:db_insert_placeholder_11] => 1 [:db_insert_placeholder_12] => 1 ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of /app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Proposed resolution

Make the Book menu tree titles required

πŸ› Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom williamsona

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024