You are here

private static function ShibSessionVars::fixModRewriteIssues in Shibboleth Authentication 8

Get environment variables that may have been modified by mod_rewrite.

Parameters

$var:

Return value

string or null

1 call to ShibSessionVars::fixModRewriteIssues()
ShibSessionVars::__construct in src/Login/ShibSessionVars.php
ShibSessionVars constructor.

File

src/Login/ShibSessionVars.php, line 103

Class

ShibSessionVars

Namespace

Drupal\shib_auth\Login

Code

private static function fixModRewriteIssues($var) {
  if (!$var) {
    return NULL;
  }

  // foo-bar.
  if (array_key_exists($var, $_SERVER)) {
    return $_SERVER[$var];
  }

  // FOO-BAR.
  $var = strtoupper($var);
  if (array_key_exists($var, $_SERVER)) {
    return $_SERVER[$var];
  }

  // REDIRECT_foo_bar.
  $var = "REDIRECT_" . str_replace('-', '_', $var);
  if (array_key_exists($var, $_SERVER)) {
    return $_SERVER[$var];
  }

  // HTTP_FOO_BAR.
  $var = strtoupper($var);
  $var = preg_replace('/^REDIRECT/', 'HTTP', $var);
  if (array_key_exists($var, $_SERVER)) {
    return $_SERVER[$var];
  }
  return NULL;
}