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

WordPress Trac noreply at wordpress.org
Fri Oct 27 22:09:57 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:
-------------------------------------------------+-------------------------
Changes (by jdgrimes):

 * keywords:  needs-patch needs-unit-tests => needs-unit-tests dev-feedback
     has-patch
 * version:  4.8 => 4.2.1


Comment:

 [attachment:32315.diff] is a basic patch just to start things off. It just
 updates `process_fields()` to set `last_error` when `strip_invalid_text()`
 results in changes to the data (in other words, when the data was invalid
 and had to be corrected), thus causing `process_fields()` to return
 `false`. I don't think that the other places that it can return `false`
 are important to handle here, since those methods only fail when a
 database error has occurred attempting to get the column info or
 something, and thus the error will already be set.

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

 I hope this can get the ball rolling on this ticket. Feedback on the
 general direction of the patch would be appreciated.

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


More information about the wp-trac mailing list