Warning: explode() expects parameter 2 to be string, array given in twig_split_filter()

Created on 27 May 2021, over 3 years ago
Updated 20 February 2024, 10 months ago

Problem/Motivation

Adding external link or a link with query string to user or main navigation menu throws the twig error below:


Warning: explode() expects parameter 2 to be string, array given in twig_split_filter() (line 785 of vendor/twig/twig/src/Extension/CoreExtension.php). 

Steps to reproduce

Add external or query stringed link (example: https://www.drupal.org/ or /user/login?u=x001) to user or main navigation menu.
Clear the cache and try navigating through the site.

Proposed resolution

I resolved it temporarily by changing line 785 (in vendor/twig/twig/src/Extension/CoreExtension.php) to:


if (\strlen($delimiter) > 0) {
        $value = is_array($value) ? implode(' ', $value) : $value;
        return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit);
...

💬 Support request
Status

Fixed

Version

9.3

Component
Theme 

Last updated 25 minutes ago

Created by

🇳🇿New Zealand Philben

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