Deprecated use of strlen in SendinblueManager::getApiVersion

Created on 27 March 2022, over 2 years ago
Updated 28 April 2023, about 1 year ago

Problem/Motivation

When installing the module on Drupal 9 + PHP 8.1, on the API key page, we have the following deprecated message:

Deprecated function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\sendinblue\SendinblueManager->getApiVersion() (line 203 of modules/contrib/sendinblue/src/SendinblueManager.php).
Drupal\sendinblue\SendinblueManager->getApiVersion(NULL) (Line: 229)
Drupal\sendinblue\SendinblueManager->updateSendinblueMailin(NULL) (Line: 180)
Drupal\sendinblue\SendinblueManager->__construct(Object, Object, Object, Object, Object, Object, Object, Object) (Line: 262)
Drupal\Component\DependencyInjection\Container->createService(Array, 'sendinblue.manager') (Line: 176)
Drupal\Component\DependencyInjection\Container->get('sendinblue.manager') (Line: 37)
Drupal\sendinblue\Controller\SendinblueController::create(Object) (Line: 28)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition('Drupal\sendinblue\Controller\SendinblueController') (Line: 117)
Drupal\Core\Controller\ControllerResolver->createController('Drupal\sendinblue\Controller\SendinblueController::home') (Line: 69)
Drupal\Core\Controller\ControllerResolver->getControllerFromDefinition('Drupal\sendinblue\Controller\SendinblueController::home', '/admin/config/system/sendinblue') (Line: 85)
Drupal\Core\Controller\ControllerResolver->getController(Object) (Line: 141)
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: 50)
Drupal\ban\BanMiddleware->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: 49)
Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

  • Fresh Drupal 9.3 install
  • Install Sendinblue module (2.0), activate it
  • Go to admin/config/system/sendinblue

Proposed resolution

In SendInBlueManager.php, getApiVersion should make sure $accessKey is not null before using it as argument for strlen

πŸ› Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

πŸ‡«πŸ‡·France superbiche Nantes

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.69.0 2024