Undefined indexes in class-calendar-widget

WordPress Event Management, Calendars & Registration Forums Report A Bug Undefined indexes in class-calendar-widget

This topic contains 1 reply, has 2 voices, and was last updated by  Stephen Harris 7 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #24457

    With WordPress debugging enabled, the following debug output appears on a page that contains the [eo_calendar] short code with no attributes:

    Notice: Undefined index: event-venue in /var/www/html/philipgust/wp/wp-content/plugins/event-organiser/classes/class-eo-calendar-widget.php on line 345

    Notice: Undefined index: event-category in /var/www/html/philipgust/wp/wp-content/plugins/event-organiser/classes/class-eo-calendar-widget.php on line 346

    The pair repeats for each event in the current month.

    The problem is that $args[‘event-venue’] and $args[‘event-category’] are being used to initialize the filter array without checking whether the $arg keys exist (short code attributes are specified). The filter creation code should be:

    $query_args = array_filter( array(
    ‘event-venue’ => isset($args[‘event-venue’]) ? $args[‘event-venu’] : null,
    ‘event-category’ => isset($args[‘event-category’]) ? $args[‘event-category’] : null,
    ) );

    In this case, it’s OK to use isset() instead of the slower array_key_exists().

    ICG EventOrganizer-Admin
    #24475

    Thanks, this should be fixed in this commit: https://github.com/stephenharris/Event-Organiser/commit/15524b9da32325cb2313c1531a1e2b9f8de3c694 which will be included in the next release.

    Stephen Harris
Viewing 2 posts - 1 through 2 (of 2 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.