diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index d00f819..0d935ae 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -355,7 +355,7 @@ function drupal_environment_initialize() { if (!drupal_valid_http_host($_SERVER['HTTP_HOST'])) { // HTTP_HOST is invalid, e.g. if containing slashes it may be an attack. header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request'); - exit; + return false; } } else { @@ -1454,7 +1454,7 @@ function drupal_handle_request($test_only = FALSE) { // Exit if we should be in a test environment but aren't. if ($test_only && !drupal_valid_test_ua()) { header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); - exit; + return false; } $kernel = new DrupalKernel('prod', drupal_classloader(), !$test_only); @@ -1658,7 +1658,7 @@ function _drupal_bootstrap_page_cache() { // We are done. $response->prepare($request); $response->send(); - exit; + return false; } else { drupal_add_http_header('X-Drupal-Cache', 'MISS'); @@ -1813,7 +1813,7 @@ function drupal_valid_test_ua($new_prefix = NULL) { $key_file = DRUPAL_ROOT . '/sites/simpletest/' . substr($prefix, 10) . '/.htkey'; if (!is_readable($key_file)) { header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); - exit; + return false; } $private_key = file_get_contents($key_file); // The file properties add more entropy not easily accessible to others. diff --git a/core/includes/errors.inc b/core/includes/errors.inc index 05937ff..68b66a6 100644 --- a/core/includes/errors.inc +++ b/core/includes/errors.inc @@ -167,7 +167,7 @@ function _drupal_log_error($error, $fatal = FALSE) { // When called from CLI, simply output a plain text message. // Should not translate the string to avoid errors producing more errors. print html_entity_decode(strip_tags(format_string('%type: !message in %function (line %line of %file).', $error))). "\n"; - exit; + return false; } } @@ -178,7 +178,7 @@ function _drupal_log_error($error, $fatal = FALSE) { // Should not translate the string to avoid errors producing more errors. print format_string('%type: !message in %function (line %line of %file).', $error); } - exit; + return false; } } else { @@ -240,7 +240,7 @@ function _drupal_log_error($error, $fatal = FALSE) { $response->setStatusCode(500, '500 Service unavailable (with message)'); // An exception must halt script execution. $response->send(); - exit; + return false; } } } diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index b00d23b..5853b83 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -285,7 +285,7 @@ function install_begin_request(&$install_state) { // installation be permitted using such a prefix. if ($install_state['interactive'] && strpos($request->server->get('HTTP_USER_AGENT'), 'simpletest') !== FALSE && !drupal_valid_test_ua()) { header($request->server->get('SERVER_PROTOCOL') . ' 403 Forbidden'); - exit; + return false; } drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION); @@ -548,7 +548,7 @@ function install_run_task($task, &$install_state) { \Drupal::service('session_manager')->save(); // Send the response. $response->send(); - exit; + return false; } } // If we are in the middle of processing this batch, keep sending back @@ -922,7 +922,7 @@ function install_display_output($output, $install_state) { } print DefaultHtmlPageRenderer::renderPage($output, $output['#title'], 'install', $regions); - exit; + return false; } /** diff --git a/core/install.php b/core/install.php index 156ff91..7a0a383 100644 --- a/core/install.php +++ b/core/install.php @@ -23,7 +23,7 @@ // load that file yet as it would cause a fatal error on older versions of PHP. if (version_compare(PHP_VERSION, '5.4.2') < 0) { print 'Your PHP installation is too old. Drupal requires at least PHP 5.4.2. See the system requirements page for more information.'; - exit; + return false; } // Start the installer. diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php index 9de9815..135fc08 100644 --- a/core/lib/Drupal/Core/Form/FormBuilder.php +++ b/core/lib/Drupal/Core/Form/FormBuilder.php @@ -265,7 +265,7 @@ public function buildForm($form_id, array &$form_state) { // If the form returns some kind of response, deliver it. if ($response instanceof Response) { $this->sendResponse($response); - exit; + return false; } // If this was a successful submission of a single-step form or the last step @@ -510,7 +510,7 @@ public function retrieveForm($form_id, &$form_state) { // If the form returns some kind of response, deliver it. if ($form instanceof Response) { $this->sendResponse($form); - exit; + return false; } $form['#form_id'] = $form_id; diff --git a/core/modules/system/tests/modules/form_test/form_test.module b/core/modules/system/tests/modules/form_test/form_test.module index 42ef667..5a1b064 100644 --- a/core/modules/system/tests/modules/form_test/form_test.module +++ b/core/modules/system/tests/modules/form_test/form_test.module @@ -34,7 +34,7 @@ function _form_test_submit_values_json($form, &$form_state) { $response = new JsonResponse($form_state['values']); // @todo remove once converted to new routing system. $response->send(); - exit; + return false; } /** @@ -766,7 +766,7 @@ function form_test_form_state_values_clean_form_submit($form, &$form_state) { // This won't have a proper JSON header, but Drupal doesn't check for that // anyway so this is fine until it's replaced with a JsonResponse. print Json::encode($form_state['values']); - exit; + return false; } /** @@ -795,7 +795,7 @@ function form_test_form_state_values_clean_advanced_form($form, &$form_state) { function form_test_form_state_values_clean_advanced_form_submit($form, &$form_state) { form_state_values_clean($form_state); print t('You WIN!'); - exit; + return false; } /** diff --git a/core/modules/system/tests/modules/session_test/session_test.module b/core/modules/system/tests/modules/session_test/session_test.module index c618bab..faf57a8 100644 --- a/core/modules/system/tests/modules/session_test/session_test.module +++ b/core/modules/system/tests/modules/session_test/session_test.module @@ -7,7 +7,7 @@ function session_test_user_login($account) { if ($account->getUsername() == 'session_test_user') { // Exit so we can verify that the session was regenerated // before hook_user_login() was called. - exit; + return false; } } diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index 0f58cb2..7c0670f 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -131,7 +131,7 @@ function _toolbar_initialize_page_cache() { $response->prepare($request); $response->send(); // We are done. - exit; + return false; } // Otherwise, create a new page response (that will be cached). diff --git a/core/scripts/drupal.sh b/core/scripts/drupal.sh index 9514341..0fe3079 100755 --- a/core/scripts/drupal.sh +++ b/core/scripts/drupal.sh @@ -53,7 +53,7 @@ ./scripts/{$script} \n EOF; - exit; + return false; } // define default settings diff --git a/core/scripts/password-hash.sh b/core/scripts/password-hash.sh index f80d75c..8b03e10 100755 --- a/core/scripts/password-hash.sh +++ b/core/scripts/password-hash.sh @@ -25,7 +25,7 @@ PHP version {$version}. \n EOF; - exit; + return false; } $script = basename(array_shift($_SERVER['argv'])); @@ -50,7 +50,7 @@ EOF; - exit; + return false; } // Password list to be processed. diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh index 3134a5c..03a00c3 100755 --- a/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -22,7 +22,7 @@ if ($args['help'] || $count == 0) { simpletest_script_help(); - exit; + return false; } simpletest_script_init(); @@ -32,7 +32,7 @@ simpletest_script_setup_database(); simpletest_script_run_one_test($args['test-id'], $args['execute-test']); // Sub-process exited already; this is just for clarity. - exit; + return false; } simpletest_script_setup_database(TRUE); @@ -47,7 +47,7 @@ foreach ($messages['status'] as $text) { echo " - " . $text . "\n"; } - exit; + return false; } if ($args['list']) { @@ -61,7 +61,7 @@ echo " - " . $info['name'] . ' (' . $class . ')' . "\n"; } } - exit; + return false; } $test_list = simpletest_script_get_test_list(); @@ -92,7 +92,7 @@ } // Test complete, exit. -exit; +return false; /** * Print help text. @@ -265,7 +265,7 @@ function simpletest_script_parse_args() { else { // Argument not found in list. simpletest_script_print_error("Unknown argument '$arg'."); - exit; + return false; } } else { @@ -278,7 +278,7 @@ function simpletest_script_parse_args() { // Validate the concurrency argument if (!is_numeric($args['concurrency']) || $args['concurrency'] <= 0) { simpletest_script_print_error("--concurrency must be a strictly positive integer."); - exit; + return false; } return array($args, $count); @@ -604,7 +604,7 @@ function simpletest_script_execute_batch($test_classes) { if (!is_resource($process)) { echo "Unable to fork test process. Aborting.\n"; - exit; + return false; } // Register our new child. @@ -852,7 +852,7 @@ function simpletest_script_get_test_list() { foreach ($args['test_names'] as $file) { if (!file_exists($file)) { simpletest_script_print_error('File not found: ' . $file); - exit; + return false; } $content = file_get_contents($file); // Extract a potential namespace. @@ -886,7 +886,7 @@ function simpletest_script_get_test_list() { if (empty($test_list)) { simpletest_script_print_error('No valid tests were specified.'); - exit; + return false; } return $test_list; } diff --git a/core/scripts/update-countries.sh b/core/scripts/update-countries.sh index eee5fa2..1571964 100755 --- a/core/scripts/update-countries.sh +++ b/core/scripts/update-countries.sh @@ -78,7 +78,7 @@ function t($string) { } if (empty($countries)) { echo 'ERROR: Did not find expected country names.' . PHP_EOL; - exit; + return false; } // Sort by country code (to minimize diffs). ksort($countries); diff --git a/core/update.php b/core/update.php index 3bac378..9e10ab3 100644 --- a/core/update.php +++ b/core/update.php @@ -33,7 +33,7 @@ // load that file yet as it would cause a fatal error on older versions of PHP. if (version_compare(PHP_VERSION, '5.4.2') < 0) { print 'Your PHP installation is too old. Drupal requires at least PHP 5.4.2. See the system requirements page for more information.'; - exit; + return false; } /** @@ -317,7 +317,7 @@ function update_task_list($active = NULL) { $system_schema = db_query('SELECT schema_version FROM {system} WHERE name = :system', array(':system' => 'system'))->fetchField(); if ($system_schema < \Drupal::CORE_MINIMUM_SCHEMA_VERSION) { print 'Your system schema version is ' . $system_schema . '. Updating directly from a schema version prior to 8000 is not supported. You must migrate your site to Drupal 8 first.'; - exit; + return false; } }