From: Ori Livneh Date: Tue, 24 Jun 2014 02:11:51 +0000 (-0700) Subject: Check for boolean false result from database query in SqlBagOStuff X-Git-Tag: 1.31.0-rc.0~14759^2 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=a1f185025234a7710e582df79b7e8a1ac6116a19;p=lhc%2Fweb%2Fwiklou.git 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 --- 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();