Merge "Removes deprecated $wgUseCommaCount variable"
[lhc/web/wiklou.git] / includes / utils / UIDGenerator.php
index 0eac06e..0ce90c1 100644 (file)
@@ -278,12 +278,14 @@ class UIDGenerator {
                if ( ( $flags & self::QUICK_VOLATILE ) && PHP_SAPI !== 'cli' ) {
                        try {
                                $cache = ObjectCache::newAccelerator( array() );
-                       } catch ( MWException $e ) {} // not supported
+                       } catch ( MWException $e ) {
+                               // not supported
+                       }
                }
                if ( $cache ) {
                        $counter = $cache->incr( $bucket, $count );
                        if ( $counter === false ) {
-                               if ( !$cache->add( $bucket, $count ) ) {
+                               if ( !$cache->add( $bucket, (int)$count ) ) {
                                        throw new MWException( 'Unable to set value to ' . get_class( $cache ) );
                                }
                                $counter = $count;
@@ -500,6 +502,6 @@ class UIDGenerator {
        }
 
        function __destruct() {
-               array_map( 'fclose', $this->fileHandles );
+               array_map( 'fclose', array_filter( $this->fileHandles ) );
        }
 }