diff options
author | Derek Jones <derek.jones@ellislab.com> | 2008-08-07 02:01:09 +0200 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2008-08-07 02:01:09 +0200 |
commit | 17756a07a877436d520edb87813e13b860ace169 (patch) | |
tree | 0beaf8d3406a400ab2fb0097603a0c310f678f66 | |
parent | 30e9c533700ef014d4c3ff513bc7dd1a2b5c2309 (diff) |
tightened human time stamp validation regex
-rw-r--r-- | system/helpers/date_helper.php | 2 | ||||
-rw-r--r-- | user_guide/changelog.html | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 095e460a9..a82450aa1 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -442,7 +442,7 @@ if ( ! function_exists('human_to_unix')) $datestr = trim($datestr);
$datestr = preg_replace("/\040+/", "\040", $datestr);
- if ( ! ereg("^[0-9]{2,4}\-[0-9]{1,2}\-[0-9]{1,2}\040[0-9]{1,2}:[0-9]{1,2}.*$", $datestr))
+ if ( ! preg_match('/^[0-9]{2,4}\-[0-9]{1,2}\-[0-9]{1,2}\s[0-9]{1,2}:[0-9]{1,2}(?::[0-9]{1,2})?(?:\s[AP]M)?$/i', $datestr))
{
return FALSE;
}
diff --git a/user_guide/changelog.html b/user_guide/changelog.html index e0e2bef36..207c594d0 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -67,6 +67,7 @@ SVN Revision: XXXX</p> <ul>
<li>Improved accuracy of calculations in <a href="helpers/number_helper.html">Number helper</a>.</li>
<li>Removed added newlines ("\n") from most form and html helper functions.</li>
+ <li>Tightened up validation in Date Helper human_to_unix(), and eliminated the POSIX regex.</li>
</ul>
</li>
<li>Other changes
|