I am running into an issue where date_api_fields is being called with an empty base. This causes it to fall through to the _date_api_fields() call which has this code at the top:
// Make sure $base is never empty.
if (empty($base)) {
$base = 'node';
}

Shouldn't that code be in both places so that when the _date_api_fields() result is cached it will get picked-up in the next request?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jblumenfeld’s picture

Attaching proposed patch

jblumenfeld’s picture

Status: Active » Needs review

Attached patch needs review.

Status: Needs review » Needs work

The last submitted patch, date-base_is_null-1630780-1.patch, failed testing.

jblumenfeld’s picture

Version: 6.x-2.9 » 6.x-2.x-dev
FileSize
637 bytes

Updated patch?
It was working on my local pressflow checkout...

jblumenfeld’s picture

Status: Needs work » Needs review
hefox’s picture

Title: handle case where base is empty in date_api_fields()? » handle case where base is empty in date_api_fields()/performance improvements
FileSize
3.38 KB

Patch adapted from duplicate #1771022: date_api_fields slams cache + some other things to help with the performance of the the function

* Removed the cache_clear_all($cid, 'cache_views'); since it's not needed with the cache_set
* did !isset instead of empty( so it doesn't keep looking if _date_api_fields returned empty
* Moved the require_once to only when it's needed, and changed it to a more performant way of including that are always in the same directory as current file (filefield does this for it's includes)

jcisio’s picture

Patch #4 looks good. Patch #6 IMO is a little too big to be committed, especially when nobody takes care of Date (and even worse, D6).

DamienMcKenna’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

Unfortunately the D6 version of this module is no longer supported, but we appreciate the time you put into this. If this problem is relevant for D7 too, please reopen the issue. Thanks.