Problem/Motivation
When using php8.1 a warning is displayed with this message
Deprecated function: strtr(): Passing null to parameter #1 ($string) of type string is deprecated in block_content_template_theme_suggestions_block_content() (line 66 of /var/www/html/web/modules/contrib/block_content_template/block_content_template.module)
#0 /var/www/html/web/core/includes/bootstrap.inc(347): _drupal_error_handler_real(8192, 'strtr(): Passin...', '/var/www/html/w...', 66)
#1 [internal function]: _drupal_error_handler(8192, 'strtr(): Passin...', '/var/www/html/w...', 66)
#2 /var/www/html/web/modules/contrib/block_content_template/block_content_template.module(66): strtr(NULL, '.', '_')
#3 [internal function]: block_content_template_theme_suggestions_block_content(Array)
#4 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(426): call_user_func_array(Object(Closure), Array)
#5 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(405): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object(Closure), 'block_content_t...')
#6 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(433): Drupal\Core\Extension\ModuleHandler->invokeAllWith('theme_suggestio...', Object(Closure))
#7 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(230): Drupal\Core\Extension\ModuleHandler->invokeAll('theme_suggestio...', Array)
#8 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render('block_content', Array)
#9 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender(Array, false)
#10 /var/www/html/web/core/lib/Drupal/Core/Template/TwigExtension.php(496): Drupal\Core\Render\Renderer->render(Array)
#11 /var/www/html/vendor/twig/twig/src/Environment.php(418) : eval()'d code(220): Drupal\Core\Template\TwigExtension->escapeFilter(Object(Drupal\Core\Template\TwigEnvironment), Array, 'html', NULL, true)
#12 /var/www/html/vendor/twig/twig/src/Template.php(182): __TwigTemplate_e20d2871c0094c3fb62f6a82e91734d8___1816118772->block_footer_col_1(Array, Array)
#13 /var/www/html/vendor/twig/twig/src/Environment.php(418) : eval()'d code(58): Twig\Template->displayBlock('footer_col_1', Array, Array)
#14 /var/www/html/vendor/twig/twig/src/Template.php(405): __TwigTemplate_b0a3f844885ccd8a5ee60552ab718573->doDisplay(Array, Array)
#15 /var/www/html/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#16 /var/www/html/vendor/twig/twig/src/Environment.php(418) : eval()'d code(211): Twig\Template->display(Array, Array)
#17 /var/www/html/vendor/twig/twig/src/Template.php(405): __TwigTemplate_e20d2871c0094c3fb62f6a82e91734d8___1816118772->doDisplay(Array, Array)
#18 /var/www/html/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#19 /var/www/html/vendor/twig/twig/src/Environment.php(418) : eval()'d code(61): Twig\Template->display(Array)
#20 /var/www/html/vendor/twig/twig/src/Template.php(405): __TwigTemplate_e20d2871c0094c3fb62f6a82e91734d8->doDisplay(Array, Array)
#21 /var/www/html/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#22 /var/www/html/vendor/twig/twig/src/Environment.php(418) : eval()'d code(122): Twig\Template->display(Array)
#23 /var/www/html/vendor/twig/twig/src/Template.php(405): __TwigTemplate_33a7a9433eef8f5f8761d1fe8eab9e5e->doDisplay(Array, Array)
#24 /var/www/html/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#25 /var/www/html/vendor/twig/twig/src/Environment.php(418) : eval()'d code(44): Twig\Template->display(Array)
#26 /var/www/html/vendor/twig/twig/src/Template.php(405): __TwigTemplate_c66c8e43bbcf30ea5de5c640b1a545b9->doDisplay(Array, Array)
#27 /var/www/html/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#28 /var/www/html/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)
#29 /var/www/html/web/core/themes/engines/twig/twig.engine(55): Twig\Template->render(Array)
#30 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('themes/custom/r...', Array)
#31 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render('page', Array)
#32 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender(Array, false)
#33 /var/www/html/web/core/lib/Drupal/Core/Template/TwigExtension.php(496): Drupal\Core\Render\Renderer->render(Array)
#34 /var/www/html/vendor/twig/twig/src/Environment.php(418) : eval()'d code(150): Drupal\Core\Template\TwigExtension->escapeFilter(Object(Drupal\Core\Template\TwigEnvironment), Array, 'html', NULL, true)
#35 /var/www/html/vendor/twig/twig/src/Template.php(405): __TwigTemplate_4e9e3103b043054ac072b930ba5cda0b->doDisplay(Array, Array)
#36 /var/www/html/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#37 /var/www/html/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)
#38 /var/www/html/web/core/themes/engines/twig/twig.engine(55): Twig\Template->render(Array)
#39 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('themes/custom/r...', Array)
#40 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render('html', Array)
#41 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender(Array, false)
#42 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(162): Drupal\Core\Render\Renderer->render(Array)
#43 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#44 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(163): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#45 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#46 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#47 /var/www/html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#48 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(174): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view')
#49 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#50 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#51 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#52 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#53 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#54 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#55 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#56 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#57 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#58 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#59 {main}
Proposed resolution
replace code in line 66 from
$sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
to
$sanitized_view_mode = strtr($variables['elements']['#view_mode'] ?? '', '.', '_');