BibersAbdou / owasp-esapi-php

Automatically exported from code.google.com/p/owasp-esapi-php
Other
0 stars 0 forks source link

Date validation rule implementation #21

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Looking at:

Exception: C:\Code\ESAPI-PHP-mike.boberski\test/reference/ValidatorTest.php
-> ValidatorTest -> testGetValidDate -> Unexpected exception of type
[ValidationException] with message [DateValidationRule.setDateFormat
requires a non-null DateFormat] in
[C:\Code\ESAPI-PHP-mike.boberski\src\reference\validation\DateValidationRule.php
line 24]

In DateValidationRule.php, nothing is ever done with $this->format, also
date_create returns true/false, it doesn't throw an exception.

Please use date_parse_from_format  ( string $format  , string $date  ) as
the third check in DateValidationRule.php's getValid function, checking the
errors array to determine success/failure.

Original issue reported on code.google.com by mike.bob...@gmail.com on 26 Oct 2009 at 6:09

GoogleCodeExporter commented 8 years ago
Looks like date_parse_from_format is PHP 5 >= 5.3.0

Investigating further, possible errors with canonicalize.

Original comment by mike.bob...@gmail.com on 26 Oct 2009 at 7:13

GoogleCodeExporter commented 8 years ago
I've addressed this in r556 by doing date_create with the canonical input, 
formatting
the date object using $this->format and comparing that to the canonical input. 
Validation fails if the two do not match.

Original comment by jahboite@gmail.com on 14 Apr 2010 at 8:29