[wp-trac] [WordPress Trac] #37645: Changes made to certain is_*() functions generates PHP Notices when arrays or objects are present
WordPress Trac
noreply at wordpress.org
Wed Feb 8 18:18:40 UTC 2017
#37645: Changes made to certain is_*() functions generates PHP Notices when arrays
or objects are present
--------------------------+------------------------------
Reporter: Enchiridion | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.5
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+------------------------------
Comment (by wonderboymusic):
@boonebgorges it seems to me IMHO that hydrated objects should be fine,
and, when objects are passed, the calls to `array_map()` should act on
`get_object_vars( $obj )` instead of `(array) $sir_mixed_a_lot`.
Perhaps a "helper" method:
{{{
function data_to_array( $data ) {
if ( is_object( $data ) ) {
return array_map( 'strval', get_object_vars( $data ) );
}
return array_map( 'strval', (array) $data );
}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37645#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list