Make WordPress Core

Ticket #55121: 55121-1.diff

File 55121-1.diff, 897 bytes (added by karpstrucking, 18 months ago)

workaround for null and doing_it_wrong

  • wp-includes/class-wp-widget.php

    diff --git a/wp-includes/class-wp-widget.php b/wp-includes/class-wp-widget.php
    index e91f5cd9f9..e2afca0193 100644
    a b class WP_Widget { 
    365365               $this->_set( $widget_args['number'] );
    366366               $instances = $this->get_settings();
    367367
     368               if ( is_null( $instances[ $this->number ] ) ) {
     369                       $instances[ $this->number ] = [];
     370                       _doing_it_wrong(
     371                               "WP_Widget::update( null )",
     372                               __( 'WP_Widget::update() must return an array of settings or false.' ),
     373                               '6.1.0'
     374                       );
     375               }
     376
    368377               if ( isset( $instances[ $this->number ] ) ) {
    369378                       $instance = $instances[ $this->number ];