WordPress.org

Make WordPress Core

Changeset 24872


Ignore:
Timestamp:
07/29/2013 06:14:05 PM (7 years ago)
Author:
nacin
Message:

Reset $wpdb->insert_id on a failed INSERT or REPLACE. See [24459] [24494].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/wp-db.php

    r24758 r24872  
    12051205        // If there is an error then take note of it..
    12061206        if ( $this->last_error = mysql_error( $this->dbh ) ) {
     1207            // Clear insert_id on a subsequent failed insert.
     1208            if ( $this->insert_id && preg_match( '/^\s*(insert|replace)\s/i', $query ) )
     1209                $this->insert_id = 0;
     1210
    12071211            $this->print_error();
    12081212            return false;
Note: See TracChangeset for help on using the changeset viewer.