X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FGlobalFunctions.php;h=a6cfa0f6537e99d737de77357ad9bbdc2a65fd31;hb=7049236d2804c52639abae01d266d3ecaaff480f;hp=38daab5c327b2db7883760d66c4e4617dc0f1f41;hpb=5d1b19ed478271f4ef3204f4a388eb39effb275f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 38daab5c32..a6cfa0f653 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -518,7 +518,7 @@ function wfExpandUrl( $url, $defaultProto = PROTO_CURRENT ) { } } - $defaultProtoWithoutSlashes = substr( $defaultProto, 0, -2 ); + $defaultProtoWithoutSlashes = $defaultProto !== null ? substr( $defaultProto, 0, -2 ) : ''; if ( substr( $url, 0, 2 ) == '//' ) { $url = $defaultProtoWithoutSlashes . $url; @@ -1127,7 +1127,6 @@ function wfLogProfilingData() { if ( isset( $ctx['forwarded_for'] ) || isset( $ctx['client_ip'] ) || isset( $ctx['from'] ) ) { - // @phan-suppress-next-line PhanTypeArraySuspiciousNullable $ctx['proxy'] = $_SERVER['REMOTE_ADDR']; } @@ -1816,10 +1815,11 @@ function mimeTypeMatch( $type, $avail ) { * * @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 = []; @@ -1914,10 +1914,12 @@ function wfIsWindows() { /** * 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; } /** @@ -2030,7 +2032,7 @@ function wfRecursiveRemoveDir( $dir ) { */ 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%"; } /** @@ -2793,7 +2795,7 @@ function wfMemoryLimit( $newLimit ) { 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 );