PHP error when 'reusable' option is checked when we clone an inline_block

Created on 7 February 2023, almost 2 years ago
Updated 18 August 2023, over 1 year ago

Problem/Motivation

Case when we clone an inline_block, a PHP error is returned in logs, and block content isn't created.:
TypeError : unserialize(): Argument #1 ($data) must be of type string, Drupal\block_content\Entity\BlockContent given dans unserialize() (/var/www/public-website/modules/contrib/layout_builder_block_clone/src/Form/CloneLayoutBlockForm.php ligne 303)

Steps to reproduce

Step 1 : Install version 8.x-1.2 with composer command line:
composer require 'drupal/layout_builder_block_clone:^1.2'

Step 2 : Enable modules layout_builder_block_clone, entity_clone and dblog with drush:
drush en layout_builder_block_clone dblog

Step 3: create a node structured with layout builder and add inline block.

Step 4: save layout.

Step 5: clone the existing inline block with contextual link > clone

Step 6: Add a block description and check "reusable" option.

Step 7: Save with [clone] button.

Step 8: open admin menu reports > recent log messages.

Step 9: Find PHP error.

And Custom block content isn't created inside custom blocks library.

Proposed resolution

Patch in next comments

🐛 Bug report
Status

Active

Version

1.2

Component

Code

Created by

🇫🇷France frondeau Nantes, FRANCE

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

Comments & Activities

Production build 0.71.5 2024