v4.9.9 and 4.9.6: Error log for class-wc-appointments-gcal.php:1394

Issue #710 resolved
Valentina R created an issue

Hi, I spotted this in the logs. I think it is triggered by a scheduled action, and doesn’t appear to be causing a problem. Still there is some unguarded code that you might want to fix at the next opportunity.

Here is the error:

2020-07-29T20:28:25+00:00 CRITICAL Uncaught Error: Call to a member function get_status() on boolean in /home/realbroadwayplus/public_html/wp-content/plugins/woocommerce-appointments/includes/class-wc-appointments-gcal.php:1394
Stack trace:
#0 /home/realbroadwayplus/public_html/wp-content/plugins/woocommerce-appointments/includes/class-wc-appointments-gcal.php(1255): WC_Appointments_GCal->gcal_availability_rules(Array)
#1 /home/realbroadwayplus/public_html/wp-content/plugins/woocommerce-appointments/includes/class-wc-appointments-gcal.php(1237): WC_Appointments_GCal->gcal_fetch_events(Array)
#2 /home/realbroadwayplus/public_html/wp-includes/class-wp-hook.php(287): WC_Appointments_GCal->sync_from_gcal(”)
#3 /home/realbroadwayplus/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(”, Array)
#4 /home/realbroadwayplus/public_html/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#5 /home/realbroadwayplus/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/classes/ActionScheduler_QueueRunner.php(137): do_ in /home/realbroadwayplus/public_html/wp-content/plugins/woocommerce-appointments/includes/class-wc-appointments-gcal.php on line 1394

And the code in that file:

// Get appointment object.
\$appointment = get_wc_appointment( $appointment_eid );

// Don’t cancel trashed appointment.
if ( ‘trash’ === $appointment->get_status() ) {
continue;
}

i.e. test $appointment before using it.

Reported here.

Comments (1)

  1. Log in to comment