Merge "numRows on MySQL no longer propagates unrelated errors"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 11 Mar 2013 18:14:19 +0000 (18:14 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 11 Mar 2013 18:14:19 +0000 (18:14 +0000)
1  2 
RELEASE-NOTES-1.21
includes/db/DatabaseMysql.php

diff --combined RELEASE-NOTES-1.21
@@@ -20,12 -20,12 +20,12 @@@ production
    disabled.
  
  === New features in 1.21 ===
 -* (bug 38110) Schema changes (adding or dropping tables, indicies and
 +* (bug 38110) Schema changes (adding or dropping tables, indices and
    fields) can be now be done separately from from other changes that
    update.php makes.  This is useful in environments that use database
    permissions to restrict schema changes but allow the DB user that
    MediaWiki normally runs as to perform other changes that update.php
 -  makes.  Schema changes can be run seperately.  See the file UPGRADE
 +  makes.  Schema changes can be run separately.  See the file UPGRADE
    for more information.
  * (bug 34876) jquery.makeCollapsible has been improved in performance.
  * Added ContentHandler facility to allow extensions to support other content
@@@ -96,7 -96,7 +96,7 @@@
  * (bug 5346) Categories that are redirects will be displayed italic in
    the category links section at the bottom of a page.
  * (bug 43915) New maintenance script deleteEqualMessages.php.
 -* You can now create checkbox option matrixes through the HTMLCheckMatrix
 +* You can now create checkbox option matrices through the HTMLCheckMatrix
    subclass in HTMLForm.
  * WikiText now permits the use of WAI-ARIA's role="presentation" inside of
    html elements and tables. This allows presentational markup, especially
    uz, vi.
  * Added 'CategoryAfterPageAdded' and 'CategoryAfterPageRemoved' hooks.
  * (bug 33186) Add image rotation api "imagerotate"
 +* (bug 34040) Add "User rights management" link on user page toolbox.
  
  === Bug fixes in 1.21 ===
  * (bug 40353) SpecialDoubleRedirect should support interwiki redirects.
  * (bug 42184) $wgUploadSizeWarning missing second variable
  * (bug 40326) Check if files exist with a different extension during uploading
  * (bug 34798) Updated CSS for Atom/RSS recent changes feeds to match on-wiki diffs.
+ * (bug 42430) Calling numRows on MySQL no longer propagates unrelated errors.
  
  === API changes in 1.21 ===
  * prop=revisions can now report the contentmodel and contentformat.
  * (bug 43849) ApiQueryImageInfo no longer throws exceptions with ForeignDBRepo
    redirects.
  * On error, any warnings generated before that error will be shown in the result.
 -* action=help suports generalized submodules (modules=query+value), querymodules obsolete
 +* action=help supports generalized submodules (modules=query+value), querymodules obsolete
  * ApiQueryImageInfo continuation is more reliable. The only major change is
    that the imagerepository property will no longer be set on page objects not
    processed in the current query (i.e. non-images or those skipped due to
  * ApiQueryImageInfo will now limit the number of calls to File::transform made
    in any one query. If there are too many, iicontinue will be returned.
  * action=query&meta=siteinfo&siprop=general will now return the regexes used for
 -  link trails and link prefices. Added for Parsoid support.
 +  link trails and link prefixes. Added for Parsoid support.
  * Added an API query module list=pageswithprop, which lists pages using a
    particular page property.
  * Added an API query module list=pagepropnames, which lists all page prop names
@@@ -208,7 -208,7 +208,7 @@@ class DatabaseMysql extends DatabaseBas
                // 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() ) );
                }
                // 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() ) );
                }
                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;
        }
  
        /**
         * Check to see if a named lock is available. This is non-blocking.
         *
 -       * @param $lockName String: name of lock to poll
 -       * @param $method String: name of method calling us
 +       * @param string $lockName name of lock to poll
 +       * @param string $method name of method calling us
         * @return Boolean
         * @since 1.20
         */
        /**
         * List all tables on the database
         *
 -       * @param $prefix string Only show tables with this prefix, e.g. mw_
 -       * @param $fname String: calling function name
 +       * @param string $prefix Only show tables with this prefix, e.g. mw_
 +       * @param string $fname calling function name
         * @return array
         */
        function listTables( $prefix = null, $fname = 'DatabaseMysql::listTables' ) {