From 419021ebf087e30f34f53cd18ac787a0c9a305c0 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Fri, 8 Jul 2011 18:17:02 +0000 Subject: [PATCH] Removed some error suppression operators --- includes/Revision.php | 4 ++-- includes/StreamFile.php | 4 +++- includes/User.php | 4 +++- includes/specials/SpecialWantedpages.php | 6 +++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/includes/Revision.php b/includes/Revision.php index 93e6a05484..6053700e16 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -754,8 +754,8 @@ class Revision { # 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; } diff --git a/includes/StreamFile.php b/includes/StreamFile.php index f2f0566e86..d08cfec60c 100644 --- a/includes/StreamFile.php +++ b/includes/StreamFile.php @@ -10,7 +10,9 @@ * @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' ); diff --git a/includes/User.php b/includes/User.php index 839269d28d..b0dcc00e19 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1477,7 +1477,9 @@ class User { 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 { diff --git a/includes/specials/SpecialWantedpages.php b/includes/specials/SpecialWantedpages.php index 74c7014501..3824df0254 100644 --- a/includes/specials/SpecialWantedpages.php +++ b/includes/specials/SpecialWantedpages.php @@ -35,10 +35,10 @@ class WantedPagesPage extends WantedQueryPage { $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; -- 2.20.1