Deprecated function explode() with PHP 8.1

Created on 17 August 2022, over 2 years ago
Updated 29 March 2023, over 1 year ago

PHP 8 works a little bit in another way than PHP 7, and we should adapt this module to php8

Steps to reproduce

Just use BackgroundImage block effect

API changes

Add one more condition before call explode() function.

Error message:

Deprecated function: explode(): Passing null to parameter #2 ($string) of type string is deprecated in Drupal\block_generation\Plugin\BlockGenerationEffect\BackgroundImage->applyEffect() (line 128 of modules/contrib/block_generation/src/Plugin/BlockGenerationEffect/BackgroundImage.php).
Drupal\block_generation\Plugin\BlockGenerationEffect\BackgroundImage->applyEffect('wrapper_external', Array) (Line: 544)
_block_generation_process_effects('wrapper_external', Object, Array) (Line: 406)
_block_generation_process_wrapper('wrapper_external', Object, Array) (Line: 265)
template_preprocess_block__block_generation(Array, 'block__block_generation__block_generation_teaser', Array)
call_user_func_array('template_preprocess_block__block_generation', Array) (Line: 349)
Drupal\Core\Theme\ThemeManager->render('block__block_generation__block_generation_teaser', Array) (Line: 422)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 158)
__TwigTemplate_36b0a742301cb3b92f333aab3b1f95c2->block_content(Array, Array) (Line: 182)
Twig\Template->displayBlock('content', Array, Array) (Line: 112)
__TwigTemplate_36b0a742301cb3b92f333aab3b1f95c2->block_container(Array, Array) (Line: 182)
Twig\Template->displayBlock('container', Array, Array) (Line: 89)
__TwigTemplate_36b0a742301cb3b92f333aab3b1f95c2->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 70)
twig_render_template('themes/contrib/bootstrapper/templates/system/block.html.twig', Array, Array) (Line: 470)
Drupal\Core\Theme\ThemeManager->render('block', Array) (Line: 422)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 127)
__TwigTemplate_c1f83ca509e6a7d87faba56438ff1627->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 70)
twig_render_template('modules/contrib/grids/layouts/onecol/layout--grids-onecol.html.twig', Array, Array) (Line: 470)
Drupal\Core\Theme\ThemeManager->render('layout__grids_onecol', Array) (Line: 422)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 241)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 191)
Drupal\page_cache\StackMiddleware\PageCache->fetch(Object, 1, 1) (Line: 128)
Drupal\page_cache\StackMiddleware\PageCache->lookup(Object, 1, 1) (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 49)
Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 702)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine drews_man Cherkasy

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024