[wp-trac] [WordPress Trac] #32315: $wpdb->insert fails without error msg

WordPress Trac noreply at wordpress.org
Fri May 8 17:44:36 UTC 2015


#32315: $wpdb->insert fails without error msg
--------------------------+-----------------------------
 Reporter:  dlt101        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Database      |    Version:  4.2.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Given a field in MySQL defined as char(8), but the string you attempt to
 insert in that field has a length of 20.
 If you use $wpdb->query($wpdb->prepare(...)) syntax, it will insert the
 record (and possibly truncate the string).
 If you use $wpdb->insert(...) syntax, no record is created, and no error
 is reported in any manner. If you edit the MySQL def to char(20) or
 shorten the string to 8 chars, $wpdb->insert then inserts the record.

 Preferably, both forms of syntax should work the same and either (a)
 provide an understandable error and fail; (b) provide a warning and
 succeed.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32315>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list