Reset $wpdb->insert_id on a failed INSERT or REPLACE. See [24459] [24494].
git-svn-id: http://core.svn.wordpress.org/trunk@24872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7f12e16e47
commit
f39e2c28ce
|
@ -1204,6 +1204,10 @@ class wpdb {
|
|||
|
||||
// If there is an error then take note of it..
|
||||
if ( $this->last_error = mysql_error( $this->dbh ) ) {
|
||||
// Clear insert_id on a subsequent failed insert.
|
||||
if ( $this->insert_id && preg_match( '/^\s*(insert|replace)\s/i', $query ) )
|
||||
$this->insert_id = 0;
|
||||
|
||||
$this->print_error();
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue