Skip to content

Commit

Permalink
Merge pull request #134 from stanleybz/fix/esi_sub_widget_block_non_a…
Browse files Browse the repository at this point in the history
…rray_instance

Prevent non array instance cause 500 error
  • Loading branch information
hi-hai committed Apr 16, 2019
2 parents 95c8304 + ce5f209 commit a4d03b0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions litespeed-cache/inc/esi.class.php
Expand Up @@ -282,7 +282,7 @@ public function register_not_esi_actions()
return ;
}

add_filter('widget_display_callback', array($this, 'sub_widget_block'), 0, 3) ;
add_filter('widget_display_callback', array($this, 'sub_widget_block'), 0, 3) ;

// Add admin_bar esi
if ( LiteSpeed_Cache_Router::is_logged_in() ) {
Expand Down Expand Up @@ -586,8 +586,13 @@ public static function widget_default_options($options, $widget)
* @param array $args Parameter used to build the widget.
* @return mixed Return false if display through esi, instance otherwise.
*/
public function sub_widget_block( array $instance, WP_Widget $widget, array $args )
public function sub_widget_block( $instance, WP_Widget $widget, array $args )
{
// #210407
if ( ! is_array( $instance ) ) {
return $instance ;
}

$name = get_class( $widget ) ;
if ( ! isset( $instance[ LiteSpeed_Cache_Config::OPTION_NAME ] ) ) {
return $instance ;
Expand Down

0 comments on commit a4d03b0

Please sign in to comment.