[wp-trac] [WordPress Trac] #32315: $wpdb->insert fails without error msg
WordPress Trac
noreply at wordpress.org
Tue Nov 16 03:00:44 UTC 2021
#32315: $wpdb->insert fails without error msg
---------------------------------------------+-----------------------------
Reporter: dlt101 | Owner: hellofromTonya
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 5.9
Component: Database | Version: 4.2.1
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests commit | Focuses:
---------------------------------------------+-----------------------------
Changes (by hellofromTonya):
* status: accepted => closed
* resolution: => fixed
Comment:
In [changeset:"52176" 52176]:
WPDB: Capture error in `wpdb::$last_error` when insert fails instead of
silently failing for invalid data or value too long.
Instead of silently failing when attempting to insert a value into a
field, this commit saves the error in the `wpdb::$last_error` property.
Sets `last_error` with an error message if:
* `wpdb::query()` fails for invalid data
* `wpdb::process_fields()` fails to process the value(s) for the field(s)
where the value could be too long or contain invalid data
Sets `last_query` if `wpdb::query()` fails for invalid data.
If `__()` is not available, uses non-translated error message to ensure
the error is captured.
There is no change to wpdb aborting when an error occurs.
Adds tests.
Props dlt101, mnelson4, dd32, pento, hellofromTonya, davidbaumwald,
sergeybiryukov, johnbillion, swissspidy, datainterlock, anandau14,
anthonyeden, asif2bd, audrasjb, chaion07, dpegasusm, fpcsjames, galbaras,
jdgrimes, justindocanto, kwisatz, liammitchell, lucasw89, lukecarbis,
nettsite, nlpro, procodewp, psufan, richardfoley, skunkbad,
travisnorthcutt, woodyhayday, zoiec.
Fixes #32315.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32315#comment:81>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list