[wp-trac] [WordPress Trac] #32167: [32307] does not set $wdpb->error

WordPress Trac noreply at wordpress.org
Fri Oct 16 11:56:09 UTC 2015


#32167: [32307] does not set $wdpb->error
--------------------------+------------------------------
 Reporter:  nerrad        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Database      |     Version:  4.2.1
 Severity:  normal        |  Resolution:
 Keywords:  close         |     Focuses:
--------------------------+------------------------------
Changes (by nerrad):

 * keywords:  close needs-patch => close


Comment:

 certainly isn't a big issue otherwise I would've raised more noise.
 Returning false from this particular method is NOT the issue (although
 it's likely something I could make clearer).  It's more that when @wpdb
 bails on the query because of a failure here, there's no way for client
 code making the query to know why the bail (unless there's something
 that's changed since I created this ticket).

 `_process_field_lengths` will return false if values are invalid.
 which in turn is called by,
 `_process_fields` which returns false if values are invalid.
 which in turn is called by,
 `_insert_replace_helper` will return false if values are invalid.
 `update` will return false (and there's actually two calls to update, so
 what caused the error?)
 `delete` will return false

 The issue is that of consistency and context.  Consistency in that other
 things triggering an error in a query fill the `$wpdb->error` field, why
 shouldn't this?  Context, in that there is no way for client code to
 easily determine *what* caused the error without really digging into the
 code (no WP_Error object, nothing).

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


More information about the wp-trac mailing list