Ticket #587 (closed defect: fixed)
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
Note: See
TracTickets for help on using
tickets.
This has been fixed in r982.