Created on 5 April 2022, over 2 years ago
Updated 14 February 2023, over 1 year ago

I updated my server to php 8.1 and ran into a issue as follows:

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in core/lib/Drupal/Component/Plugin/PluginBase.php on line 83

This was using the media embed functionality within the basic editor when I was including a image along with some text in a block. To correct the issue I did the following:

Before:
/**
* {@inheritdoc}
*/
public function getDerivativeId() {
$plugin_id = $this->getPluginId();
$derivative_id = NULL;
if (strpos($plugin_id, static::DERIVATIVE_SEPARATOR)) {
[, $derivative_id] = explode(static::DERIVATIVE_SEPARATOR, $plugin_id, 2);
}
return $derivative_id;
}

After:
/**
* {@inheritdoc}
*/
public function getDerivativeId() {
$plugin_id = $this->getPluginId();
$derivative_id = NULL;
if (strpos((string)$plugin_id, static::DERIVATIVE_SEPARATOR)) {
[, $derivative_id] = explode(static::DERIVATIVE_SEPARATOR, $plugin_id, 2);
}
return $derivative_id;
}

Has anyone else ran into this and or is this the correct fix?

πŸ› Bug report
Status

Closed: cannot reproduce

Version

9.5

Component
BlockΒ  β†’

Last updated 3 days ago

Created by

πŸ‡ΊπŸ‡ΈUnited States Christopher Riley

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.

  • πŸ‡³πŸ‡±Netherlands tinto Amsterdam

    I tried to reproduce this issue as best as I can on a local install of Drupal 9.5.2-dev on MAMP Pro running PHP 8.1.0, but I did not see any errors appear in my logs.

    This issue is tagged with the block.module component and mentions the use of media, but it's not entirely clear how to recreate the OP's configuration without clear instructions. #3 already requested further info, but there have been no updates for quite a while.

    Therefore, I am marking this issue as Closed (cannot reproduce) for now. If anyone manages to force the error described in the issue summary, please reopen this issue by marking it as Active and provide some clear steps to reproduce β†’ . Thank you!

Production build 0.71.5 2024