Ticket #587 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Empty strings in temporal setters yield current time

Reported by: hans Owned by: hans
Priority: normal Milestone: 1.3
Component: Generator Version: 1.3.0beta4
Severity: normal Keywords:
Cc:

Description

Here's the scenario:

$obj->setDate("");

(obviously doesn't make any sense, but this can happen -- especially when populating form form field)

Currently that will be equivalent to the following:

$obj->setDate(new DateTime("now"));

since

(new DateTime('')) == (new DateTime('now'))

I would argue that this is a bit counter-intuitive. I think it might be more intuitive to have empty strings get treated as null by the mutator (setDate(), in this case).

Change History

comment:1 Changed 3 years ago by hans

  • Status changed from new to closed
  • Resolution set to fixed

This has been fixed in r982.

Note: See TracTickets for help on using tickets.