-
Notifications
You must be signed in to change notification settings - Fork 40
Closed
backdrop/backdrop
#5075Description
Description of the bug
When using the Reusable Custom Blocks module (part of Backdrop core), creating two custom blocks with the same machine name causes a fatal error due to improper handling of duplicates in the database.
Actual behavior
1. Enable the Reusable Custom Blocks module on a fresh Backdrop install.
2. Create a new custom block and give it a specific machine name (e.g., my_block).
3. Create another custom block and manually enter the same machine name (my_block).
4. See the error:
TypeError: Cannot access offset of type array on array in block_custom_block_load() (line 225 of /var/www/html/docroot/core/modules/block/block.module).
Expected behavior
The system should validate the uniqueness of the machine_name and prevent creation of blocks with duplicate machine names.
Additional information
The block_custom_block_load() function expects machine_name to be unique, but the database does not enforce this. When duplicates exist, the query returns multiple rows and attempts to treat them as a single array, resulting in a TypeError.