- Issue created by @steveoriol
- @steveoriol opened merge request.
- Status changed to Needs review
about 2 years ago 11:31am 31 March 2023 What are the steps to reproduce this? In many similar cases contributed or custom code is misusing an API.
- Status changed to Needs work
about 2 years ago 3:09pm 31 March 2023 - πΊπΈUnited States smustgrave
Thank you for reporting the issue.
#5 tags for steps to reproduce which is 100% needed. This could be a symptom of a bigger issue.
Will need a test case showing the issue.
- πͺπΈSpain rcodina Barcelona
I also found a similar error in another file:
Deprecated function: Automatic conversion of false to array is deprecated en Drupal\Core\Form\FormBuilder->prepareForm() (lΓnea 766 de /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php)
Maybe it's a good idea to fix all of this conversions in the core's codebase.
- πͺπΈSpain rcodina Barcelona
In my case the error was caused by a custom form which had...
$form['#cache'] = false;
... which was working on PHP 7.4. Once I replaced the code with...
$form['#cache'] = ['max-age' => 0];
...problem solved under PHP 8.1. The stack trace returned by core shows the form which causes the problem but there is no clue about what's really causing the problem.
Deprecated function: Automatic conversion of false to array is deprecated en Drupal\Core\Form\FormBuilder->prepareForm() (lΓnea 766 de /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php) #0 /var/www/html/web/core/includes/bootstrap.inc(164): _drupal_error_handler_real(8192, 'Automatic conve...', '/var/www/html/w...', 766) #1 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(766): _drupal_error_handler(8192, 'Automatic conve...', '/var/www/html/w...', 766) #2 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(284): Drupal\Core\Form\FormBuilder->prepareForm('form_user_topic', Array, Object(Drupal\Core\Form\FormState)) #3 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(224): Drupal\Core\Form\FormBuilder->buildForm('Drupal\\base_mod...', Object(Drupal\Core\Form\FormState)) #4 [internal function]: Drupal\Core\Form\FormBuilder->getForm('Drupal\\base_mod...') #5 /var/www/html/web/modules/contrib/twig_tweak/src/TwigTweakExtension.php(227): call_user_func_array(Array, Array) #6 /var/www/html/web/sites/default/php/twig/64f59266490ac__topic.html.twig_FR_dj-f2tL4K0hPltoFUigyFe/wiF8uRKa803v5phYtUm1zVpd1CJKKxIoXVpKlk9xkB8.php(92): Drupal\twig_tweak\TwigTweakExtension::drupalForm('Drupal\\base_mod...') #7 /var/www/html/vendor/twig/twig/src/Template.php(171): __TwigTemplate_01dff3be3cd64f367b2a2d0eb06da18c->block_heading(Array, Array) #8 /var/www/html/web/sites/default/php/twig/64f59266490ac__node.html.twig_f6TdNAT4_mIYxydzcOX1aDUrv/ziKa-dkAAwUZCoWBS0-PoZQsWatEn7BRO9aawgteSlc.php(61): Twig\Template->displayBlock('heading', Array, Array) #9 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_1c017e6f63c46e6daae8a308e5878ff0->doDisplay(Array, Array) #10 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array) #11 /var/www/html/web/sites/default/php/twig/64f59266490ac__topic.html.twig_FR_dj-f2tL4K0hPltoFUigyFe/wiF8uRKa803v5phYtUm1zVpd1CJKKxIoXVpKlk9xkB8.php(73): Twig\Template->display(Array, Array) #12 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_01dff3be3cd64f367b2a2d0eb06da18c->doDisplay(Array, Array) #13 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array) #14 /var/www/html/web/sites/default/php/twig/64f59266490ac_node--topic.html.twig_oIEnjrh4qrIs1auGJz3vJLOIv/Oz6RNR9XYL3fQzAPzUSTCQYuRRD3AguVPaZEwLROWKM.php(42): Twig\Template->display(Array, Array) #15 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_d403d801796cf3878857db63562749fd->doDisplay(Array, Array) #16 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array) #17 /var/www/html/vendor/twig/twig/src/Template.php(379): Twig\Template->display(Array) #18 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\Template->render(Array, Array) #19 /var/www/html/web/core/themes/engines/twig/twig.engine(53): Twig\TemplateWrapper->render(Array) #20 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(372): twig_render_template('themes/custom/s...', Array) #21 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(436): Drupal\Core\Theme\ThemeManager->render('node', Array) #22 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender(Array, false) #23 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(238): Drupal\Core\Render\Renderer->render(Array, false) #24 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(583): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() #25 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(239): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #26 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch)) #27 /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)) #28 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #29 /var/www/html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #30 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(187): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view') #31 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #32 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #33 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #34 /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) #35 /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) #36 /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) #37 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #38 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #39 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #40 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #41 {main}