* @codeCoverageIgnore
*/
public function __construct() {
- $this->requestTime = isset( $_SERVER['REQUEST_TIME_FLOAT'] )
- ? $_SERVER['REQUEST_TIME_FLOAT'] : microtime( true );
+ $this->requestTime = $_SERVER['REQUEST_TIME_FLOAT'];
// POST overrides GET data
// We don't use $_REQUEST here to avoid interference from cookies...
if ( !preg_match( '!^https?://!', $url ) ) {
$url = 'http://unused' . $url;
}
- MediaWiki\suppressWarnings();
+ Wikimedia\suppressWarnings();
$a = parse_url( $url );
- MediaWiki\restoreWarnings();
+ Wikimedia\restoreWarnings();
if ( $a ) {
$path = isset( $a['path'] ) ? $a['path'] : '';
$router->add( "$wgScript/$1" );
if ( isset( $_SERVER['SCRIPT_NAME'] )
- && preg_match( '/\.php5?/', $_SERVER['SCRIPT_NAME'] )
+ && preg_match( '/\.php/', $_SERVER['SCRIPT_NAME'] )
) {
# Check for SCRIPT_NAME, we handle index.php explicitly
# But we do have some other .php files such as img_auth.php
$host = $parts[0];
if ( $wgAssumeProxiesUseDefaultProtocolPorts && isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) {
- // Bug 70021: Assume that upstream proxy is running on the default
+ // T72021: Assume that upstream proxy is running on the default
// port based on the protocol. We have no reliable way to determine
// the actual port in use upstream.
$port = $stdPort;
* This is for use prior to Setup.php, when no WebRequest object is available.
* At other times, use the non-static function getProtocol().
*
- * @return array
+ * @return string
*/
public static function detectProtocol() {
if ( ( !empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ) ||
* @since 1.27
*/
public static function getRequestId() {
+ // This method is called from various error handlers and should be kept simple.
+
if ( !self::$reqId ) {
self::$reqId = isset( $_SERVER['UNIQUE_ID'] )
? $_SERVER['UNIQUE_ID'] : wfRandomString( 24 );
* available variant URLs.
*/
public function interpolateTitle() {
- // bug 16019: title interpolation on API queries is useless and sometimes harmful
+ // T18019: title interpolation on API queries is useless and sometimes harmful
if ( defined( 'MW_API' ) ) {
return;
}
*
* @since 1.28
* @param string $name
- * @param string|null $default Optional default
- * @return string
+ * @param string|null $default
+ * @return string|null
*/
public function getRawVal( $name, $default = null ) {
$name = strtr( $name, '.', '_' ); // See comment in self::getGPCVal()
* selected by a drop-down menu). For freeform input, see getText().
*
* @param string $name
- * @param string $default Optional default (or null)
- * @return string
+ * @param string|null $default Optional default (or null)
+ * @return string|null
*/
public function getVal( $name, $default = null ) {
$val = $this->getGPCVal( $this->data, $name, $default );
*
* @param string $name
* @param array $default Optional default (or null)
- * @return array
+ * @return array|null
*/
public function getArray( $name, $default = null ) {
$val = $this->getGPCVal( $this->data, $name, $default );
return $this->sessionId;
}
- /**
- * Returns true if the request has a persistent session.
- * This does not necessarily mean that the user is logged in!
- *
- * @deprecated since 1.27, use
- * \MediaWiki\Session\SessionManager::singleton()->getPersistedSessionId()
- * instead.
- * @return bool
- */
- public function checkSessionCookie() {
- global $wgInitialSessionId;
- wfDeprecated( __METHOD__, '1.27' );
- return $wgInitialSessionId !== null &&
- $this->getSession()->getId() === (string)$wgInitialSessionId;
- }
-
/**
* Get a cookie from the $_COOKIE jar
*
* @return string
*/
public static function getGlobalRequestURL() {
+ // This method is called on fatal errors; it should not depend on anything complex.
+
if ( isset( $_SERVER['REQUEST_URI'] ) && strlen( $_SERVER['REQUEST_URI'] ) ) {
$base = $_SERVER['REQUEST_URI'];
} elseif ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] )
public function response() {
/* Lazy initialization of response object for this request */
if ( !is_object( $this->response ) ) {
- $class = ( $this instanceof FauxRequest ) ? 'FauxResponse' : 'WebResponse';
+ $class = ( $this instanceof FauxRequest ) ? FauxResponse::class : WebResponse::class;
$this->response = new $class();
}
return $this->response;
header( 'Content-Type: text/html' );
$encUrl = htmlspecialchars( $url );
echo <<<HTML
+<!DOCTYPE html>
<html>
<head>
<title>Security redirect</title>
if (
IP::isPublic( $ipchain[$i + 1] ) ||
$wgUsePrivateIPs ||
- $proxyLookup->isConfiguredProxy( $curIP ) // bug 48919; treat IP as sane
+ $proxyLookup->isConfiguredProxy( $curIP ) // T50919; treat IP as sane
) {
// Follow the next IP according to the proxy
$nextIP = IP::canonicalize( $ipchain[$i + 1] );