In order when views module retrieves data using LEFT JOINS from nodes that don't use the duration module all values are set to NULL.
Regardless whether duration_create($duration_iso_string = NULL) is called using a valid parameter or not it normally creates a valid duration object.

In duration_field(..) all items are treated the same way and the object duration_create(..) returns will always be valid:

  function __construct($duration_iso_string = NULL) {
    // Easy way: no string given, let's just initialize a zero duration.
    if (!isset($duration_iso_string)) {
      $this->is_negative = FALSE;
      $this->duration = array();
      $this->is_valid = TRUE;
      return;
    }

In my opinion there shouldn't shown up a value for nodes that don't use this field. That's why I set the category to "bug report".

I thought about checking the $item['approx_seconds'] value for existence before calling duration_create(..).

Patch attached,

greetings,
sevi

CommentFileSizeAuthor
duration.module.diff422 bytessevi

Comments

jpetso’s picture

Status: Active » Fixed

Fair enough. Fixed in CVS, although the error was somewhere else: I had forgotten to include a validity check in duration_format_hms() (duration_api.module) so even invalid Duration objects like the ones initialized from empty strings would be displayed. CCK 6.x ensures that we never get NULL as value for an item, so the 'iso8601' value for an unset duration is the empty string. (Empty vs. non-empty 'iso8601' strings is how the module can distinguish between zero and unset durations.)

Thanks for the report, I'm going to roll the 6.x-1.0 release now.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.