Getting the following error trying to save the Block Layout admin page.

Message Error: Cannot unset offset in a non-array variable in Drupal\Core\Config\Entity\ConfigEntityBase->unsetThirdPartySetting() (line 531 of /code/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php)
#0 /code/web/modules/contrib/block_class/src/Service/BlockClassHelperService.php(140): Drupal\Core\Config\Entity\ConfigEntityBase->unsetThirdPartySetting('block_class', 'classes')
#1 /code/web/modules/contrib/block_class/block_class.module(107): Drupal\block_class\Service\BlockClassHelperService->blockClassPreSave(Object(Drupal\block\Entity\Block))
#2 [internal function]: block_class_block_presave(Object(Drupal\block\Entity\Block))

This started appearing after I duplicated

I don't know what to make of this but any help is appreciated.
Drupal 9.4.8
PHP 8.1.12

CommentFileSizeAuthor
#4 3325640.patch1 KBrenatog
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dmudie created an issue. See original summary.

dmudie’s picture

I first noticed this after I duplicated a view with a block but cannot say if it's related - just when I first noticed. After deleting that duplicated view (and block), the problem persists.

dmudie’s picture

In troubleshooting, I went in to every single block configuration and re-saved. Now the /admin/structure/block form is saving with no error. So this is fixed for now. But I wonder if something failed to update from an earlier version of block_class?

renatog’s picture

Status: Active » Needs work
StatusFileSize
new1 KB

Do you mind validating if this patch solves the issue please?

This isn't the final solution, is just a test that I want to validate

dmudie’s picture

Hi,
Thanks for checking! I tried again after patching and was not able to submit the form. Different error though. Here's the error:
Error: Cannot use a scalar value as an array in Drupal\Core\Config\Entity\ConfigEntityBase->setThirdPartySetting() (line 504 of /Users/dmudie/Sites/nerrs/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php)
#0 /Users/dmudie/Sites/nerrs/web/modules/contrib/block_class/src/Service/BlockClassHelperService.php(166): Drupal\Core\Config\Entity\ConfigEntityBase->setThirdPartySetting('block_class', 'classes', NULL)
#1 /Users/dmudie/Sites/nerrs/web/modules/contrib/block_class/block_class.module(107): Drupal\block_class\Service\BlockClassHelperService->blockClassPreSave(Object(Drupal\block\Entity\Block))
#2 [internal function]: block_class_block_presave(Object(Drupal\block\Entity\Block))

renatog’s picture

Yeah, I was imagining that

I thinks we can't use $entity->unsetThirdPartySetting('block_class', 'classes'); because this method expects an array

Thanks a lot for reporting

chris matthews’s picture

Version: 2.0.8 » 2.0.x-dev
chaitanyadessai’s picture

Status: Needs work » Needs review

No error occurred While submitting block class settings form w/o applying patch.

thomas kaisuka’s picture

This has fixed me. Thanks for the patch.

thomas kaisuka’s picture

This problem is also evident in the 3.x release. We need a patch for that too.

renatog’s picture

Status: Needs review » Needs work

Thanks for your contribution

Marking as "Needs Work" because MR #55 has changes non-related to this issue. E.g. README, etc

dydave’s picture

Status: Needs work » Closed (outdated)

This issue now seems to date back a bit... with no activity for more than a year....

So it is probably safe to assume the problem was maybe resolved with more recent code changes (?!).

Could you please try updating and testing the issue again with the latest version of the module and see if the issue still occurs?

For now, marking as Closed (outdated), but feel free to re-open this issue, or create a new one if you still encounter the same problem with the latest versions of the module.

Feel free to let us know if you would have any questions or concerns on any aspects of the latest code changes or the module in general, we would surely be glad to hear your feedback. 😊
Thanks in advance!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.