Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

As of Drupal 8 drupal_exit() has been removed, since it did not match Symfony's HTTP Kernel architecture.

Terminating the execution mid-request is discouraged. Instead modules that need to interrupt the request flow should throw the relevant HTTP Exception.

At any other occasion (eg a redirection) an instance of Response should be returned by the responsible Controller.

D7

<?php
function image_style_deliver($style, $scheme) {
 
//......
 
if (!$lock_acquired) {
   
// Tell client to retry again in 3 seconds.
   
drupal_add_http_header('Status', '503 Service Unavailable');
   
drupal_add_http_header('Retry-After', 3);
    print
t('Image generation in progress. Try again shortly.');
   
drupal_exit();
  }
 
//....
}
?>

D8

<?php
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;

function
image_style_deliver($style, $scheme) {
 
//......
 
if (!$lock_acquired) {
   
// Tell client to retry again in 3 seconds.
   
throw new ServiceUnavailableHttpException(3, t('Image generation in progress. Try again shortly.'));
  }
 
//....
}
?>

It was possible to react to / change the URL being redirected, this is covered in the drupal_goto() has been removed change notice.

Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done