TypeError datelist.php

Created on 2 August 2025, 3 days ago

API page: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Datetime%...

Enter a descriptive title (above), then describe the problem you have found:
Error in drupal:
TypeError: Drupal\Component\Utility\FilterArray::removeEmptyStrings(): Argument #1 ($value) must be of type array, null given, called in /customers/0/3/1/xxxxxxxx.be/httpd.www/web/core/lib/Drupal/Core/Datetime/Element/Datelist.php on line 349 in Drupal\Component\Utility\FilterArray::removeEmptyStrings() (regel 27 van /customers/0/3/1/xxxxxxxx.be/httpd.www/web/core/lib/Drupal/Component/Utility/FilterArray.php).

You get this error when the date field is not filled in.

original code:
// Filters out empty array values, any valid value would have a string length.
$filtered_input = FilterArray::removeEmptyStrings($input);
return array_diff($parts, array_keys($filtered_input));
}

This code needs to be modified, otherwise you get this error on submitting a form in Drupal views.
This is the code is working (tested):

// Filters out empty array values, any valid value would have a string length.
if (!is_array($input)) {
$input = [];
}
$filtered_input = FilterArray::removeEmptyStrings($input);
return array_diff($parts, array_keys($filtered_input));
}

Can it be included in next update?

📌 Task
Status

Active

Version

11.0 🔥

Component

documentation

Created by

🇧🇪Belgium khoebeke

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

Comments & Activities

Production build 0.71.5 2024