function SystemTestController::shutdownFunctions

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php \Drupal\system_test\Controller\SystemTestController::shutdownFunctions()
  2. 8.9.x core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php \Drupal\system_test\Controller\SystemTestController::shutdownFunctions()
  3. 10 core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php \Drupal\system_test\Controller\SystemTestController::shutdownFunctions()

A simple page callback which adds a register shutdown function.

1 string reference to 'SystemTestController::shutdownFunctions'
system_test.routing.yml in core/modules/system/tests/modules/system_test/system_test.routing.yml
core/modules/system/tests/modules/system_test/system_test.routing.yml

File

core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php, line 335

Class

SystemTestController
Controller routines for system_test routes.

Namespace

Drupal\system_test\Controller

Code

public function shutdownFunctions($arg1, $arg2) {
    drupal_register_shutdown_function('_system_test_first_shutdown_function', $arg1, $arg2);
    // If using PHP-FPM then fastcgi_finish_request() will have been fired
    // preventing further output to the browser which means that the escaping of
    // the exception message can not be tested.
    // @see _drupal_shutdown_function()
    // @see \Drupal\system\Tests\System\ShutdownFunctionsTest
    if (function_exists('fastcgi_finish_request') || ob_get_status()) {
        return [
            '#markup' => 'The response will flush before shutdown functions are called.',
        ];
    }
    return [];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.