Throws deprecation notice with PHP 8.1

Created on 28 March 2023, about 1 year ago
Updated 20 September 2023, 9 months ago

Problem/Motivation

Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in _gin_gutenberg_is_content_form() (line 240 of modules/contrib/gin_gutenberg/gin_gutenberg.module).
_gin_gutenberg_is_content_form() (Line: 61)
gin_gutenberg_preprocess_html(Array, 'html', Array)
call_user_func_array('gin_gutenberg_preprocess_html', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 433)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 162)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 163)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)

This happens, because in gin_gutenberg_preprocess_html() the $form_id parameter is not passed to the _gin_gutenberg_is_content_form() function, because there is no form for that preprocess then a NULL value is used for string based functions.

Steps to reproduce

Proposed resolution

Either defined $form_id = '' in the method signature as a default value or add proper checks for the string actions like strpos to not process it if it's not a string.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany szeidler Berlin

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

Comments & Activities

Production build 0.69.0 2024