Deprecation Warning: Automatic Conversion of false to Array in Easy Breadcrumb's getRequestForPath Method

Created on 5 December 2024, 18 days ago

A deprecation warning is triggered in Symfony when using the getRequestForPath() method in the Easy Breadcrumb module. The issue occurs because false is being passed to Symfony\Component\HttpFoundation\Request::create() instead of a valid array.

Steps to Reproduce:
Navigate to /admin/reports/memcache/default/testing-memcache.djl978.cfg.use1.cache.amazonaws.com:11211.
Observe the deprecation warning in the logs:
Deprecated function: Automatic conversion of false to array is deprecated in Symfony\Component\HttpFoundation\Request::create() (line 372 of /var/www/flex/vendor/symfony/http-foundation/Request.php).

Error Details:
File: Symfony\Component\HttpFoundation\Request.php
Line: 372
Trace:
Request::create('/admin/reports/memcache/default/testing-memcache.djl978.cfg.use1.cache.amazonaws.com:11211') (Line: 969)
EasyBreadcrumbBuilder->getRequestForPath('/admin/reports/memcache/default/testing-memcache.djl978.cfg.use1.cache.amazonaws.com:11211', Array) (Line: 509)

Root Cause:
The getRequestForPath() method is passing an invalid $exclude parameter or improperly handling $check_path, leading to the deprecation warning. Symfony 6.x and PHP 8 are stricter about types, and passing false instead of an array is no longer allowed.

Expected Behavior:
The getRequestForPath() method should ensure valid parameters ($check_path and $exclude) are passed to Request::create() to prevent the deprecation warning.

Environment:
Easy Breadcrumb Module Version: 2.0.8
Symfony Version: 6.x
PHP Version: 8.x
Drupal Version: 9.5.11

Proposed Solution:
Add validation for $check_path and $exclude in the build() method before passing them to getRequestForPath().
Ensure the getRequestForPath() method checks and normalizes input values.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024