From: Antoine Musso Date: Mon, 7 Nov 2011 14:46:49 +0000 (+0000) Subject: dieout when file is a boolean X-Git-Tag: 1.31.0-rc.0~26665 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=3b64e6b919a9f094d6b211b5d3bfde3ece807a85;p=lhc%2Fweb%2Fwiklou.git dieout when file is a boolean On file operation errors, the file variable can be assigned boolean false which is not a valid handle. Those backtrace can help users debug an issue when generating a filemap. --- diff --git a/maintenance/generateSitemap.php b/maintenance/generateSitemap.php index ab129f5452..bed23b76b3 100644 --- a/maintenance/generateSitemap.php +++ b/maintenance/generateSitemap.php @@ -347,13 +347,20 @@ class GenerateSitemap extends Maintenance { * @return Resource */ function open( $file, $flags ) { - return $this->compress ? gzopen( $file, $flags ) : fopen( $file, $flags ); + $ressource = $this->compress ? gzopen( $file, $flags ) : fopen( $file, $flags ); + if( $ressource === false ) { + wfDebugDieBacktrace( __METHOD__ . " error opening file $file with flags $flags. Check permissions?" ); + } + return $ressource; } /** * gzwrite() / fwrite() wrapper */ function write( &$handle, $str ) { + if( $handle === true || $handle === false ) { + wfDebugDieBacktrace( __METHOD__ . " was passed a boolean as a file handle.\n" ); + } if ( $this->compress ) gzwrite( $handle, $str ); else