Deprecated errors PHP 8

Created on 24 August 2022, over 2 years ago
Updated 24 April 2023, almost 2 years ago

Problem/Motivation

When I use a colorbox video formatter and I do not have the image style defined, then the following errors appear:

Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in template_preprocess_colorbox_media_remote_video_formatter() (line 83 of /mnt/www/html/server/docroot/modules/contrib/colorbox_media_video/colorbox_media_video.theme.inc)#0 /mnt/www/html/server/docroot/core/includes/bootstrap.inc(346): _drupal_error_handler_real(8192, 'strpos(): Passi...', '/mnt/www/html/d...', 83)
#1 [internal function]: _drupal_error_handler(8192, 'strpos(): Passi...', '/mnt/www/html/d...', 83)
#2 /mnt/www/html/server/docroot/modules/contrib/colorbox_media_video/colorbox_media_video.theme.inc(83): strpos(NULL, 'colorbox/exampl...')
#3 /mnt/www/html/server/docroot/core/lib/Drupal/Core/Theme/ThemeManager.php(287): template_preprocess_colorbox_media_remote_video_formatter(Array, 'colorbox_media_...', Array) 

and the item thumb has the title empty:

Deprecated function: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated in template_preprocess_colorbox_media_remote_video_formatter() (line 152 of /mnt/www/html/server/docroot/modules/contrib/colorbox_media_video/colorbox_media_video.theme.inc)#0 /mnt/www/html/server/docroot/core/includes/bootstrap.inc(346): _drupal_error_handler_real(8192, 'mb_strlen(): Pa...', '/mnt/www/html/d...', 152)
#1 [internal function]: _drupal_error_handler(8192, 'mb_strlen(): Pa...', '/mnt/www/html/d...', 152)
#2 /mnt/www/html/server/docroot/modules/contrib/colorbox_media_video/colorbox_media_video.theme.inc(152): mb_strlen(NULL)
#3 /mnt/www/html/server/docroot/core/lib/Drupal/Core/Theme/ThemeManager.php(287): template_preprocess_colorbox_media_remote_video_formatter(Array, 'colorbox_media_...', Array)
#4 /mnt/www/html/server/docroot/core/lib/Drupal/Core/Render/Renderer.php(422): Drupal\Core\Theme\ThemeManager->render('colorbox_media_...', Array)
#5 /mnt/www/html/server/docroot/core/lib/Drupal/Core/Render/Renderer.php(201): Drupal\Core\Render\Renderer->doRender(Array, false) 

Steps to reproduce

It happens on drupal 9.4.5 with PHP 8.1 when visiting a basic page with a field configured with the colobox video formatter.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇪🇸Spain eduardo morales alberti Spain, 🇪🇺

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.

Production build 0.71.5 2024