From 499313c9ca33299cd66b9f88d318112436183806 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 7 Oct 2010 15:18:47 -0400 Subject: [PATCH] Fix handling of iCalendar durations containing negative elements. --- inc/RRule-v2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/RRule-v2.php b/inc/RRule-v2.php index db87a12f..f80a4151 100644 --- a/inc/RRule-v2.php +++ b/inc/RRule-v2.php @@ -138,7 +138,7 @@ class RepeatRuleDateTime extends DateTime { public function modify( $interval ) { - if ( preg_match('{^(-)?P((\d+)W)?((\d+)D)?T?((\d+)H)?((\d+)M)?((\d+)S)?$}', $interval, $matches) ) { + if ( preg_match('{^(-)?P(([0-9-]+)W)?(([0-9-]+)D)?T?(([0-9-]+)H)?(([0-9-]+)M)?(([0-9-]+)S)?$}', $interval, $matches) ) { $minus = $matches[1]; $interval = ''; if ( isset($matches[2]) && $matches[2] != '' ) $interval .= $minus . $matches[3] . ' weeks ';