1 system_test.module system_test_multiple_redirects($count)

Menu callback; sends a redirect header to itself until $count argument is 0.

Emulates the variable number of redirects (given by initial $count argument) to the final destination URL by continuous sending of 301 HTTP redirect headers to itself together with decrementing the $count parameter until the $count parameter reaches 0. After that it returns an empty string to render the final destination page.

@returns The location redirect if the $count > 0, otherwise an empty string.

Parameters

$count: The count of redirects left until the final destination page.

File

core/modules/simpletest/tests/system_test.module, line 231
Test module for system functions.

Code

function system_test_multiple_redirects($count) {
  $count = (int) $count;
  if ($count > 0) {
    header("location: " . url('system-test/multiple-redirects/' . --$count, array('absolute' => TRUE)), TRUE, 301);
    exit;
  }
  return '';
}