Sanity check $this->handle on close()
authorAaron Schulz <aaron@users.mediawiki.org>
Thu, 13 Aug 2009 20:42:19 +0000 (20:42 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Thu, 13 Aug 2009 20:42:19 +0000 (20:42 +0000)
includes/Cdb_PHP.php

index 8f1b30e..49294f7 100644 (file)
@@ -102,7 +102,8 @@ class CdbReader_PHP extends CdbReader {
        }
 
        function close() {
-               fclose( $this->handle );
+               if( isset($this->handle) )
+                       fclose( $this->handle );
                unset( $this->handle );
        }
 
@@ -251,7 +252,8 @@ class CdbWriter_PHP extends CdbWriter {
 
        public function close() {
                $this->finish();
-               fclose( $this->handle );
+               if( isset($this->handle) )
+                       fclose( $this->handle );
                if ( wfIsWindows() && file_exists($this->realFileName) ) {
                        unlink( $this->realFileName );
                }