Skip to content
Snippets Groups Projects
Commit fa7b44b3 authored by Olav Morken's avatar Olav Morken
Browse files

Allow subsecond precision for ISO8601 durations.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2942 44740490-163a-0410-bde0-09ae8108e29a
parent 923cf9f1
No related branches found
No related tags found
No related merge requests found
...@@ -389,7 +389,7 @@ class SimpleSAML_Utilities { ...@@ -389,7 +389,7 @@ class SimpleSAML_Utilities {
assert('is_null($timestamp) || is_int($timestamp)'); assert('is_null($timestamp) || is_int($timestamp)');
/* Parse the duration. We use a very strict pattern. */ /* Parse the duration. We use a very strict pattern. */
$durationRegEx = '#^(-?)P(?:(?:(?:(\\d+)Y)?(?:(\\d+)M)?(?:(\\d+)D)?(?:T(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+)S)?)?)|(?:(\\d+)W))$#D'; $durationRegEx = '#^(-?)P(?:(?:(?:(\\d+)Y)?(?:(\\d+)M)?(?:(\\d+)D)?(?:T(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+)(?:[.,]\d+)?S)?)?)|(?:(\\d+)W))$#D';
if (!preg_match($durationRegEx, $duration, $matches)) { if (!preg_match($durationRegEx, $duration, $matches)) {
throw new Exception('Invalid ISO 8601 duration: ' . $duration); throw new Exception('Invalid ISO 8601 duration: ' . $duration);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment