From 1af383db0c7d18618e6e79804b8b782835b9d32a Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Tue, 19 May 2009 20:18:46 -0400 Subject: [PATCH] re-key filtered arrays after removing tokens --- framework/Date_Parser/lib/Horde/Date/Parser/Locale/Base.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/framework/Date_Parser/lib/Horde/Date/Parser/Locale/Base.php b/framework/Date_Parser/lib/Horde/Date/Parser/Locale/Base.php index 25ae9da14..511c7a971 100644 --- a/framework/Date_Parser/lib/Horde/Date/Parser/Locale/Base.php +++ b/framework/Date_Parser/lib/Horde/Date/Parser/Locale/Base.php @@ -1,4 +1,6 @@ tagged();')); + $tokens = array_values(array_filter($tokens, create_function('$t', 'return $t->tagged();'))); // do the heavy lifting $span = $this->tokensToSpan($tokens, $options); @@ -255,7 +257,7 @@ class Horde_Date_Parser_Locale_Base // maybe it's a specific date foreach ($this->definitions['date'] as $handler) { if ($handler->match($tokens, $this->definitions)) { - $goodTokens = array_filter($tokens, create_function('$o', 'return !$o->getTag("separator");')); + $goodTokens = array_values(array_filter($tokens, create_function('$o', 'return !$o->getTag("separator");'))); return call_user_func(array($this, $handler->handlerMethod), $goodTokens, $options); } } @@ -263,7 +265,7 @@ class Horde_Date_Parser_Locale_Base // I guess it's not a specific date, maybe it's just an anchor foreach ($this->definitions['anchor'] as $handler) { if ($handler->match($tokens, $this->definitions)) { - $goodTokens = array_filter($tokens, create_function('$o', 'return !$o->getTag("separator");')); + $goodTokens = array_values(array_filter($tokens, create_function('$o', 'return !$o->getTag("separator");'))); return call_user_func(array($this, $handler->handlerMethod), $goodTokens, $options); } } @@ -271,7 +273,7 @@ class Horde_Date_Parser_Locale_Base // not an anchor, perhaps it's an arrow foreach ($this->definitions['arrow'] as $handler) { if ($handler->match($tokens, $this->definitions)) { - $goodTokens = array_filter($tokens, create_function('$o', 'return !$o->getTag("separator_at") && !$o->getTag("separator_slash_or_dash") && !$o->getTag("separator_comma");')); + $goodTokens = array_values(array_filter($tokens, create_function('$o', 'return !$o->getTag("separator_at") && !$o->getTag("separator_slash_or_dash") && !$o->getTag("separator_comma");'))); return call_user_func(array($this, $handler->handlerMethod), $goodTokens, $options); } } -- 2.11.0