Created on 15 September 2022, almost 2 years ago
Updated 10 August 2023, 11 months ago

Problem/Motivation

When moving from php 7.4 to 8.1 locally (using lando) I get following warning

Deprecated function: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in Drupal\storybook_server\Theme\StorybookServerThemeNegotiator->getTheme() (line 54 of modules/contrib/storybook_server/src/Theme/StorybookServerThemeNegotiator.php).
Drupal\storybook_server\Theme\StorybookServerThemeNegotiator->getTheme() (Line: 36)
Drupal\storybook_server\Theme\StorybookServerThemeNegotiator->applies(Object) (Line: 67)
Drupal\Core\Theme\ThemeNegotiator->determineActiveTheme(Object) (Line: 491)
Drupal\Core\Theme\ThemeManager->initTheme(Object) (Line: 97)
Drupal\Core\Theme\ThemeManager->getActiveTheme() (Line: 229)
Drupal\Core\Theme\Registry->init(NULL) (Line: 273)
Drupal\Core\Theme\Registry->getRuntime() (Line: 194)
Drupal\Core\Entity\EntityViewBuilder->getBuildDefaults(Object, 'full') (Line: 61)
Drupal\node\NodeViewBuilder->getBuildDefaults(Object, 'full') (Line: 157)
Drupal\Core\Entity\EntityViewBuilder->viewMultiple(Array, 'full', NULL) (Line: 123)
Drupal\Core\Entity\EntityViewBuilder->view(Object, 'full') (Line: 102)
Drupal\Core\Entity\Controller\EntityViewController->view(Object, 'full') (Line: 66)
Drupal\node\Controller\NodeViewController->view(Object, 'full', NULL)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
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: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 49)
Asm89\Stack\Cors->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: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
πŸ› Bug report
Status

Needs review

Version

1.2

Component

Code

Created by

πŸ‡¬πŸ‡·Greece GiorgosK Chios, Greece πŸ‡¬πŸ‡·

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.

  • Status changed to Needs work 11 months ago
  • πŸ‡«πŸ‡·France fgm Paris, France

    There is a simpler fix (just return "$whatever" instead of $whatever and, more importantly, the same issue arises in 2 other places in the ServerEndpointController, lines 29 and 31, so that makes 3 places to fix.

  • πŸ‡ΊπŸ‡ΈUnited States Mojiferous

    Added patch with additional catches for the other two preg_replace calls - putting them into double quotes is a shorter fix, but it's less readable and can be the cause of weird bugs if the data type changes.

  • Status changed to Needs review 11 months ago
  • πŸ‡«πŸ‡·France fgm Paris, France

    If the data type changes, there will be a problem with that version too: preg_replace expects a string, nothing else, so with declare(strict_types = 1) that will be an issue too.

    This being said, I do not think that query->get can return anything but a string anyway, so LGTM.

Production build 0.69.0 2024