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

WordPress Trac noreply at wordpress.org
Fri Oct 27 22:42:00 UTC 2017


#32315: $wpdb->insert fails without error msg
-------------------------------------------------+-------------------------
 Reporter:  dlt101                               |       Owner:
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Database                             |  Review
 Severity:  normal                               |     Version:  4.2.1
 Keywords:  needs-unit-tests dev-feedback has-   |  Resolution:
  patch                                          |     Focuses:
-------------------------------------------------+-------------------------

Comment (by mnelson4):

 > I don't think that the other places that it can return false are
 important to handle

 +1, if we want to tackle those, let's do those on another ticket (maybe we
 should rename this ticket to specify its only for failures when the value
 is too big for the column or contains invalid data)?)

 > I've included some basic unit tests in the patch as well.

 All star.

 I ran a manual test and the results looked good to me. I ran
 `$wpdb->insert` with a value that I knew was too big for the column and
 got

 "WordPress Database Error: Processing the value for the following field
 failed, the supplied value may have been too long or contained invalid
 data: {name-of-column}."

 Whereas without this patch I just got an empty string for
 `$wpdb->last_error`. So I think this is certainly an improvement.

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


More information about the wp-trac mailing list