[wp-trac] [WordPress Trac] #43392: Support 'object' and 'array' types in register_meta()
WordPress Trac
noreply at wordpress.org
Thu Jun 20 10:42:30 UTC 2019
#43392: Support 'object' and 'array' types in register_meta()
-------------------------------------------------+-------------------------
Reporter: diegoliv | Owner:
| TimothyBlynJacobs
Type: enhancement | Status: assigned
Priority: normal | Milestone: 5.3
Component: Options, Meta APIs | Version: 4.9.4
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests dev- | Focuses: rest-api
feedback 2nd-opinion |
-------------------------------------------------+-------------------------
Comment (by birgire):
Hi, I noticed a comment here:
https://stackoverflow.com/a/11735933/2078474
about the {{{SORT_REGULAR}}} option of {{{array_unique()}}} instead of the
default {{{SORT_STRING}}}.
I've not tested it, but wonder if it's relevant here.
In any case I wonder if it would be beneficial to add an inline comment
with a little bit of explanation for this part:
{{{
$to_remove = array_map( 'maybe_unserialize', array_unique( array_map(
static function( $value ) {
return is_scalar( $value ) ? $value : maybe_serialize( $value );
}, $to_remove ) ) );
}}}
... this just came to mind, as this part stopped my quick code skimming
:-)
I also wonder if:
{{{
$to_remove = array_map( 'maybe_unserialize', array_unique( array_map(
'maybe_serialize', $to_remove ) ) );
}}}
would have a noticeable performance difference.
ps: Just some minor notes regarding the inline docs:
- There are missing {{{@since 43392}}} on two new test methods.
- Missing translation comments.
- I also think the {{{"This is need"}}} should be {{{"This is needed"}}}
in the description for the {{{default_additional_properties_to_false()}}}
method.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43392#comment:30>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list