[wp-trac] [WordPress Trac] #48711: PHP Notice: Undefined index: before_widget
WordPress Trac
noreply at wordpress.org
Mon Nov 18 21:33:16 UTC 2019
#48711: PHP Notice: Undefined index: before_widget
----------------------------+-----------------------------
Reporter: carmen28moreno | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version:
Severity: normal | Keywords:
Focuses: |
----------------------------+-----------------------------
Since I install elementor, I'm having the following errors in my
debug.log:
[18-Nov-2019 20:09:04 UTC] PHP Notice: Undefined index: before_widget in
/var/www/wp-content/plugins/themeisle-companion/vendor/codeinwp/elementor-
extra-widgets/widgets/woo/best-products.php on line 77
[18-Nov-2019 20:09:04 UTC] PHP Notice: Undefined index: after_widget in
/var/www/wp-content/plugins/themeisle-companion/vendor/codeinwp/elementor-
extra-widgets/widgets/woo/best-products.php on line 93
[18-Nov-2019 20:09:04 UTC] PHP Notice: Undefined index: widget_id in
/var/www/wp-content/plugins/themeisle-companion/vendor/codeinwp/elementor-
extra-widgets/widgets/woo/best-products.php on line 96
When having this error, a momentaneous error message 503 appears and my
page is down.
Here are the lines of code referenced by the error (the bold ones).
{{{
public function widget( $args, $instance ) {
$cache = array();
if ( ! $this->is_preview() ) {
$cache = wp_cache_get( 'woo_best_products',
'widget' );
}
if ( ! is_array( $cache ) ) {
$cache = array();
}
if ( ! isset( $args['widget_id'] ) ) {
$args['widget_id'] = $this->id;
}
if ( isset( $cache[ $args['widget_id'] ] ) ) {
echo $cache[ $args['widget_id'] ];
return;
}
ob_start();
$title = ( ! empty( $instance['title'] ) ) ?
$instance['title'] : '';
$title = apply_filters( 'widget_title', $title, $instance,
$this->id_base );
if ( '' == $title ) {
$title = __( 'Best Sellers', 'themeisle-companion'
);
}
$limit = ( ! empty( $instance['limit'] ) ) ? absint(
$instance['limit'] ) : 4;
if ( '' == $limit ) {
$limit = 4;
}
$columns = ( ! empty( $instance['columns'] ) ) ? absint(
$instance['columns'] ) : 4;
if ( '' == $columns ) {
$columns = 4;
}
$args = apply_filters(
'elementor-addon-widgets_product_categories_args',
array(
'limit' => $limit,
'columns' => $columns,
'title' => $title,
'orderby' => 'date',
'order' => 'desc',
)
);
77----> echo $args['before_widget'];
echo '<section class="eaw-product-section woo-best-
products">';
do_action(
'storepage_homepage_before_best_selling_products' );
echo '<h2 class="section-title">' . wp_kses_post(
$args['title'] ) . '</h2>';
do_action(
'storepage_homepage_after_best_selling_products_title' );
echo $this->do_shortcode(
'best_selling_products', array(
'per_page' => intval( $args['limit'] ),
'columns' => intval( $args['columns'] ),
)
);
do_action(
'storepage_homepage_after_best_selling_products' );
echo '</section>';
93----> echo $args['after_widget'];
if ( ! $this->is_preview() ) {
96----> $cache[ $args['widget_id'] ] = ob_get_flush();
wp_cache_set( 'woo_best_products', $cache,
'widget' );
} else {
ob_end_flush();
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48711>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list