Fix Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated

Created on 9 January 2024, 11 months ago
Updated 16 April 2024, 7 months ago

Problem/Motivation

  1. The issue appear in the maintenance mode
  2. In masqurade to another user
dashboards_preprocess_html(Array, 'html', Array)
call_user_func_array('dashboards_preprocess_html', Array) (Line: 261)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 480)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 240)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 153)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 152)
Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 66)
Drupal\Core\Render\BareHtmlPageRenderer->renderBarePage(Array, Object, 'maintenance_page', Array) (Line: 76)
Drupal\Core\ProxyClass\Render\BareHtmlPageRenderer->renderBarePage(Array, Object, 'maintenance_page') (Line: 164)
Drupal\Core\EventSubscriber\MaintenanceModeSubscriber->onMaintenanceModeRequest(Object, 'site.maintenance_mode_request', Object)
call_user_func(Array, Object, 'site.maintenance_mode_request', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'site.maintenance_mode_request') (Line: 123)
Drupal\Core\EventSubscriber\MaintenanceModeSubscriber->onKernelRequestMaintenance(Object, 'kernel.exception', Object)
call_user_func(Array, Object, 'kernel.exception', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.exception') (Line: 239)
Symfony\Component\HttpKernel\HttpKernel->handleThrowable(Object, Object, 1) (Line: 91)
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: 53)
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: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Proposed resolution

Add the patch fix from 🐛 Fix Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated RTBC

Having the following patches, which was provided by Rahaf in private Slack IM

    "patches": {
      "drupal/dashboards": {
        "Issue #3409306: Fix calling of a static method on a multilingual Drupal ~10.2.0 under PHP 8.1, 8.2":
        "https://www.drupal.org/files/issues/2023-12-17/3409306-4.patch",
        "Issue #3356296: Fix Warning: Trying to access array offset on value of type null in the system Info dashboard plugin":
        "https://www.drupal.org/files/issues/2023-04-25/3356296-2.patch",
        "Issue #3413086: Fix Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated":
        "https://www.drupal.org/files/issues/2024-01-08/3413086-3.patch"
      }
    }

Remaining tasks

  • ✅ File an issue about this project
  • ✅ Addition/Change/Update/Fix to this project
  • ✅ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ➖ Developer Documentation support on feature change/addition
  • ➖ User Guide Documentation support on feature change/addition
  • ➖ UX/UI designer responsibilities
  • ➖ Accessibility and Readability
  • ✅ Code review from 1 Varbase core team member
  • ✅ Full testing and approval
  • ✅ Credit contributors
  • ✅ Review with the product owner
  • ✅ Update Release Notes and Update Helper on new feature change/addition
  • ✅ Release varbase-10.0.0-rc2 , v arbase_dashboards-1.0.0

Varbase update type

  • ✅ No Update
  • ➖ Optional Update
  • ➖ Forced Update
  • ➖ Forced Update if Unchanged

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • Issue #3413435 by Rahaf Albawab : Fixed Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated
🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇯🇴Jordan rahaf albawab Amman

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

Comments & Activities

Production build 0.71.5 2024