From a1f185025234a7710e582df79b7e8a1ac6116a19 Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Mon, 23 Jun 2014 19:11:51 -0700 Subject: [PATCH] Check for boolean false result from database query in SqlBagOStuff Database::select() can return false, so we should check for it before attempting to iterate on the result or to call methods on it. Change-Id: I0862493305e5b2784422e0e94b3e62e734267795 --- includes/objectcache/SqlBagOStuff.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php index 0c91dab43b..7157e79daf 100644 --- a/includes/objectcache/SqlBagOStuff.php +++ b/includes/objectcache/SqlBagOStuff.php @@ -244,6 +244,9 @@ class SqlBagOStuff extends BagOStuff { // We do not want to flush the TRX as that can break callers. $db->trxLevel() ? array( 'LOCK IN SHARE MODE' ) : array() ); + if ( $res === false ) { + continue; + } foreach ( $res as $row ) { $row->serverIndex = $serverIndex; $row->tableName = $tableName; @@ -579,7 +582,7 @@ class SqlBagOStuff extends BagOStuff { $conds, __METHOD__, array( 'LIMIT' => 100, 'ORDER BY' => 'exptime' ) ); - if ( !$rows->numRows() ) { + if ( $rows === false || !$rows->numRows() ) { break; } $keys = array(); -- 2.20.1