From 57aee600f759feefcf067c630fc19b7304396f4c Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Tue, 28 Sep 2010 11:39:10 +0000 Subject: [PATCH] Sanity check on result from SHOW PROCESSLIST, foreach -> while (sorta followup to r68878) --- includes/db/DatabaseMysql.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index afcaa2cd44..041ebd16d3 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -321,8 +321,11 @@ class DatabaseMysql extends DatabaseBase { return $this->mFakeSlaveLag; } $res = $this->query( 'SHOW PROCESSLIST', __METHOD__ ); + if( !$res ) { + return false; + } # Find slave SQL thread - while ( $row = $this->fetchObject( $res ) ) { + foreach( $res as $row ) { /* This should work for most situations - when default db * for thread is not specified, it had no events executed, * and therefore it doesn't know yet how lagged it is. -- 2.20.1