From: Aaron Schulz Date: Thu, 26 Jun 2014 23:25:31 +0000 (-0700) Subject: Add some casts for sanity before BagOStuff::add() calls X-Git-Tag: 1.31.0-rc.0~15201^2 X-Git-Url: http://git.cyclocoop.org/data/Luca_Pacioli_%28Gemaelde%29.jpeg?a=commitdiff_plain;h=211d6062e1c36499f3d3ce8f778b1d7fab718c16;p=lhc%2Fweb%2Fwiklou.git Add some casts for sanity before BagOStuff::add() calls Change-Id: I6ecb609c88e4fc1ef614e94c551199bd610ca360 --- diff --git a/includes/objectcache/BagOStuff.php b/includes/objectcache/BagOStuff.php index 56f1be23b5..dca5f32cbe 100644 --- a/includes/objectcache/BagOStuff.php +++ b/includes/objectcache/BagOStuff.php @@ -338,7 +338,7 @@ abstract class BagOStuff { */ public function incrWithInit( $key, $ttl, $value = 1, $init = 1 ) { return $this->incr( $key, $value ) || - $this->add( $key, $init, $ttl ) || $this->incr( $key, $value ); + $this->add( $key, (int)$init, $ttl ) || $this->incr( $key, $value ); } /** diff --git a/includes/utils/UIDGenerator.php b/includes/utils/UIDGenerator.php index e2013b05cf..0ce90c1d98 100644 --- a/includes/utils/UIDGenerator.php +++ b/includes/utils/UIDGenerator.php @@ -285,7 +285,7 @@ class UIDGenerator { 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;