From: Chuck Hagenbuch Date: Wed, 20 May 2009 00:18:46 +0000 (-0400) Subject: re-key filtered arrays after removing tokens X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1af383db0c7d18618e6e79804b8b782835b9d32a;p=horde.git re-key filtered arrays after removing tokens --- 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); } }