Merge "Check for boolean false result from database query in SqlBagOStuff"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 25 Jul 2014 01:31:55 +0000 (01:31 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 25 Jul 2014 01:31:55 +0000 (01:31 +0000)
1  2 
includes/objectcache/SqlBagOStuff.php

@@@ -145,7 -145,7 +145,7 @@@ class SqlBagOStuff extends BagOStuff 
                        } else {
                                // We must keep a separate connection to MySQL in order to avoid deadlocks
                                // However, SQLite has an opposite behavior.
 -                              // @TODO: get this trick to work on PostgreSQL too
 +                              // @todo get this trick to work on PostgreSQL too
                                if ( wfGetDB( DB_MASTER )->getType() == 'mysql' ) {
                                        $lb = wfGetLBFactory()->newMainLB();
                                        $db = $lb->getConnection( DB_MASTER );
                                                // 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;
                                                        $conds,
                                                        __METHOD__,
                                                        array( 'LIMIT' => 100, 'ORDER BY' => 'exptime' ) );
-                                               if ( !$rows->numRows() ) {
+                                               if ( $rows === false || !$rows->numRows() ) {
                                                        break;
                                                }
                                                $keys = array();