Make WordPress Core

Changeset 51232

Timestamp:
06/25/2021 12:07:15 AM (3 years ago)
Author:
desrosj
Message:

Widgets: Fix an “Invalid value” warning when adding a new widget in the Customizer.

This fixes a regression introduced in [50996] where sites that have been opted-out of the block-based widget editor experienced an “Invalid value.” error when adding a new widget to a sidebar in the Customizer.

This was caused by the early return value was changed to null from $value when set to an empty array, resulting in the widget being evaluated as invalid elsewhere.

Props jamesros161, caseymilne, naoki0h, ixkaito, zieladam, noisysocks, hellofromTonya.
Fixes #53479.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-widgets.php

    r51228 r51232  
    14141414
    14151415        if ( array() === $value ) {
    1416             return;
     1416            return;
    14171417        }
    14181418
  • trunk/tests/phpunit/tests/customize/widgets.php

    r51228 r51232  
    482482
    483483    /**
     484
     485
     486
     487
     488
     489
     490
     491
     492
     493
     494
     495
     496
     497
     498
     499
     500
     501
     502
     503
     504
     505
     506
     507
     508
     509
     510
     511
     512
     513
     514
     515
     516
     517
     518
     519
     520
     521
     522
     523
     524
     525
     526
     527
     528
     529
     530
     531
     532
     533
     534
     535
     536
     537
     538
     539
     540
     541
     542
     543
     544
     545
     546
     547
     548
     549
     550
     551
     552
    484553     * Get the widget control args for tests.
    485554     *
Note: See TracChangeset for help on using the changeset viewer.