Fatal error: Cannot unset string offsets in sites\all\modules\date\date_elements.inc on line 301.
Looks similar to #382722: Fatal error: Cannot unset string offsets in ...../public_html/sites/all/modules/date/date/date_elements.inc on line 288 and #299925: Fatal error: cannot unset string offsets however date_popup is enabled.
The error happens when end date is being cleared out because it is the same as the start date.
Looks like there is quite a history with this kind of error in the date module.
I will be proposing a fix similar to #2130575: unset() should be used with more caution in views_filter_handler_simple.inc.
Comment | File | Size | Author |
---|---|---|---|
#1 | date-unset-end-date-2503315-1.patch | 745 bytes | CptCasual |
Comments
Comment #1
CptCasual CreditAttribution: CptCasual commentedCheck for is_array and isset instead of !empty.
Comment #2
CptCasual CreditAttribution: CptCasual commentedComment #3
spotzero CreditAttribution: spotzero at Coldfront Labs Inc. commentedIt bug comes from the fact that if $element['#default_value'] is a string, !empty($element['#default_value'][$to_field]) will return FALSE, and thus pass (and then running unset on $element['#default_value'][$to_field] when $element['#default_value'] is a string will cause a fatal error.)
This patch fixes the fatal error.
Comment #5
cafuego CreditAttribution: cafuego as a volunteer commentedMerged with a small change.
I changed the
isset()
back to!empty()
as in the original code. These two calls are not functionaly equivalent (specifically in how they handle a variable containing NULL).