Error with Block Content Permissions

The website encountered an unexpected error. Please try again later.

It’s a call to member function (method) listInfo() on null that breaks it.

I don’t think it’s anything i did. I’d file an issue against Block Content Permissions if i hadn’t locked myself out of my Drupal.org account (for the moment).

In fact, it’s probably an interaction of Block Content Permissions and Block Region Permissions.

It only happens when trying to create a block directly from the block placement page (/admin/structure/block/list/newtowne), which gives a URL like this:

https://findit-dev.ddev.site/block/add?theme=newtowne

Without the query string it works fine:

https://findit-dev.ddev.site/block/add

And i’m able to subsequently place that block in that very same theme.

Oh, also very worth noting that this only happens when there is only one custom block type that a role has acces to. With the query string but also with the type of block specified in the URL it works fine:

https://findit-dev.ddev.site/block/add/link?theme=newtowne

So again, the only path that triggers the error:

/block/add?theme=newtowne

when there is not a … list of blocks to show. Hmm, could that be why there’s no list to listInfo() on? An error that makes sense!

Here’s the dirty details of the error:

[03-Sep-2019 22:24:49] WARNING: [pool www] child 12495 said into stderr: "NOTICE: PHP message: Error: Call to a member function listInfo() on null in /var/www/html/web/core/modules/block_content/src/Controller/BlockContentController.php on line 108 #0 /var/www/html/web/modules/contrib/block_content_permissions/src/Controller/BlockContentPermissionsAddPageController.php(77): Drupal\block_content\Controller\BlockContentController->addForm(Object(Drupal\block_content\Entity\BlockContentType), Object(Symfony\Component\HttpFoundation\Request))"
[03-Sep-2019 22:24:49] WARNING: [pool www] child 12495 said into stderr: "#1 [internal function]: Drupal\block_content_permissions\Controller\BlockContentPermissionsAddPageController->add(Object(Symfony\Component\HttpFoundation\Request))"
[03-Sep-2019 22:24:49] WARNING: [pool www] child 12495 said into stderr: "#2 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)"
[03-Sep-2019 22:24:49] WARNING: [pool www] child 12495 said into stderr: "#3 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()"
[03-Sep-2019 22:24:49] WARNING: [pool www] child 12495 said into stderr: "#4 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/Ear..."
2019/09/03 22:24:49 [error] 2096#2096: *37674 FastCGI sent in stderr: "PHP message: Error: Call to a member function listInfo() on null in /var/www/html/web/core/modules/block_content/src/Controller/BlockContentController.php on line 108 #0 /var/www/html/web/modules/contrib/block_content_permissions/src/Controller/BlockContentPermissionsAddPageController.php(77): Drupal\block_content\Controller\BlockContentController->addForm(Object(Drupal\block_content\Entity\BlockContentType), Object(Symfony\Component\HttpFoundation\Request))
#1 [internal function]: Drupal\block_content_permissions\Controller\BlockContentPermissionsAddPageController->add(Object(Symfony\Component\HttpFoundation\Request))
#2 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#3 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#4 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRender" while reading response header from upstream, client: 172.18.0.6, server: _, request: "GET /block/add?theme=newtowne HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm.sock:", host: "findit-dev.ddev.site", referrer: "https://findit-dev.ddev.site/admin/structure/block/list/newtowne"