From 86f6983d84c7fa59aee16ae165f2d063e61a047c Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Mon, 25 Nov 2024 13:48:49 +1000 Subject: [PATCH] Avoid a PHP Notice: Undefined index: tix_attendee_id (#1430) As we're temporarily allowing users to edit tickets without a connected user, we're hitting the above notice on every ticket edit action. The `user_must_confirm_ticket()` method first does an `isset()` to return early if `null` is passed in, which is the default behaviour when referring to a array item that does not exist. This change should have no logic changes as a result, but should result in the PHP Notice ceasing to exist. --- .../wp-content/plugins/camptix/addons/require-login.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public_html/wp-content/plugins/camptix/addons/require-login.php b/public_html/wp-content/plugins/camptix/addons/require-login.php index d78e7b78e..8f7926ce2 100644 --- a/public_html/wp-content/plugins/camptix/addons/require-login.php +++ b/public_html/wp-content/plugins/camptix/addons/require-login.php @@ -76,7 +76,7 @@ public function block_unauthenticated_actions() { // Temporary: We don't want to block users from editing tickets unless they are unconfirmed. // See: https://github.com/WordPress/wordcamp.org/issues/1393. // See: https://github.com/WordPress/wordcamp.org/issues/1420. - if ( $this->user_is_editing_ticket() && ! $this->user_must_confirm_ticket( $_REQUEST['tix_attendee_id'] ) ) { + if ( $this->user_is_editing_ticket() && ! $this->user_must_confirm_ticket( $_REQUEST['tix_attendee_id'] ?? null ) ) { return; } @@ -200,7 +200,7 @@ public function ticket_form_message() { } // Ask the attendee to confirm their registration - if ( $this->user_is_editing_ticket() && $this->user_must_confirm_ticket( $_REQUEST['tix_attendee_id'] ) ) { + if ( $this->user_is_editing_ticket() && $this->user_must_confirm_ticket( $_REQUEST['tix_attendee_id'] ?? null ) ) { $tickets_selected = array( get_post_meta( $_REQUEST['tix_attendee_id'], 'tix_ticket_id', true ) => 1 ); // mimic $_REQUEST['tix_tickets_selected'] if ( $this->tickets_have_questions( $tickets_selected ) ) {