Drupal core currently generates headers and/or prints content directly in various places. With the introduction of HttpKernel and Response objects, these exit; calls should be eliminated. This is necessary in order to return properly formatted error pages, ensure event subscribers are called and to facilitate code testing (it can be difficult to execute tests on code that calls exit). Additionally, we are very close to having the ability to run Drupal as a long-running process, and/or fork drupal processes to handle sub-requests and one of the few remaining steps is to eliminate exit; calls.
Replace exit calls with return. In instances where header/print was used to send content to the client, return an appropriately formed Response object. As the installer does not yet use the HttpKernel object, this proposed resolution does not cover/include the installer.
User interface changes
No user interface changes.
No API changes.
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,790 pass(es).
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,825 pass(es), 101 fail(s), and 93 exception(s).
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,779 pass(es), 104 fail(s), and 97 exception(s).
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 47,754 pass(es), 12,279 fail(s), and 994 exception(s).