From 211d6062e1c36499f3d3ce8f778b1d7fab718c16 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 26 Jun 2014 16:25:31 -0700 Subject: [PATCH] Add some casts for sanity before BagOStuff::add() calls Change-Id: I6ecb609c88e4fc1ef614e94c551199bd610ca360 --- includes/objectcache/BagOStuff.php | 2 +- includes/utils/UIDGenerator.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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; -- 2.20.1