Permalink
Browse files

Merge branch 'hotfix/3045'

Close #3045
  • Loading branch information...
2 parents 700e799 + fd07e64 commit c00c516de69cd968e338fffbab677032c9d06e80 @weierophinney weierophinney committed Nov 26, 2012
Showing with 10 additions and 3 deletions.
  1. +10 −3 library/Zend/Mvc/Router/Http/Segment.php
@@ -24,6 +24,11 @@
*/
class Segment implements RouteInterface
{
+ /**
+ * @var array Cache for the encode output
+ */
+ private static $cacheEncode = array();
+
/**
* Map of allowed special chars in path segments.
*
@@ -408,9 +413,11 @@ public function getAssembledParams()
*/
private function encode($value)
{
- $encoded = rawurlencode($value);
- $encoded = strtr($encoded, static::$urlencodeCorrectionMap);
- return $encoded;
+ if (!isset(static::$cacheEncode[$value])) {
+ static::$cacheEncode[$value] = rawurlencode($value);
+ static::$cacheEncode[$value] = strtr(static::$cacheEncode[$value], static::$urlencodeCorrectionMap);
+ }
+ return static::$cacheEncode[$value];
}
/**

0 comments on commit c00c516

Please sign in to comment.