[wp-trac] [WordPress Trac] #48363: Empty string in database for boolean meta not cast to false
WordPress Trac
noreply at wordpress.org
Fri Oct 18 20:28:03 UTC 2019
#48363: Empty string in database for boolean meta not cast to false
----------------------------+--------------------------------
Reporter: chrisvanpatten | Owner: TimothyBlynJacobs
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 5.3
Component: REST API | Version: trunk
Severity: normal | Resolution:
Keywords: has-unit-tests | Focuses: rest-api
----------------------------+--------------------------------
Changes (by kadamwhite):
* keywords: has-patch has-unit-tests dev-feedback commit => has-unit-tests
Comment:
I've been talking through this with @TimothyBlynJacobs in a slack thread,
which was unfortunately within a DM; summarizing my thoughts here:
As I've considered this change my biggest concern is that we're conflating
the concepts of an empty and a default value. Technically the method we've
introduced as `get_default_for_type()` is really returning the value to
use when we encounter an _empty_ meta value, not the schema default. We
happen to use the result of this function as the default within the
schema, but as Timothy said in the thread, this is an implementation
detail. The regression in this thread is about the handling of empty
values, not schema defaults.
The naming of the method we're using is therefore confusing. Timothy has
proposed therefore that we should consider renaming this method, and I
concur; we're going to alter it to read `get_empty_value_for_type`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48363#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list