[wp-trac] [WordPress Trac] #49363: wpdb::query() does not detect LOAD DATA as an insert statement type
WordPress Trac
noreply at wordpress.org
Wed Feb 5 02:41:19 UTC 2020
#49363: wpdb::query() does not detect LOAD DATA as an insert statement type
--------------------------+-----------------------------
Reporter: lev0 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: 5.3.2
Severity: normal | Keywords: has-patch
Focuses: |
--------------------------+-----------------------------
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:
{{{#!patch
--- a/wp-includes/wp-db.php
+++ b/wp-includes/wp-db.php
@@ -1973,7 +1973,7 @@
if ( preg_match( '/^\s*(create|alter|truncate|drop)\s/i',
$query ) ) {
$return_val = $this->result;
- } elseif ( preg_match(
'/^\s*(insert|delete|update|replace)\s/i', $query ) ) {
+ } elseif ( preg_match(
'/^\s*(insert|delete|update|replace|load\s+data)\s/i', $query ) ) {
if ( $this->use_mysqli ) {
$this->rows_affected =
mysqli_affected_rows( $this->dbh );
} else {
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49363>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list