numRows on MySQL no longer propagates unrelated errors
[lhc/web/wiklou.git] / includes / db / DatabaseMysql.php
index fab0e96..011c0cb 100644 (file)
@@ -208,7 +208,7 @@ class DatabaseMysql extends DatabaseBase {
                // Unfortunately, mysql_fetch_object does not reset the last errno.
                // Only check for CR_SERVER_LOST and CR_UNKNOWN_ERROR, as
                // these are the only errors mysql_fetch_object can cause.
-               // See http://dev.mysql.com/doc/refman/5.0/es/mysql-fetch-row.html.
+               // See http://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-row.html.
                if( $errno == 2000 || $errno == 2013 ) {
                        throw new DBUnexpectedError( $this, 'Error in fetchObject(): ' . htmlspecialchars( $this->lastError() ) );
                }
@@ -232,7 +232,7 @@ class DatabaseMysql extends DatabaseBase {
                // Unfortunately, mysql_fetch_array does not reset the last errno.
                // Only check for CR_SERVER_LOST and CR_UNKNOWN_ERROR, as
                // these are the only errors mysql_fetch_object can cause.
-               // See http://dev.mysql.com/doc/refman/5.0/es/mysql-fetch-row.html.
+               // See http://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-row.html.
                if( $errno == 2000 || $errno == 2013 ) {
                        throw new DBUnexpectedError( $this, 'Error in fetchRow(): ' . htmlspecialchars( $this->lastError() ) );
                }
@@ -251,9 +251,11 @@ class DatabaseMysql extends DatabaseBase {
                wfSuppressWarnings();
                $n = mysql_num_rows( $res );
                wfRestoreWarnings();
-               if( $this->lastErrno() ) {
-                       throw new DBUnexpectedError( $this, 'Error in numRows(): ' . htmlspecialchars( $this->lastError() ) );
-               }
+               // Unfortunately, mysql_num_rows does not reset the last errno.
+               // We are not checking for any errors here, since
+               // these are no errors mysql_num_rows can cause.
+               // See http://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-row.html.
+               // See https://bugzilla.wikimedia.org/42430
                return $n;
        }