Opened 5 years ago
#49363 new defect (bug)
wpdb::query() does not detect LOAD DATA as an insert statement type
Reported by: | 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 1973 1973 1974 1974 if ( preg_match( '/^\s*(create|alter|truncate|drop)\s/i', $query ) ) { 1975 1975 $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 ) ) { 1977 1977 if ( $this->use_mysqli ) { 1978 1978 $this->rows_affected = mysqli_affected_rows( $this->dbh ); 1979 1979 } else {
Note: See
TracTickets for help on using
tickets.