ZF2-171: Application finish event

Issue Type: Bug Created: 2012-02-23T14:39:31.000+0000 Last Updated: 2012-06-06T11:32:04.000+0000 Status: Resolved Fix version(s): Reporter: Chris Willis (macest) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend\Mvc

Related issues: Attachments:


The application class no longer fires a finish event if a response object is returned from a controller action.

I suggest the following patch:

<pre class="highlight">
     // Trigger dispatch event 
     $result = $events->trigger('dispatch', $event, $shortCircuit); 

     // Complete response 
     $response = $result->last(); 
     if ($response instanceof Response) { 
+        $events->trigger('finish', $event); 
         return $response; 


Posted by Adam Lundrigan (adamlundrigan) on 2012-02-23T17:55:29.000+0000

Attaching to the 'dispatch' event with a negative priority value should give you the same result. The only difference will be that the event will always fire, regardless of whether a Response object was returned...however, you could work around this by checking for that inside your callback.

Posted by Chris Willis (macest) on 2012-02-24T10:03:37.000+0000

That doesn't work for me, I've tried various negative values with no success.

Posted by Matthew Weier O'Phinney (matthew) on 2012-02-24T15:00:00.000+0000

I've submitted a pull request that will fix the issue. I also identified an additional location where "finish" should be triggered.

Posted by Maks 3w (maks3w) on 2012-06-06T11:32:04.000+0000

Patch merged

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.