[wp-trac] [WordPress Trac] #32315: $wpdb->insert fails without error msg
WordPress Trac
noreply at wordpress.org
Mon Oct 31 18:08:01 UTC 2016
#32315: $wpdb->insert fails without error msg
------------------------------------------+------------------------------
Reporter: dlt101 | Owner:
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: Awaiting Review
Component: Database | Version:
Severity: normal | Resolution:
Keywords: needs-patch needs-unit-tests | Focuses:
------------------------------------------+------------------------------
Comment (by mnelson4):
So if an insert fails because a value is too long for its column, where
should the error message go?
`$wpdb->last_error` just contains MySQL errors, but this error would be
generated by WordPress itself and so no MySQL query is actually ran (or
generated, in fact).
I'm inclined to suggest we should just use `$wpdb->print_error()`, with
text like "You attempted to put x characters into a column that only
accepts y, so your query was not performed." The error will then be
recorded on the global `$EZSQL_ERROR` too, an error will be printed if
WP_DEBUG is on, and `$wpdb->last_error` will continue to only be errors
generated by MySQL.
Thoughts?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32315#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list