PHP warning for Uninitialized string offset

Created on 26 July 2022, almost 2 years ago
Updated 9 March 2023, over 1 year ago

Problem/Motivation

( ! ) Warning: Uninitialized string offset 0 in \web\modules\contrib\custom_breadcrumbs\src\Form\CustomBreadcrumbsForm.php on line 254

Steps to reproduce

  1. Install module
  2. Go to Custom breadcrumbs configuration
  3. Add Custom breadcrumbs configuration
  4. When selecting Entity type get this warning Uninitialized string offset 0 in \web\modules\contrib\custom_breadcrumbs\src\Form\CustomBreadcrumbsForm.php on line 254

Drupal Version 9.4.1

PHP 8.0.17

Proposed resolution

In web\modules\contrib\custom_breadcrumbs\src\Form\CustomBreadcrumbsForm.php on line no 254
$urlList = explode(PHP_EOL, $pages);
we need to add array_filter because we have not yet added any breadcrumb paths so it gives single array element with empty data.
After that we have to check that array is empty of not before foreach loop.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇮🇳India Jaykumar95 Ahmedabad

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