Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Fatal error: Cannot use string offset as an array in sites\all\modules\date\date_elements.inc on line 74
To reproduce, add a Date field, with a Popup to a content-type. My granularity settings are Year, Month, Day with no timezone conversion. Now, go try to create a piece of content.
To fix
Just add $items=array();
somewhere within date_field_widget_form()
BEFORE foreach ($process as $processed)
on line 74.
Comment | File | Size | Author |
---|---|---|---|
#3 | 1138962-date-missing-items-array-declaration.patch | 551 bytes | wjaspers |
#1 | 1138962-date-missing-items-array-declaration.patch | 514 bytes | wjaspers |
Comments
Comment #1
wjaspers CreditAttribution: wjaspers commentedComment #2
nevets CreditAttribution: nevets commentedSince $items is passed in you probably want
Comment #3
wjaspers CreditAttribution: wjaspers commentedGood catch. I didn't notice it in the method signature.
Ideally, the method signature should enforce the array, but, I'm not about to go hacking away at the entire module. In a quick test, I tried enforcing an array in the method signature, but it didn't work.
The patch attached is as you mentioned above.
Comment #4
KarenS CreditAttribution: KarenS commentedI've never run into this issue and the Field module is responsible for passing in $items, which should never be missing and should always be an array.
If this is still an issue, I need details on how to reproduce it.
Comment #5
wjaspers CreditAttribution: wjaspers commentedAs of recently, I haven't run into the problem again (on D7-dev).
I'll keep an eye out if it resurfaces, though.