General: Revert strict comparison in `WP_List_Util` for now.
Casting the values to a string causes `Array to string conversion` PHP warnings, so using loose comparison restores the previous behavior for code relying on type juggling when using the `wp_list_filter()` function, e.g. comparing a numeric string to an integer. The unit test case added for this scenario in the previous commit remains. Follow-up to [55908], [56137]. See #57839. Built from https://develop.svn.wordpress.org/trunk@56138 git-svn-id: http://core.svn.wordpress.org/trunk@55650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7497b1099f
commit
84e1f03b1f
|
@ -116,16 +116,12 @@ class WP_List_Util {
|
||||||
foreach ( $args as $m_key => $m_value ) {
|
foreach ( $args as $m_key => $m_value ) {
|
||||||
if ( is_array( $obj ) ) {
|
if ( is_array( $obj ) ) {
|
||||||
// Treat object as an array.
|
// Treat object as an array.
|
||||||
if ( array_key_exists( $m_key, $obj )
|
if ( array_key_exists( $m_key, $obj ) && ( $m_value == $obj[ $m_key ] ) ) {
|
||||||
&& ( (string) $m_value === (string) $obj[ $m_key ] )
|
|
||||||
) {
|
|
||||||
$matched++;
|
$matched++;
|
||||||
}
|
}
|
||||||
} elseif ( is_object( $obj ) ) {
|
} elseif ( is_object( $obj ) ) {
|
||||||
// Treat object as an object.
|
// Treat object as an object.
|
||||||
if ( isset( $obj->{$m_key} )
|
if ( isset( $obj->{$m_key} ) && ( $m_value == $obj->{$m_key} ) ) {
|
||||||
&& ( (string) $m_value === (string) $obj->{$m_key} )
|
|
||||||
) {
|
|
||||||
$matched++;
|
$matched++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -280,7 +276,7 @@ class WP_List_Util {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (string) $a[ $field ] === (string) $b[ $field ] ) {
|
if ( $a[ $field ] == $b[ $field ] ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.3-beta3-56137';
|
$wp_version = '6.3-beta3-56138';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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