}
}
- $defaultProtoWithoutSlashes = substr( $defaultProto, 0, -2 );
+ $defaultProtoWithoutSlashes = $defaultProto !== null ? substr( $defaultProto, 0, -2 ) : '';
if ( substr( $url, 0, 2 ) == '//' ) {
$url = $defaultProtoWithoutSlashes . $url;
*
* @param array $cprefs Client's acceptable type list
* @param array $sprefs Server's offered types
- * @return string
+ * @return string|null
*
* @todo FIXME: Doesn't handle params like 'text/plain; charset=UTF-8'
* XXX: generalize to negotiate other stuff
+ * @todo The function appears unused. Is it worth to keep?
*/
function wfNegotiateType( $cprefs, $sprefs ) {
$combine = [];
/**
* Check if we are running under HHVM
*
+ * @deprecated since 1.34, HHVM is no longer supported
* @return bool
*/
function wfIsHHVM() {
- return defined( 'HHVM_VERSION' );
+ // wfDeprecated( __FUNCTION__, '1.34' );
+ return false;
}
/**
*/
function wfPercent( $nr, $acc = 2, $round = true ) {
$ret = sprintf( "%.${acc}f", $nr );
- return $round ? round( $ret, $acc ) . '%' : "$ret%";
+ return $round ? round( (float)$ret, $acc ) . '%' : "$ret%";
}
/**
function wfTransactionalTimeLimit() {
global $wgTransactionalTimeLimit;
- $timeLimit = ini_get( 'max_execution_time' );
+ $timeLimit = (int)ini_get( 'max_execution_time' );
// Note that CLI scripts use 0
if ( $timeLimit > 0 && $wgTransactionalTimeLimit > $timeLimit ) {
set_time_limit( $wgTransactionalTimeLimit );