Topic on Project:Support desk

Jump to navigation Jump to search

Undefined index: REQUEST_TIME_FLOAT in ...\wiki\includes\WebStart.php

2
Wimw (talkcontribs)

After installing Semantic MW, I get the error message "Undefined index: REQUEST_TIME_FLOAT in ... \wiki\includes\WebStart.php on line 42


The line indicated reads:

  /**
  * @var float Request start time as fractional seconds since epoch
  * @deprecated since 1.25; use $_SERVER['REQUEST_TIME_FLOAT'] or
  *   WebRequest::getElapsedTime() instead.
  */
  $wgRequestTime = $_SERVER['REQUEST_TIME_FLOAT'];

What is the way to solve this? There are two more units using this index (WegRequest and Timing), but both first test it with isset(). Should I change this line similarly? Or should I defer it as suggested in the comment to WebRequest (but then, what is the correct syntax in php?). Or is the solution not to be sought in code?

thanks

Wimw (talkcontribs)

replacing that code with

isset( $_SERVER['REQUEST_TIME_FLOAT'] ) ? $_SERVER['REQUEST_TIME_FLOAT'] : microtime( true );

(copied from WebRequest) solved this issue.