1) Create new view for content
2) Add an argument of type "Updated day", "Updated month" or "Updated year" (possibly others, I haven't tested beyond these three)
3) Leave all values as default
4) Set path to "test"
5) Visit "test/all"

I receive a pair of error messages:

Warning: date_timezone_set() expects parameter 1 to be DateTime, boolean given in format_date() (line 1909 of /home/vend/public_html/includes/common.inc).

Warning: date_format() expects parameter 1 to be DateTime, boolean given in format_date() (line 1919 of /home/vend/public_html/includes/common.inc).

These seem to stem from the various title() functions in views_handler_argument_dates_various.inc. Given the above URL, $this->argument is "all" rather than a valid integer, leading strtotime to fail and return False.
The errors appear harmless - the view still displays properly.

I don't know what should be happening here, but seeing an error while using an argument with all the defaults intact isn't it. See the attached view for a very simple example of what triggers these errors. I'm running Drupal 7.8 with Views-7.x-3.x-dev as of ten minutes ago.

Comments

dawehner’s picture

Currently the problem is that if there is 'all' $this->argument is 'all' and so the title() function does some silly things.

Additional there is a exception_title function, which assumes that you want to display the default title, if there is no special exception value set, but i think this is wrong, because you can't be sure about the type of argument you are at. For numeric handlers 'all' might not be a valid value.

So i think it should return nothing if there is no exception title set.

nathanjo’s picture

I still encounter this error. Views 7.x-3.3.

Contextual Filter: Created year + month

When you are returning 'all' it will result an error

Warning: date_timezone_set() expects parameter 1 to be DateTime, boolean given in format_date() (line 1909 of /...../common.inc).

Warning: date_format() expects parameter 1 to be DateTime, boolean given in format_date() (line 1919 of /......common.inc).

I just need to return 'all' to display all results if condition doesn't match.

juanramonperez’s picture

I have the same problem

Steps to reproduce
1) Create new view for content
2) Add an argument "Created date"
3) Visit path/to/view/all

Any solution?

Luisvsm’s picture

Sub

markusa’s picture

Issue summary: View changes

This is still happening...

Views 3.11

fastangel’s picture

I did a little patch to fix this problem.

fastangel’s picture

Status: Active » Needs review
fastangel’s picture

StatusFileSize
new789 bytes

Sorry I forgot remove a dpm.

chris matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 4 year old patch in #8 to views_handler_argument_dates_various.inc does not apply to the latest views 7.x-3.x-dev and if still relevant needs to be rerolled.

Checking patch modules/node/views_handler_argument_dates_various.inc...
error: while searching for:
  /**
   * Provide a link to the next level of the view
   */
  function title() {
    return format_date(strtotime($this->argument . "15" . " 00:00:00 UTC"), 'custom', $this->format, 'UTC');
  }
}

error: patch failed: modules/node/views_handler_argument_dates_various.inc:76
error: modules/node/views_handler_argument_dates_various.inc: patch does not apply
andrew answer’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll

The current Views have following code here:

   public function title() {
     $timestamp = strtotime($this->argument . "15" . " 00:00:00 UTC");
     if ($timestamp !== FALSE) {
       return format_date($timestamp, 'custom', $this->format, 'UTC');
     }
   }

I test Created/Updated date contextual filter with view on fresh D7 site and not found any errors. So I recommend to close this issue as fixed.