General: Revert r57698 for WP_List_Util::pluck().
r57698 caused a regression for arrays of objects which have magic methods and dynamic properties. A fix is identified. However, a deeper dive discovered additional scenarios which will require a different fix. Reverting gives more time for resolving these scenarios and more soak time to discover if there are others. Props dd32, jamescollins, swissspidy. See #59774. Built from https://develop.svn.wordpress.org/trunk@57732 git-svn-id: http://core.svn.wordpress.org/trunk@57233 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5f2e2f85f7
commit
6ab3caeb71
|
@ -165,13 +165,9 @@ class WP_List_Util {
|
||||||
*/
|
*/
|
||||||
foreach ( $this->output as $key => $value ) {
|
foreach ( $this->output as $key => $value ) {
|
||||||
if ( is_object( $value ) ) {
|
if ( is_object( $value ) ) {
|
||||||
if ( property_exists( $value, $field ) ) {
|
|
||||||
$newlist[ $key ] = $value->$field;
|
$newlist[ $key ] = $value->$field;
|
||||||
}
|
|
||||||
} elseif ( is_array( $value ) ) {
|
} elseif ( is_array( $value ) ) {
|
||||||
if ( array_key_exists( $field, $value ) ) {
|
|
||||||
$newlist[ $key ] = $value[ $field ];
|
$newlist[ $key ] = $value[ $field ];
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
_doing_it_wrong(
|
_doing_it_wrong(
|
||||||
__METHOD__,
|
__METHOD__,
|
||||||
|
@ -192,21 +188,17 @@ class WP_List_Util {
|
||||||
*/
|
*/
|
||||||
foreach ( $this->output as $value ) {
|
foreach ( $this->output as $value ) {
|
||||||
if ( is_object( $value ) ) {
|
if ( is_object( $value ) ) {
|
||||||
if ( property_exists( $value, $field ) ) {
|
if ( isset( $value->$index_key ) ) {
|
||||||
if ( property_exists( $value, $index_key ) ) {
|
|
||||||
$newlist[ $value->$index_key ] = $value->$field;
|
$newlist[ $value->$index_key ] = $value->$field;
|
||||||
} else {
|
} else {
|
||||||
$newlist[] = $value->$field;
|
$newlist[] = $value->$field;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} elseif ( is_array( $value ) ) {
|
} elseif ( is_array( $value ) ) {
|
||||||
if ( array_key_exists( $field, $value ) ) {
|
if ( isset( $value[ $index_key ] ) ) {
|
||||||
if ( array_key_exists( $index_key, $value ) ) {
|
|
||||||
$newlist[ $value[ $index_key ] ] = $value[ $field ];
|
$newlist[ $value[ $index_key ] ] = $value[ $field ];
|
||||||
} else {
|
} else {
|
||||||
$newlist[] = $value[ $field ];
|
$newlist[] = $value[ $field ];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
_doing_it_wrong(
|
_doing_it_wrong(
|
||||||
__METHOD__,
|
__METHOD__,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.5-beta3-57731';
|
$wp_version = '6.5-beta3-57732';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue