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
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3325640.patch | 1 KB | renatog |
Issue fork block_class-3325640
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
Comment #2
dmudie commentedI 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.
Comment #3
dmudie commentedIn 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?
Comment #4
renatog commentedDo 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
Comment #5
dmudie commentedHi,
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))
Comment #6
renatog commentedYeah, I was imagining that
I thinks we can't use
$entity->unsetThirdPartySetting('block_class', 'classes');because this method expects an arrayThanks a lot for reporting
Comment #7
chris matthews commentedComment #8
chaitanyadessai commentedNo error occurred While submitting block class settings form w/o applying patch.
Comment #9
thomas kaisuka commentedThis has fixed me. Thanks for the patch.
Comment #10
thomas kaisuka commentedThis problem is also evident in the 3.x release. We need a patch for that too.
Comment #14
renatog commentedThanks for your contribution
Marking as "Needs Work" because MR #55 has changes non-related to this issue. E.g. README, etc
Comment #16
dydave commentedThis 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!