Skip to content

Commit 0e30902

Browse files
committed
fix: go through the after filters.
Signed-off-by: ytetsuro <phper.0o0@gmail.com>
1 parent 77cd602 commit 0e30902

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

system/CodeIgniter.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class CodeIgniter
9494

9595
/**
9696
* Current response.
97-
* @var HTTP\Response
97+
* @var HTTP\ResponseInterface
9898
*/
9999
protected $response;
100100

@@ -321,23 +321,13 @@ protected function handleRequest(RouteCollectionInterface $routes = null, $cache
321321

322322
$this->callExit(EXIT_SUCCESS);
323323
}
324-
elseif ($returned instanceof DownloadResponse)
325-
{
326-
$returned->pretend($this->useSafeOutput)->send();
327-
328-
if ($returnResponse)
329-
{
330-
return $returned;
331-
}
332-
333-
$this->callExit(EXIT_SUCCESS);
334-
}
335324

336325
// If $returned is a string, then the controller output something,
337326
// probably a view, instead of echoing it directly. Send it along
338327
// so it can be used with the output.
339328
$this->gatherOutput($cacheConfig, $returned);
340329

330+
$filters->setResponse($this->response);
341331
// Run "after" filters
342332
$response = $filters->run($uri, 'after');
343333

@@ -902,6 +892,10 @@ protected function gatherOutput($cacheConfig = null, $returned = null)
902892
ob_end_clean();
903893
}
904894

895+
if ($returned instanceof DownloadResponse) {
896+
$this->response = $returned;
897+
return;
898+
}
905899
// If the controller returned a response object,
906900
// we need to grab the body from it so it can
907901
// be added to anything else that might have been

0 commit comments

Comments
 (0)