Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Cloning the event protects the original event from changes that happe…

…n when we dispatch to the forward controller, namely the target of the event being changed to the forward controller.

Also, since we are cloning, there's no need to cache the routeMatch.
  • Loading branch information...
commit d0c093ac9cf6accaa49495d3e0987ddeec85bfcb 1 parent 8dd08e5
Nicholas Calugar SocalNick authored committed

Showing 1 changed file with 2 additions and 9 deletions. Show diff stats Hide diff stats

  1. +2 9 library/Zend/Mvc/Controller/Plugin/Forward.php
11 library/Zend/Mvc/Controller/Plugin/Forward.php
@@ -66,7 +66,7 @@ public function setMaxNestedForwards($maxNestedForwards)
66 66 */
67 67 public function dispatch($name, array $params = null)
68 68 {
69   - $event = $this->getEvent();
  69 + $event = clone($this->getEvent());
70 70 $locator = $this->getLocator();
71 71 $scoped = false;
72 72
@@ -90,11 +90,8 @@ public function dispatch($name, array $params = null)
90 90 }
91 91
92 92 // Allow passing parameters to seed the RouteMatch with
93   - $cachedMatches = false;
94 93 if ($params) {
95   - $matches = new RouteMatch($params);
96   - $cachedMatches = $event->getRouteMatch();
97   - $event->setRouteMatch($matches);
  94 + $event->setRouteMatch(new RouteMatch($params));
98 95 }
99 96
100 97 if ($this->numNestedForwards > $this->maxNestedForwards) {
@@ -106,10 +103,6 @@ public function dispatch($name, array $params = null)
106 103
107 104 $this->numNestedForwards--;
108 105
109   - if ($cachedMatches) {
110   - $event->setRouteMatch($cachedMatches);
111   - }
112   -
113 106 return $return;
114 107 }
115 108

0 comments on commit d0c093a

Please sign in to comment.
Something went wrong with that request. Please try again.