mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-14 09:34:41 +00:00
REST API: Fix error in _fields filtering logic where only one of several requested sibling properties would be included.
Props kadamwhite, TimothyBlynJacobs. Fixes #48266. git-svn-id: https://develop.svn.wordpress.org/trunk@46456 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -743,8 +743,12 @@ function rest_filter_response_fields( $response, $server, $request ) {
|
||||
$parts = explode( '.', $field );
|
||||
$ref = &$fields_as_keyed;
|
||||
while ( count( $parts ) > 1 ) {
|
||||
$next = array_shift( $parts );
|
||||
$ref[ $next ] = array();
|
||||
$next = array_shift( $parts );
|
||||
if ( isset( $ref[ $next ] ) && true === $ref[ $next ] ) {
|
||||
// Skip any sub-properties if their parent prop is already marked for inclusion.
|
||||
break 2;
|
||||
}
|
||||
$ref[ $next ] = isset( $ref[ $next ] ) ? $ref[ $next ] : array();
|
||||
$ref = &$ref[ $next ];
|
||||
}
|
||||
$last = array_shift( $parts );
|
||||
|
||||
Reference in New Issue
Block a user