Make WordPress Core

Opened 4 years ago

#49363 new defect (bug)

wpdb::query() does not detect LOAD DATA as an insert statement type

Reported by: lev0's profile lev0 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.3.2
Component: Database Keywords: has-patch
Focuses: Cc:

Description

The regular expression used to choose what return type a query should have does not include LOAD DATA. A query beginning with these tokens thus incorrectly returns 0 for the number of affected rows. The following patch would correct the issue:

  • wp-includes/wp-db.php

    a b  
    19731973
    19741974               if ( preg_match( '/^\s*(create|alter|truncate|drop)\s/i', $query ) ) {
    19751975                       $return_val = $this->result;
    1976                } elseif ( preg_match( '/^\s*(insert|delete|update|replace)\s/i', $query ) ) {
     1976               } elseif ( preg_match( '/^\s*(insert|delete|update|replace|load\s+data)\s/i', $query ) ) {
    19771977                       if ( $this->use_mysqli ) {
    19781978                               $this->rows_affected = mysqli_affected_rows( $this->dbh );
    19791979                       } else {

Change History (0)

Note: See TracTickets for help on using tickets.