TypeError when importing blocks if no blocks exported

Created on 6 January 2025, 3 months ago

If no blocks have been exported and you try to import blocks, the following error occurs:

[error] TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in count() (line 348 of /var/www/html/web/modules/contrib/structure_sync/src/Controller/BlocksController.php) #0 /var/www/html/web/modules/contrib/structure_sync/src/Controller/BlocksController.php(348): count()

#1 /var/www/html/web/modules/contrib/structure_sync/src/Controller/BlocksController.php(159): Drupal\structure_sync\Controller\BlocksController::importBlocksSafe()

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom duttonma

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

Comments & Activities

  • Issue created by @duttonma
  • 🇬🇧United Kingdom duttonma

    Patch attached to fix this issue

  • Status changed to Needs review 3 days ago
  • First commit to issue fork.
  • @mparker17 opened merge request.
  • 🇨🇦Canada mparker17 UTC-4

    To make this easier to review, I've created a merge request.

    A brief glance at the code in the merge request suggests that it has no tests. The Structure Sync maintainers prefer to accept merge requests that have passing automated tests. If you need help writing tests, please ask: I would be happy to help!

Production build 0.71.5 2024