Problem/Motivation

Multiple php warnings when placing blocks in a region

Using Drupal core 9.3.19 and Block class 2.0.5
Downgrade block_class:^2.0' to 1.3 fixes the problem, makes warning go away.

Steps to reproduce

Go to manage blocks and place any system block in any region. If you have error_reporting all in settings.php. You will see the warning message on the page.

Full warning message:

Warning: array_filter() expects parameter 1 to be array, bool given in Drupal\block_class\Service\BlockClassHelperService->validateDynamicClasses() (line 966 of /var/www/html/arpa2/web/modules/contrib/block_class/src/Service/BlockClassHelperService.php)
#0 /var/www/html/arpa2/web/core/includes/bootstrap.inc(346): _drupal_error_handler_real()
#1 [internal function]: _drupal_error_handler()
#2 /var/www/html/arpa2/web/modules/contrib/block_class/src/Service/BlockClassHelperService.php(966): array_filter()
#3 /var/www/html/arpa2/web/modules/contrib/block_class/src/Service/BlockClassHelperService.php(903): Drupal\block_class\Service\BlockClassHelperService->validateDynamicClasses()
#4 /var/www/html/arpa2/web/modules/contrib/block_class/block_class.module(145): Drupal\block_class\Service\BlockClassHelperService->blockClassFormValidate()
#5 [internal function]: block_class_form_block_form_validate()
#6 /var/www/html/arpa2/web/core/lib/Drupal/Core/Form/FormValidator.php(82): call_user_func_array()
#7 /var/www/html/arpa2/web/core/lib/Drupal/Core/Form/FormValidator.php(275): Drupal\Core\Form\FormValidator->executeValidateHandlers()
#8 /var/www/html/arpa2/web/core/lib/Drupal/Core/Form/FormValidator.php(118): Drupal\Core\Form\FormValidator->doValidateForm()
#9 /var/www/html/arpa2/web/core/lib/Drupal/Core/Form/FormBuilder.php(588): Drupal\Core\Form\FormValidator->validateForm()
#10 /var/www/html/arpa2/web/core/lib/Drupal/Core/Form/FormBuilder.php(320): Drupal\Core\Form\FormBuilder->processForm()
#11 /var/www/html/arpa2/web/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm()
#12 /var/www/html/arpa2/web/core/modules/block/src/Controller/BlockAddController.php(27): Drupal\Core\Entity\EntityFormBuilder->getForm()
#13 [internal function]: Drupal\block\Controller\BlockAddController->blockAddConfigureForm()
#14 /var/www/html/arpa2/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#15 /var/www/html/arpa2/web/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#16 /var/www/html/arpa2/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#17 /var/www/html/arpa2/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#18 /var/www/html/arpa2/vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#19 /var/www/html/arpa2/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#20 /var/www/html/arpa2/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#21 /var/www/html/arpa2/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#22 /var/www/html/arpa2/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#23 /var/www/html/arpa2/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#24 /var/www/html/arpa2/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#25 /var/www/html/arpa2/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#26 /var/www/html/arpa2/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#27 /var/www/html/arpa2/web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle()
#28 /var/www/html/arpa2/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#29 {main}
.
CommentFileSizeAuthor
#3 3312410-3.patch797 bytescinarb

Comments

leisurman created an issue. See original summary.

cinarb’s picture

Assigned: Unassigned » cinarb

Hi ill review it. :)

cinarb’s picture

Assigned: cinarb » Unassigned
Status: Active » Needs review
StatusFileSize
new797 bytes

Attached patch that solves the issue.

renatog’s picture

Status: Needs review » Fixed
leisurman’s picture

Thank you @cinarb

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.