Ticket #171 (closed defect: fixed)
Element_Date accepts invalid dates
| Reported by: | sfuchs | Owned by: | argh |
|---|---|---|---|
| Priority: | normal | Milestone: | v0.9.0 stable |
| Component: | patForms | Version: | 0.9.0a2 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
Element_Date accepts "31.2.2005" as input value and returns it as 2005-03-02 (i.e. it "corrects" the invalid date) without throwing an error.
Change History
comment:2 Changed 8 years ago by argh
- Status changed from new to assigned
Could you tell me in which cases this happens? The element validation works (validation error thrown) when you try to input the wrong date in the Date example file that is included in the patForms package.
comment:3 Changed 8 years ago by schst
Just try to enter:
2005-02-31
This date does not exist, by I get Validation successful as a result.
comment:4 Changed 8 years ago by sfuchs
When I enter
2005.02.31. 23:12:48
http://examples.php-tools.net/patForms/examples/ (Date Element example)
I get "Validation successful."
Same thing with
2005.02.32. 23:12:48
:)
This is due to the strtotime conversion that is done IIRC in Element_Date::getDate() (called by setValue()) or so ...

Use the username instead of the mail address.