Active
Project:
Drupal core
Version:
main
Component:
datetime.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Jul 2026 at 00:10 UTC
Updated:
9 Jul 2026 at 12:42 UTC
Jump to comment: Most recent
Upgrade to 11.4.1 from 11.3.12 caused DrupalDateTime::createFromArray to wrongly generate error in custom module code.
string elements in the date array can no longer be interpreted as numbers if they have leading zero.
executing $oDate = Drupal\Core\Datetime\DrupalDateTime::createFromArray(['year' => "2026", 'month' => "06", 'day' => "03"]);
produces error message "The array contains invalid values."
The workaround in the module is to specifically cast the fields as (int).
Revert the error detection code to as it was before 11.4, or specifically allow for leading zero in the supplied data.
Comments
Comment #2
quietone commentedThis will be fixed on the main branch first, then backported.
Comment #3
cilefen commentedIt’s important to understand context with regressions. Was it #3241299: Properly return FALSE for invalid strings in DateTimePlus::checkArray() so that the correct exception is thrown that changed the behavior, or another change?
Comment #4
jjeffrie commentedThis issue breaks the DateTime field in webforms as well.