}
}
- $defaultProtoWithoutSlashes = substr( $defaultProto, 0, -2 );
+ $defaultProtoWithoutSlashes = $defaultProto !== null ? substr( $defaultProto, 0, -2 ) : '';
if ( substr( $url, 0, 2 ) == '//' ) {
$url = $defaultProtoWithoutSlashes . $url;
*/
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 );