@@ -47,7 +47,7 @@ class CodeIgniter
47
47
/**
48
48
* The current version of CodeIgniter Framework
49
49
*/
50
- public const CI_VERSION = '4.2.3 ' ;
50
+ public const CI_VERSION = '4.2.4 ' ;
51
51
52
52
/**
53
53
* App startup time.
@@ -489,20 +489,26 @@ protected function handleRequest(?RouteCollectionInterface $routes, Cache $cache
489
489
$ this ->response = $ response ;
490
490
}
491
491
492
- // Cache it without the performance metrics replaced
493
- // so that we can have live speed updates along the way.
494
- // Must be run after filters to preserve the Response headers.
495
- if (static ::$ cacheTTL > 0 ) {
496
- $ this ->cachePage ($ cacheConfig );
497
- }
492
+ // Skip unnecessary processing for special Responses.
493
+ if (! $ response instanceof DownloadResponse && ! $ response instanceof RedirectResponse) {
494
+ // Cache it without the performance metrics replaced
495
+ // so that we can have live speed updates along the way.
496
+ // Must be run after filters to preserve the Response headers.
497
+ if (static ::$ cacheTTL > 0 ) {
498
+ $ this ->cachePage ($ cacheConfig );
499
+ }
498
500
499
- // Update the performance metrics
500
- $ output = $ this ->displayPerformanceMetrics ($ this ->response ->getBody ());
501
- $ this ->response ->setBody ($ output );
501
+ // Update the performance metrics
502
+ $ body = $ this ->response ->getBody ();
503
+ if ($ body !== null ) {
504
+ $ output = $ this ->displayPerformanceMetrics ($ body );
505
+ $ this ->response ->setBody ($ output );
506
+ }
502
507
503
- // Save our current URI as the previous URI in the session
504
- // for safer, more accurate use with `previous_url()` helper function.
505
- $ this ->storePreviousURL (current_url (true ));
508
+ // Save our current URI as the previous URI in the session
509
+ // for safer, more accurate use with `previous_url()` helper function.
510
+ $ this ->storePreviousURL (current_url (true ));
511
+ }
506
512
507
513
unset($ uri );
508
514
0 commit comments