Code Modernization: Ignore the _multiwidget
property when collecting widget numbers in WP_Customize_Manager::import_theme_starter_content()
.
PHP 8 changes the way string to number comparisons are performed: https://wiki.php.net/rfc/string_to_number_comparison In particular, when calling `max()` on an array with numeric values and a non-numeric string, in PHP 8 the string is returned instead of a number. For `::import_theme_starter_content()`, this resulted in retrieving the `_multiwidget` property instead of the maximum widget number for a particular type. By explicitly ignoring the `_multiwidget` property, we make sure to retrieve the correct widget number value. Follow-up to [48960], [49043]. See #50913. git-svn-id: https://develop.svn.wordpress.org/trunk@49076 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8e3636b0d6
commit
76516b0830
@ -1231,6 +1231,8 @@ final class WP_Customize_Manager {
|
||||
$settings = $settings->getArrayCopy();
|
||||
}
|
||||
|
||||
unset( $settings['_multiwidget'] );
|
||||
|
||||
// Find the max widget number for this type.
|
||||
$widget_numbers = array_keys( $settings );
|
||||
if ( count( $widget_numbers ) > 0 ) {
|
||||
|
Loading…
Reference in New Issue
Block a user