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}
.
Comments
Comment #2
cinarb commentedHi ill review it. :)
Comment #3
cinarb commentedAttached patch that solves the issue.
Comment #4
renatog commentedThanks a lot. Moved at: https://git.drupalcode.org/project/block_class/-/commit/066fd97
New release available with this fix: https://www.drupal.org/project/block_class/releases/2.0.6
Thanks everyone
Comment #5
leisurman commentedThank you @cinarb