https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102286

Revision: 102286
Author:   hashar
Date:     2011-11-07 14:46:49 +0000 (Mon, 07 Nov 2011)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/phase3/maintenance/generateSitemap.php

Modified: trunk/phase3/maintenance/generateSitemap.php
===================================================================
--- trunk/phase3/maintenance/generateSitemap.php        2011-11-07 14:39:12 UTC 
(rev 102285)
+++ trunk/phase3/maintenance/generateSitemap.php        2011-11-07 14:46:49 UTC 
(rev 102286)
@@ -347,13 +347,20 @@
         * @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


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to