bootstrap.inc line 727

/**
 * Since $_SERVER['REQUEST_URI'] is only available on Apache, we
 * generate an equivalent using other environment variables.
 */
function request_uri() {

  if (isset($_SERVER['REQUEST_URI'])) {
    $uri = $_SERVER['REQUEST_URI'];
  }
  else {
    if (isset($_SERVER['argv'])) {
      $uri = $_SERVER['SCRIPT_NAME'] .'?'. $_SERVER['argv'][0];
    }
    elseif (isset($_SERVER['QUERY_STRING'])) {
      $uri = $_SERVER['SCRIPT_NAME'] .'?'. $_SERVER['QUERY_STRING'];
    }
    else {
      $uri = $_SERVER['SCRIPT_NAME'];
    }
  }

  return $uri;
}

In the function request_uri() $uri not it is necessary, and return will work faster.
ifelse block whil increasing is simplest to read.
This is my improvement variant:

/**
 * Since $_SERVER['REQUEST_URI'] is only available on Apache, we
 * generate an equivalent using other environment variables.
 */
function request_uri() {
  if (isset($_SERVER['REQUEST_URI'])) {
    return $_SERVER['REQUEST_URI'];
  } elseif (isset($_SERVER['argv'])) {
    return $_SERVER['SCRIPT_NAME'] .'?'. $_SERVER['argv'][0];
  } elseif (isset($_SERVER['QUERY_STRING'])) {
    return $_SERVER['SCRIPT_NAME'] .'?'. $_SERVER['QUERY_STRING'];
  } else {
    return $_SERVER['SCRIPT_NAME'];
  }
}

Read patch in attachment.

CommentFileSizeAuthor
bootstrap.patch999 bytesstokito

Comments

stokito’s picture

Sorry I am stupid. I am understand. Please delete this issue.

dpearcefl’s picture

Status: Patch (to be ported) » Closed (won't fix)

Your wish is granted.