Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#42122 closed defect (bug) (duplicate)

Problem in $wpdb->insert

Reported by: tazotodua's profile tazotodua Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Database Keywords:
Focuses: Cc:


in includes/wp-db.php, line 1976, there is:

	$data = $this->process_fields( $table, $data, $format );
		if ( false === $data ) {
			return false;

so, when using $wpdb->insert commands in plugins, sometimes we get 'false', without knowing an error. at least, that line should set i.e. $wpdb->last_error = 'array not processed',
and then we could have an idea why insert returned false. what's more, such query is not registered with ->last_query and it even deteriorates the debuging of error. have spent 3 hours to find out why my plugin's insert didnt work...

please, enrich that area.

Change History (3)

#1 @SergeyBiryukov
7 years ago

  • Component changed from General to Database

#2 @tazotodua
7 years ago

my DB column (the column where happens problem) is varchar(20) and strip_invalid_text strips it :

however, all these problems going on, as, user dont know what happens and like me, may have to spend 3 hours.

i think all those errors and issues should be somewhere outputed (like: ' error: column "XYZ" char length is less then your passed data "abcdefged....." !

Last edited 7 years ago by tazotodua (previous) (diff)

#3 @dd32
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #32315.

Note: See TracTickets for help on using tickets.