X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=blobdiff_plain;f=includes%2FWebRequest.php;h=6f0307da8db02589d7b8c6b00cc835ee80461175;hb=9e0e67658e56c4d41383bcaa3aab1e9dc2b9de63;hp=cd62737c56553d38df7e1aefe5fd9974a991d004;hpb=8a95833baed3b8071fcbd8cd2bc8c3449409f665;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/WebRequest.php b/includes/WebRequest.php index cd62737c56..6f0307da8d 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -88,8 +88,7 @@ class WebRequest { * @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... @@ -123,9 +122,9 @@ class WebRequest { 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'] : ''; @@ -270,6 +269,8 @@ class WebRequest { * @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 ); @@ -781,6 +782,8 @@ class WebRequest { * @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'] ) @@ -956,7 +959,7 @@ class WebRequest { 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;