# Use external methods for external objects, text in table is URL-only then
if ( in_array( 'external', $flags ) ) {
$url = $text;
- @list(/* $proto */, $path ) = explode( '://', $url, 2 );
- if( $path == '' ) {
+ $parts = explode( '://', $url, 2 );
+ if( count( $parts ) == 1 || $parts[1] == '' ) {
wfProfileOut( __METHOD__ );
return false;
}
* @param $headers array
*/
function wfStreamFile( $fname, $headers = array() ) {
- $stat = @stat( $fname );
+ wfSuppressWarnings();
+ $stat = stat( $fname );
+ wfRestoreWarnings();
if ( !$stat ) {
header( 'HTTP/1.0 404 Not Found' );
header( 'Cache-Control: no-cache' );
if( $count > $max ) {
wfDebug( __METHOD__ . ": tripped! $key at $count $summary\n" );
if( $wgRateLimitLog ) {
- @file_put_contents( $wgRateLimitLog, wfTimestamp( TS_MW ) . ' ' . wfWikiID() . ': ' . $this->getName() . " tripped $key at $count $summary\n", FILE_APPEND );
+ wfSuppressWarnings();
+ file_put_contents( $wgRateLimitLog, wfTimestamp( TS_MW ) . ' ' . wfWikiID() . ': ' . $this->getName() . " tripped $key at $count $summary\n", FILE_APPEND );
+ wfRestoreWarnings();
}
$triggered = true;
} else {
$inc = $this->including();
if ( $inc ) {
- @list( $limit, $nlinks ) = explode( '/', $par, 2 );
- $this->limit = (int)$limit;
+ $parts = explode( '/', $par, 2 );
+ $this->limit = (int)$parts[0];
// @todo FIXME: nlinks is ignored
- $nlinks = $nlinks === 'nlinks';
+ $nlinks = isset( $parts[1] ) && $parts[1] === 'nlinks';
$this->offset = 0;
} else {
$nlinks = true;