Problem/Motivation
Receiving this message on a PHP 8.1 server:
Deprecated function: preg_split(): Passing null to parameter #2 ($subject) of type string is deprecated in Drupal\easy_breadcrumb\EasyBreadcrumbBuilder->build() (line 254 of modules/contrib/easy_breadcrumb/src/EasyBreadcrumbBuilder.php)
Steps to reproduce
Upgrade your PHP version to 8.1
Proposed resolution
Edit in /src/EasyBreadcrumbBuilder.php row 254:
from:
$mapValues = preg_split('/[\r\n]+/', $this->config->get(EasyBreadcrumbConstants::REPLACED_TITLES));
to:
$mapValues = !empty($this->config->get(EasyBreadcrumbConstants::REPLACED_TITLES)) ? preg_split('/[\r\n]+/', $this->config->get(EasyBreadcrumbConstants::REPLACED_TITLES)) : [];
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | preg-split-3281468-7.patch | 1.04 KB | omkar-pd |
Issue fork easy_breadcrumb-3281468
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
VynokurovD commentedComment #3
VynokurovD commentedComment #4
VynokurovD commentedComment #5
avpadernoComment #6
avpadernoComment #7
omkar-pd commentedComment #8
sébastien-frI had also the issue.
Patch in #7 solves the problem
Comment #9
greg boggsThe line of code is too many characters to meet coding standards. Can we break the code up into shorter lines and open a merge request instead of using patches.
https://www.gregboggs.com/drupal-merge-requests/
Comment #10
avpadernoComment #11
omkar-pd commentedWill make changes as per #9.
Comment #13
omkar-pd commentedMade changes as per #9. needs review if it's working properly.
Comment #14
greg boggsThank you thank you!