X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2FWebRequest.php;h=fa8f84d6971306ac5809439e339156921b485e4f;hp=0a7f416cffad5f2a07fea4540e5b924748719b16;hb=8de958444f1d36ecb95d3a53d96cc1404e95468e;hpb=c2adecb31b16a36efdb509a575533c7f103a0576 diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 0a7f416cff..fa8f84d697 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... @@ -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 ); @@ -431,7 +432,7 @@ class WebRequest { * selected by a drop-down menu). For freeform input, see getText(). * * @param string $name - * @param string $default Optional default (or null) + * @param string|null $default Optional default (or null) * @return string|null */ public function getVal( $name, $default = null ) { @@ -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'] )