Notice: Undefined index: #date_format in date_popup_process_date() (line 240 of /home/u3220/domains/u3220.**********/sites/all/modules/date/date/date_popup/date_popup.module).
Notice: Undefined index: #date_format in date_popup_date_granularity() (line 173 of /home/u3220/domains/u3220..**********//sites/all/modules/date/date/date_popup/date_popup.module).
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | date_errors.png | 24.21 KB | JohnDoranNY |
| #24 | date_popup-fix-undefined-index-date_format.module.patch | 1.69 KB | adriaanm |
| #10 | datepop_20110306.patch | 1.73 KB | bmagistro |
| #3 | date_1032942.patch | 1.02 KB | hadsie |
Comments
Comment #1
JCool commentedI also have this issue with the 7.x-1.x-alpha2 version (with different line numbers). When adding a date field to a content type the date popup appears with no problem. This error occurs when I try to add a date field to a form in a custom module. The date format is defined in the module as '#date_format' => 'm/d/Y'. When I do a dump of the arrays passed to the module I can see why the index is not working. I tried fixing it by changing the reference from $element['#date_format'] to $element['element']['#date_format'] which resolves the error, but then brings up a ton of other errors in the module.
Comment #2
bmagistro commented+1, I'm going to try to look into it further this weekend. If anyone has a patch I'd be glad to test.
Comment #3
hadsie commentedIt looks like date_format isn't always set and that's triggering this notice (it's not technically an error and won't actually break anything, just annoying :) ).
The attached patch simply checks that the date_format array index is set before trying to access it.
- Scott
Comment #4
Sborsody commentedI get this error on a panel that contains a pane with a view (no dates though).
* Notice: Undefined index: additional fields in date_field_views_data_alter() (line 252 of /home/clients/websites/***/public_html/afaf/sites/all/modules/date/date_views/date_views.module).
* Warning: array_merge() [function.array-merge]: Argument #1 is not an array in date_field_views_data_alter() (line 252 of /home/clients/websites/***/public_html/afaf/sites/all/modules/date/date_views/date_views.module).
* Notice: Undefined index: additional fields in date_field_views_data_alter() (line 252 of /home/clients/websites/***/public_html/afaf/sites/all/modules/date/date_views/date_views.module).
* Warning: array_merge() [function.array-merge]: Argument #1 is not an array in date_field_views_data_alter() (line 252 of /home/clients/websites/***/public_html/afaf/sites/all/modules/date/date_views/date_views.module).
Comment #5
Sborsody commentedThe patch in #3 seems to work. The error no longer displays.
Comment #6
Sborsody commentedSpoke too soon. I cleared caches, but it seems to always come back when I navigate away from the panel and click on the panel page's menu item again. Then I hit the browser "refresh" (firefox) and it disappears.
Comment #7
bmagistro commented@sborsody, was it the FF or drupal cache you cleared. I just applied this patch and it seems to have resolved the issue I was experiencing. I might suggest adding a couple lines to the patch to do similar checks for time which it doesn't have. This isn't an issue for me since I am just dealing with dates but this might what is causing your issue.
@hadsie, thanks for the patch still testing but looks good so far.
Comment #8
klonos...title was too vague. This one makes the issue much easier to search and find.
Comment #9
Sborsody commented@bmasgistro
What I meant above was Drupal cache. I see this error also on the edit page of a view that filters on a node type that contains a date popup field. When I clear the Drupal cache, the error shows. Then I hit refresh on FF and the error disappears. Then I can browse to another page and browse back to the view edit page that had the error and no error shows up. When I clear the Drupal cache again, the error returns.
It could be like you said, that I'm seeing the error still due to the patch not checking for time. The content type in question is using datetime.
Comment #10
bmagistro commentedTry this patch. I made this one against the D7 dev release and not the alpha (was hoping the dev had this fixed).
Comment #11
Sborsody commentedI installed the dev release and applied your updated patch. Thanks. Haven't seen the error since.
Comment #12
Sborsody commentedComment #13
Paragon commentedI'm sorry, what exactly do I need to install to fix this? Do I install the whole dev module (I've got alpha 2) now and then patch it?
Thanks,
Paragon
Comment #14
klonos@Paragon: short answer: yes and yes.
Long one: in order to test patches for various issues, install the version of the module the patch refers to (where available these are usually the dev versions - here it is 7.x-1.x-dev and you can tell this from the issue's summary), then patch it with the latest patch provided (here the one from #10). Once you test, report back with success or not. Once the issue is marked as "closed (fixed)", you can use the latest dev without the patch, but you have to wait 12 hours before downloading the latest dev (in order to give the bot time to build the new version that includes the patch's changes).
Comment #15
Paragon commentedGreat, klonos, thank you so much. Does that apply to all module patches on drupal.org in general?
I've tried this out and it seems to be working now. I'm not entirely clear on why/how the error started coming up in the first place, though, but I have been so far unable to reproduce it.
Paragon
Comment #16
klonos...not to all. I'd say to most. You see...
- for one not all projects (modules/themes) have dev versions. It's up to their maintainer(s).
- a patch might take too long to be tested and approved and in the meantime a new version of the module/theme might become available. That's when we say that a patch needs a 're-roll' against the latest version. Even then though you can try to patch the files manually (if the patch command fails).
...no need to know mate, but if you do, then try reading what Scott says in post #3 ;)
...I take it you mean after applying the patch. Right? That's good news. It justifies why this issue's status is set to 'RTBC' ;)
PS: I'd suggest we stop this generic talk about patches in this issue though Daniel because we are taking it off-topic. Please follow the links I provided and use the site's search feature on the top of each drupal.org page ;)
Comment #17
Paragon commentedI just got the error again today. I went to my home page and it showed up. Seems very sporadic, though.
Edit: So far, it comes consistently for me when I save a view, and it disappears when I refresh the browser.
Paragon
Comment #18
klonos...a few things to try:
- empty your browser's cache and see if you still get the error.
- check if it happens in various browsers.
- clear your drupal/server-side cache (either use this url: http://your.site.here/admin_menu/flush-cache?destination=none or go to Administration -› Configuration -› Development -› Performance and click the 'Clear all caches' button).
Comment #19
Sborsody commentedI have not seen the error since #12. I'm still running 7.x-1.x-dev (2011-Feb-24).
Comment #20
karens commentedThere have been a ton of changes to both Date and Calendar since this was posted. I don't need reports that this works, I need confirmation if something is still broken on the latest code (dev versions of Date, Calendar, Views, and CTools).
I don't want to commit a change to hide something that should not be missing, I want to see if it is still missing.
Comment #21
arlinsandbulte commentedDate 7.x-1.x is unsupported.
This issue should be verified in the latest version of Date (7.x-2.x-dev) and re-opened if still valid.
Thanks
Comment #22
adriaanm commentedStill exists in 7.x-2.x-dev, even after flushing all caches:
To reproduce, create a form with a date-element:
The error shows up on the page with the form after refreshing the page.
Comment #23
pauljr8 commentedCould not avoid the error on any drupal 7/date 7 combination. Applied datepop_20110306.patch to date-7.x-2.x-dev on Drupal 7.x-dev and I cannot reproduce the error.
Comment #24
adriaanm commentedpatch from hadsie
Comment #25
quazardous commented#24 works fine for me thx
Comment #26
karens commented@Sborsody, the errors you report in #4 bear no resemblence to the error in the original issue. I don't see how there can be a relationship.
@adriaanm, the element type[#date] is not handled by the date popup module, that is a core element, can't see how that can be an issue.
I am still trying to find a way to reproduce the issue. The '#date_format' is created in the element_info, it should never be empty.
Comment #27
bryancasler commentedWe had someone do a D6-D7 migration, that's how we started getting these errors.
#24 works for me
Comment #28
fietserwinThis error appears because the function date_popup_process_date is seen as a default process function for theme('date', ...) calls, i.e. for elements that have '#theme" = 'date', i.e. for normal date elements ('#type' = 'date'), not date_popup elements.
So any patch that uses conditions to prevent the warning from appearing is misleading, the function should be renamed! Not sure what should/could be the name, but I guess that date_popup_process_date_popup might do, though that will serve as default process handler for calls to theme('date_popup', ...)... Not sure if that is intended. if not, try date_popup_element_process_date_part (and date_popup_element_process_time_part as that will have the same issue if there is theme hook defined for 'time')
FYI: The logic that rebuilds the theme and searches for process and preprocess handlers can be found in file includes/theme.inc, function _theme_process_registry(), and the code that looks like:
Comment #29
danreb commented#24 patch works for me too. although it may be a temporary fix, at least it removed the error for now.
subscribing...
Comment #30
JohnDoranNY commentedUsing the latest dev version (6/28/2011) I get the same error(s)
Notice: Undefined index: #date_format in date_popup_process_date() (line 249 of /home/content/21/7420121/html/sites/all/modules/date/date_popup/date_popup.module).
Notice: Undefined index: #date_format in date_popup_date_granularity() (line 176 of /home/content/21/7420121/html/sites/all/modules/date/date_popup/date_popup.module).
Notice: Undefined index: #date_format in date_popup_process_date() (line 249 of /home/content/21/7420121/html/sites/all/modules/date/date_popup/date_popup.module).
Notice: Undefined index: #date_format in date_popup_date_granularity() (line 176 of /home/content/21/7420121/html/sites/all/modules/date/date_popup/date_popup.module).
This is on a page that doesn't even have a 'date' field on it (?).
I've attached a screen snapshot.
Comment #31
karens commentedGood detective work fietserwin! I'm not sure I would have figured that out. I just committed a change to rename the functions.