From 44e9daccd9d769cf1796e5e554d02a6b607a5272 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Thu, 25 Aug 2022 17:59:36 +1000 Subject: [PATCH] Harden endpoint against junk inputs. This avoids a PHP Notice when the `pledge_id` is invalid, or not a valid pledge. --- plugins/wporg-5ftf/includes/endpoints.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/wporg-5ftf/includes/endpoints.php b/plugins/wporg-5ftf/includes/endpoints.php index 1611584..320d617 100644 --- a/plugins/wporg-5ftf/includes/endpoints.php +++ b/plugins/wporg-5ftf/includes/endpoints.php @@ -93,7 +93,7 @@ function send_manage_email_handler() { $pledge_id = filter_input( INPUT_POST, 'pledge_id', FILTER_VALIDATE_INT ); $email = strtolower( filter_input( INPUT_POST, 'email', FILTER_VALIDATE_EMAIL ) ); - $valid_email = strtolower( get_post( $pledge_id )->{ META_PREFIX . 'org-pledge-email' } ); + $valid_email = strtolower( get_post( $pledge_id )->{ META_PREFIX . 'org-pledge-email' } ?? '' ); if ( $valid_email && $valid_email === $email ) { $message_sent = Email\send_manage_pledge_link( $pledge_id );