From 5b548fceb995edb558478aa5282f9021c7fedfc7 Mon Sep 17 00:00:00 2001
From: Kevin Cristiano <kcristiano@kcristiano.com>
Date: Wed, 15 Jun 2022 07:38:46 -0400
Subject: [PATCH] civicrm release-5.50.2

---
 civicrm.php                                   |  4 +-
 civicrm/CRM/Batch/BAO/EntityBatch.php         |  3 +-
 civicrm/CRM/Extension/Manager.php             |  9 ++--
 civicrm/Civi/Core/CiviEventDispatcher.php     | 13 +++++-
 civicrm/civicrm-version.php                   |  2 +-
 civicrm/composer.lock                         | 12 ++---
 civicrm/ext/afform/admin/info.xml             |  2 +-
 civicrm/ext/afform/core/info.xml              |  2 +-
 civicrm/ext/afform/html/info.xml              |  2 +-
 civicrm/ext/afform/mock/info.xml              |  2 +-
 civicrm/ext/authx/info.xml                    |  2 +-
 civicrm/ext/civicrm_admin_ui/info.xml         |  2 +-
 civicrm/ext/civigrant/info.xml                |  2 +-
 civicrm/ext/ckeditor4/info.xml                |  2 +-
 .../ext/contributioncancelactions/info.xml    |  2 +-
 civicrm/ext/eventcart/info.xml                |  2 +-
 civicrm/ext/ewaysingle/info.xml               |  2 +-
 civicrm/ext/financialacls/info.xml            |  2 +-
 civicrm/ext/flexmailer/info.xml               |  2 +-
 civicrm/ext/greenwich/info.xml                |  2 +-
 civicrm/ext/legacycustomsearches/info.xml     |  2 +-
 civicrm/ext/message_admin/info.xml            |  2 +-
 civicrm/ext/oauth-client/info.xml             |  2 +-
 civicrm/ext/payflowpro/info.xml               |  2 +-
 civicrm/ext/recaptcha/info.xml                |  2 +-
 civicrm/ext/search_kit/info.xml               |  2 +-
 civicrm/ext/sequentialcreditnotes/info.xml    |  2 +-
 civicrm/js/crm.ajax.js                        |  8 ++--
 civicrm/release-notes.md                      |  9 ++++
 civicrm/release-notes/5.50.2.md               | 46 +++++++++++++++++++
 civicrm/sql/civicrm_data.mysql                |  2 +-
 civicrm/sql/civicrm_generated.mysql           |  2 +-
 civicrm/templates/CRM/common/l10n.js.tpl      |  2 +-
 civicrm/vendor/autoload.php                   |  2 +-
 civicrm/vendor/composer/autoload_real.php     | 14 +++---
 civicrm/vendor/composer/autoload_static.php   | 12 ++---
 civicrm/vendor/composer/installed.json        | 14 +++---
 civicrm/vendor/guzzlehttp/guzzle/CHANGELOG.md |  5 ++
 .../guzzle/src/RedirectMiddleware.php         | 38 ++++++++++++---
 civicrm/xml/version.xml                       |  2 +-
 40 files changed, 170 insertions(+), 71 deletions(-)
 create mode 100644 civicrm/release-notes/5.50.2.md

diff --git a/civicrm.php b/civicrm.php
index 78a0e871f3..f8dd8860b8 100644
--- a/civicrm.php
+++ b/civicrm.php
@@ -2,7 +2,7 @@
 /**
  * Plugin Name: CiviCRM
  * Description: CiviCRM - Growing and Sustaining Relationships
- * Version: 5.50.1
+ * Version: 5.50.2
  * Requires at least: 4.9
  * Requires PHP:      7.2
  * Author: CiviCRM LLC
@@ -36,7 +36,7 @@ if (!defined('ABSPATH')) {
 }
 
 // Set version here: changing it forces Javascript and CSS to reload.
-define('CIVICRM_PLUGIN_VERSION', '5.50.1');
+define('CIVICRM_PLUGIN_VERSION', '5.50.2');
 
 // Store reference to this file.
 if (!defined('CIVICRM_PLUGIN_FILE')) {
diff --git a/civicrm/CRM/Batch/BAO/EntityBatch.php b/civicrm/CRM/Batch/BAO/EntityBatch.php
index f4c1e55a70..492286897e 100644
--- a/civicrm/CRM/Batch/BAO/EntityBatch.php
+++ b/civicrm/CRM/Batch/BAO/EntityBatch.php
@@ -26,6 +26,7 @@ class CRM_Batch_BAO_EntityBatch extends CRM_Batch_DAO_EntityBatch {
     // Only write the EntityBatch record if the financial trxn and batch match on currency and payment instrument.
     $batchId = $params['batch_id'] ?? NULL;
     $entityId = $params['entity_id'] ?? NULL;
+    $entityTable = $params['entity_table'] ?? 'civicrm_financial_trxn';
     // Not having a batch ID and entity ID is only acceptable on an update.
     if (!$batchId) {
       $existingEntityBatch = \Civi\Api4\EntityBatch::get(FALSE)
@@ -36,7 +37,7 @@ class CRM_Batch_BAO_EntityBatch extends CRM_Batch_DAO_EntityBatch {
       $entityId = $existingEntityBatch['entity_id'] ?? NULL;
     }
     // There should never be a legitimate case where a record has an ID but no batch ID but SyntaxConformanceTest says otherwise.
-    if ($batchId) {
+    if ($batchId && $entityTable === 'civicrm_financial_trxn') {
       $batchCurrency = self::getBatchCurrency($batchId);
       $batchPID = (int) CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $batchId, 'payment_instrument_id');
       $trxn = \Civi\Api4\FinancialTrxn::get(FALSE)
diff --git a/civicrm/CRM/Extension/Manager.php b/civicrm/CRM/Extension/Manager.php
index 444f86ec32..800a7b3ce7 100644
--- a/civicrm/CRM/Extension/Manager.php
+++ b/civicrm/CRM/Extension/Manager.php
@@ -712,9 +712,12 @@ class CRM_Extension_Manager {
    * @return CRM_Extension_Info|NULL
    */
   public function createInfoFromDB($key) {
-    $dao = new CRM_Core_DAO_Extension();
-    $dao->full_name = $key;
-    if ($dao->find(TRUE)) {
+    // System hasn't booted - and extension is missing. Need low-tech/no-hook SELECT to learn more about what's missing.
+    $select = CRM_Utils_SQL_Select::from('civicrm_extension')
+      ->where('full_name = @key', ['key' => $key])
+      ->select('full_name, type, name, label, file');
+    $dao = $select->execute();
+    if ($dao->fetch()) {
       $info = new CRM_Extension_Info($dao->full_name, $dao->type, $dao->name, $dao->label, $dao->file);
       return $info;
     }
diff --git a/civicrm/Civi/Core/CiviEventDispatcher.php b/civicrm/Civi/Core/CiviEventDispatcher.php
index f2ddb6431e..d4564e5b4c 100644
--- a/civicrm/Civi/Core/CiviEventDispatcher.php
+++ b/civicrm/Civi/Core/CiviEventDispatcher.php
@@ -187,7 +187,18 @@ class CiviEventDispatcher extends EventDispatcher {
           throw new \RuntimeException("The dispatch policy prohibits event \"$eventName\".");
 
         case 'not-ready':
-          throw new \RuntimeException("CiviCRM has not bootstrapped sufficiently to fire event \"$eventName\".");
+          // The system is not ready to run hooks -- eg it has not finished loading the extension main-files.
+          // If you fire a hook at this point, it will not be received by the intended listeners.
+          // In practice, many hooks involve cached data-structures, so a premature hook is liable to have spooky side-effects.
+          // This condition indicates a structural problem and merits a consistent failure-mode.
+          // If you believe some special case merits an exemption, then you could add it to `$bootDispatchPolicy`.
+
+          // An `Exception` would be ideal for preventing new bugs, but it can be too noisy for systems with pre-existing bugs.
+          // throw new \RuntimeException("The event \"$eventName\" attempted to fire before CiviCRM was fully loaded. Skipping.");
+          // Complain to web-user and sysadmin. Log a backtrace. We're pre-boot, so don't use high-level services.
+          error_log("The event \"$eventName\" attempted to fire before CiviCRM was fully loaded. Skipping.\n" . \CRM_Core_Error::formatBacktrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), FALSE));
+          trigger_error("The event \"$eventName\" attempted to fire before CiviCRM was fully loaded. Skipping.", E_USER_WARNING);
+          return $event;
 
         default:
           throw new \RuntimeException("The dispatch policy for \"$eventName\" is unrecognized ($mode).");
diff --git a/civicrm/civicrm-version.php b/civicrm/civicrm-version.php
index 88521370a2..a27beb137e 100644
--- a/civicrm/civicrm-version.php
+++ b/civicrm/civicrm-version.php
@@ -1,7 +1,7 @@
 <?php
 /** @deprecated */
 function civicrmVersion( ) {
-  return array( 'version'  => '5.50.1',
+  return array( 'version'  => '5.50.2',
                 'cms'      => 'Wordpress',
                 'revision' => '' );
 }
diff --git a/civicrm/composer.lock b/civicrm/composer.lock
index 190c30fea3..66cb49b582 100644
--- a/civicrm/composer.lock
+++ b/civicrm/composer.lock
@@ -826,16 +826,16 @@
         },
         {
             "name": "guzzlehttp/guzzle",
-            "version": "6.5.6",
+            "version": "6.5.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/guzzle/guzzle.git",
-                "reference": "f092dd734083473658de3ee4bef093ed77d2689c"
+                "reference": "724562fa861e21a4071c652c8a159934e4f05592"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f092dd734083473658de3ee4bef093ed77d2689c",
-                "reference": "f092dd734083473658de3ee4bef093ed77d2689c",
+                "url": "https://api.github.com/repos/guzzle/guzzle/zipball/724562fa861e21a4071c652c8a159934e4f05592",
+                "reference": "724562fa861e21a4071c652c8a159934e4f05592",
                 "shasum": ""
             },
             "require": {
@@ -921,7 +921,7 @@
             ],
             "support": {
                 "issues": "https://github.com/guzzle/guzzle/issues",
-                "source": "https://github.com/guzzle/guzzle/tree/6.5.6"
+                "source": "https://github.com/guzzle/guzzle/tree/6.5.7"
             },
             "funding": [
                 {
@@ -937,7 +937,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2022-05-25T13:19:12+00:00"
+            "time": "2022-06-09T21:36:50+00:00"
         },
         {
             "name": "guzzlehttp/promises",
diff --git a/civicrm/ext/afform/admin/info.xml b/civicrm/ext/afform/admin/info.xml
index 35ee88710c..1bf467e94a 100644
--- a/civicrm/ext/afform/admin/info.xml
+++ b/civicrm/ext/afform/admin/info.xml
@@ -13,7 +13,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2020-01-09</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <develStage>beta</develStage>
   <compatibility>
     <ver>5.50</ver>
diff --git a/civicrm/ext/afform/core/info.xml b/civicrm/ext/afform/core/info.xml
index 7410312f7a..0ead66a0d7 100644
--- a/civicrm/ext/afform/core/info.xml
+++ b/civicrm/ext/afform/core/info.xml
@@ -13,7 +13,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2020-01-09</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <develStage>beta</develStage>
   <compatibility>
     <ver>5.50</ver>
diff --git a/civicrm/ext/afform/html/info.xml b/civicrm/ext/afform/html/info.xml
index d4fa2be501..8bce9ad6f9 100644
--- a/civicrm/ext/afform/html/info.xml
+++ b/civicrm/ext/afform/html/info.xml
@@ -13,7 +13,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2020-01-09</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <develStage>alpha</develStage>
   <compatibility>
     <ver>5.50</ver>
diff --git a/civicrm/ext/afform/mock/info.xml b/civicrm/ext/afform/mock/info.xml
index c6ffe09779..e005da8852 100644
--- a/civicrm/ext/afform/mock/info.xml
+++ b/civicrm/ext/afform/mock/info.xml
@@ -12,7 +12,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2020-01-09</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <tags>
     <tag>mgmt:hidden</tag>
   </tags>
diff --git a/civicrm/ext/authx/info.xml b/civicrm/ext/authx/info.xml
index 3bd0344d5d..a742ecf4c1 100644
--- a/civicrm/ext/authx/info.xml
+++ b/civicrm/ext/authx/info.xml
@@ -15,7 +15,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2021-02-11</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <develStage>alpha</develStage>
   <compatibility>
     <ver>5.50</ver>
diff --git a/civicrm/ext/civicrm_admin_ui/info.xml b/civicrm/ext/civicrm_admin_ui/info.xml
index 5f50f13692..78b866d0eb 100644
--- a/civicrm/ext/civicrm_admin_ui/info.xml
+++ b/civicrm/ext/civicrm_admin_ui/info.xml
@@ -15,7 +15,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2022-01-02</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <develStage>alpha</develStage>
   <compatibility>
     <ver>5.50</ver>
diff --git a/civicrm/ext/civigrant/info.xml b/civicrm/ext/civigrant/info.xml
index e566a910d3..abd636fd6e 100644
--- a/civicrm/ext/civigrant/info.xml
+++ b/civicrm/ext/civigrant/info.xml
@@ -13,7 +13,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2021-11-11</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <develStage>stable</develStage>
   <compatibility>
     <ver>5.50</ver>
diff --git a/civicrm/ext/ckeditor4/info.xml b/civicrm/ext/ckeditor4/info.xml
index 00f2fea546..a096eff0c5 100644
--- a/civicrm/ext/ckeditor4/info.xml
+++ b/civicrm/ext/ckeditor4/info.xml
@@ -15,7 +15,7 @@
     <url desc="Licensing">https://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2021-05-23</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <develStage>stable</develStage>
   <compatibility>
     <ver>5.50</ver>
diff --git a/civicrm/ext/contributioncancelactions/info.xml b/civicrm/ext/contributioncancelactions/info.xml
index 1cbcce8d77..887752f268 100644
--- a/civicrm/ext/contributioncancelactions/info.xml
+++ b/civicrm/ext/contributioncancelactions/info.xml
@@ -15,7 +15,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2020-10-12</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <develStage>stable</develStage>
   <compatibility>
     <ver>5.50</ver>
diff --git a/civicrm/ext/eventcart/info.xml b/civicrm/ext/eventcart/info.xml
index 406ae748f5..fe379ec5ff 100644
--- a/civicrm/ext/eventcart/info.xml
+++ b/civicrm/ext/eventcart/info.xml
@@ -13,7 +13,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2020-08-03</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <tags>
     <tag>mgmt:hidden</tag>
   </tags>
diff --git a/civicrm/ext/ewaysingle/info.xml b/civicrm/ext/ewaysingle/info.xml
index f86e62aff0..1dfeddc2ce 100644
--- a/civicrm/ext/ewaysingle/info.xml
+++ b/civicrm/ext/ewaysingle/info.xml
@@ -15,7 +15,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2020-10-07</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <tags>
     <tag>mgmt:hidden</tag>
   </tags>
diff --git a/civicrm/ext/financialacls/info.xml b/civicrm/ext/financialacls/info.xml
index 1b339b2b3f..1450f772c0 100644
--- a/civicrm/ext/financialacls/info.xml
+++ b/civicrm/ext/financialacls/info.xml
@@ -15,7 +15,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2020-08-27</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <develStage>stable</develStage>
   <compatibility>
     <ver>5.50</ver>
diff --git a/civicrm/ext/flexmailer/info.xml b/civicrm/ext/flexmailer/info.xml
index 8116a21522..3462cd1ab1 100644
--- a/civicrm/ext/flexmailer/info.xml
+++ b/civicrm/ext/flexmailer/info.xml
@@ -15,7 +15,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2020-08-05</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <develStage>stable</develStage>
   <comments>
     FlexMailer is an email delivery engine which replaces the internal guts
diff --git a/civicrm/ext/greenwich/info.xml b/civicrm/ext/greenwich/info.xml
index afc4d65071..96fe2c903b 100644
--- a/civicrm/ext/greenwich/info.xml
+++ b/civicrm/ext/greenwich/info.xml
@@ -15,7 +15,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2020-07-21</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <tags>
     <tag>mgmt:hidden</tag>
   </tags>
diff --git a/civicrm/ext/legacycustomsearches/info.xml b/civicrm/ext/legacycustomsearches/info.xml
index f07239c177..3c33952014 100644
--- a/civicrm/ext/legacycustomsearches/info.xml
+++ b/civicrm/ext/legacycustomsearches/info.xml
@@ -15,7 +15,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2021-07-25</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <develStage>stable</develStage>
   <tags>
     <tag>mgmt:hidden</tag>
diff --git a/civicrm/ext/message_admin/info.xml b/civicrm/ext/message_admin/info.xml
index a2d5daaabe..00557ef5e3 100644
--- a/civicrm/ext/message_admin/info.xml
+++ b/civicrm/ext/message_admin/info.xml
@@ -15,7 +15,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2021-06-12</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <tags>
     <tag>mgmt:hidden</tag>
   </tags>
diff --git a/civicrm/ext/oauth-client/info.xml b/civicrm/ext/oauth-client/info.xml
index 2d0fec80ec..ea7ba16696 100644
--- a/civicrm/ext/oauth-client/info.xml
+++ b/civicrm/ext/oauth-client/info.xml
@@ -15,7 +15,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2020-10-23</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <develStage>stable</develStage>
   <compatibility>
     <ver>5.50</ver>
diff --git a/civicrm/ext/payflowpro/info.xml b/civicrm/ext/payflowpro/info.xml
index e7a2a1e88c..d412eb8e35 100644
--- a/civicrm/ext/payflowpro/info.xml
+++ b/civicrm/ext/payflowpro/info.xml
@@ -15,7 +15,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2021-04-13</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <develStage>stable</develStage>
   <compatibility>
     <ver>5.50</ver>
diff --git a/civicrm/ext/recaptcha/info.xml b/civicrm/ext/recaptcha/info.xml
index 5f154a7a3c..ddfd4e83bc 100644
--- a/civicrm/ext/recaptcha/info.xml
+++ b/civicrm/ext/recaptcha/info.xml
@@ -13,7 +13,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2021-04-03</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <tags>
     <tag>mgmt:hidden</tag>
   </tags>
diff --git a/civicrm/ext/search_kit/info.xml b/civicrm/ext/search_kit/info.xml
index 48deb96717..1c035bdcbc 100644
--- a/civicrm/ext/search_kit/info.xml
+++ b/civicrm/ext/search_kit/info.xml
@@ -15,7 +15,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2021-01-06</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <develStage>stable</develStage>
   <compatibility>
     <ver>5.50</ver>
diff --git a/civicrm/ext/sequentialcreditnotes/info.xml b/civicrm/ext/sequentialcreditnotes/info.xml
index b0ac956e0e..e01ecdd6e7 100644
--- a/civicrm/ext/sequentialcreditnotes/info.xml
+++ b/civicrm/ext/sequentialcreditnotes/info.xml
@@ -15,7 +15,7 @@
     <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
   </urls>
   <releaseDate>2020-01-28</releaseDate>
-  <version>5.50.1</version>
+  <version>5.50.2</version>
   <tags>
     <tag>mgmt:hidden</tag>
   </tags>
diff --git a/civicrm/js/crm.ajax.js b/civicrm/js/crm.ajax.js
index 4cb20cd03e..39f7c85ef9 100644
--- a/civicrm/js/crm.ajax.js
+++ b/civicrm/js/crm.ajax.js
@@ -28,13 +28,11 @@
       path = path.split('#')[0];
     }
     frag = path.split('?');
-    // Remove basepage as it can be changed on some CMS eg. WordPress frontend.
-    frag[0] = frag[0].replace('civicrm/', '/');
     // Encode url path only if slashes in placeholder were also encoded
-    if (tplURL[mode].indexOf('/crmajax-placeholder-url-path') >= 0) {
-      url = tplURL[mode].replace('/crmajax-placeholder-url-path', frag[0]);
+    if (tplURL[mode].indexOf('civicrm/placeholder-url-path') >= 0) {
+      url = tplURL[mode].replace('civicrm/placeholder-url-path', frag[0]);
     } else {
-      url = tplURL[mode].replace('%2Fcrmajax-placeholder-url-path', encodeURIComponent(frag[0]));
+      url = tplURL[mode].replace('civicrm%2Fplaceholder-url-path', encodeURIComponent(frag[0]));
     }
 
     if (_.isEmpty(query)) {
diff --git a/civicrm/release-notes.md b/civicrm/release-notes.md
index 79ed3eb31e..95be4d1741 100644
--- a/civicrm/release-notes.md
+++ b/civicrm/release-notes.md
@@ -15,6 +15,15 @@ Other resources for identifying changes are:
     * https://github.com/civicrm/civicrm-joomla
     * https://github.com/civicrm/civicrm-wordpress
 
+## CiviCRM 5.50.2
+
+Released June 14, 2022
+
+- **[Synopsis](release-notes/5.50.2.md#synopsis)**
+- **[Bugs resolved](release-notes/5.50.2.md#bugs)**
+- **[Credits](release-notes/5.50.2.md#credits)**
+- **[Feedback](release-notes/5.50.2.md#feedback)**
+
 ## CiviCRM 5.50.1
 
 Released June 2, 2022
diff --git a/civicrm/release-notes/5.50.2.md b/civicrm/release-notes/5.50.2.md
new file mode 100644
index 0000000000..3406fcef7f
--- /dev/null
+++ b/civicrm/release-notes/5.50.2.md
@@ -0,0 +1,46 @@
+# CiviCRM 5.50.2
+
+Released June 14, 2022
+
+- **[Synopsis](#synopsis)**
+- **[Bugs resolved](#bugs)**
+- **[Credits](#credits)**
+- **[Feedback](#feedback)**
+
+## <a name="synopsis"></a>Synopsis
+
+| *Does this version...?*                                         |          |
+| --------------------------------------------------------------- | -------- |
+| Change the database schema?                                     | no       |
+| Alter the API?                                                  | no       |
+| Require attention to configuration options?                     | no       |
+| Fix problems installing or upgrading to a previous version?     | no       |
+| Introduce features?                                             | no       |
+| **Fix bugs?**                                                   | **yes**  |
+
+## <a name="bugs"></a>Bugs resolved
+
+* **_Accounting_: Fix new error that prevents creating account batches for `ukgiftaid`. ([extensions/ukgiftaid#30](https://lab.civicrm.org/extensions/ukgiftaid/-/issues/30): [#23741](https://github.com/civicrm/civicrm-core/pull/23741))**
+* **_CiviMember_: Re-enable configuration field "Renewal Message" ([dev/core#3499](https://lab.civicrm.org/dev/core/-/issues/3499): [#23726](https://github.com/civicrm/civicrm-core/pull/23726))**
+* **_Event Dispatcher_: Reduce fatal error to warning ([dev/core#3502](https://lab.civicrm.org/dev/core/-/issues/3502): [#23739](https://github.com/civicrm/civicrm-core/pull/23739))**
+* **_Extensions_: Missing extension leads to bootstrap error for "hook_civicrm_entityTypes"  ([dev/core#3496](https://lab.civicrm.org/dev/core/-/issues/3496): [#23716](https://github.com/civicrm/civicrm-core/pull/23716))**
+* **_Guzzle_: Update to v6.5.6 ([#23748](https://github.com/civicrm/civicrm-core/pull/23748))**
+
+  This applies a prophylactic security update. It is not believed to impact the security of CiviCRM deployments.
+
+## <a name="credits"></a>Credits
+
+This release was developed by the following authors and reviewers:
+
+Wikimedia Foundation - Eileen McNaughton; Squiffle Consulting - Aidan
+Saunders; MJW Consulting - Matthew Wire; Megaphone Technology Consulting -
+Jon Goldberg; jrobens; JMA Consulting - Seamus Lee; Humanists UK - Andrew
+West; GMCVO Databases; Francesc Bassas i Bullich; DevApp - Adam Kwiatkowski;
+davephassall; Dave D; CiviCRM - Tim Otten; Circle Interactive - Pradeep
+Nayak; Benjamin W
+
+## <a name="feedback"></a>Feedback
+
+These release notes are edited by Tim Otten and Andie Hunt.  If you'd like to
+provide feedback on them, please login to https://chat.civicrm.org/civicrm and
+contact `@agh1`.
diff --git a/civicrm/sql/civicrm_data.mysql b/civicrm/sql/civicrm_data.mysql
index c37cd9849f..34ab573a1c 100644
--- a/civicrm/sql/civicrm_data.mysql
+++ b/civicrm/sql/civicrm_data.mysql
@@ -23793,4 +23793,4 @@ INSERT INTO `civicrm_report_instance`
     ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`)
 VALUES
     (  @domainID, 'Survey Details', 'survey/detail', 'Detailed report for canvassing, phone-banking, walk lists or other surveys.', 'access CiviReport', 'a:39:{s:6:"fields";a:2:{s:9:"sort_name";s:1:"1";s:6:"result";s:1:"1";}s:22:"assignee_contact_id_op";s:2:"eq";s:25:"assignee_contact_id_value";s:0:"";s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:12:"survey_id_op";s:2:"in";s:15:"survey_id_value";a:0:{}s:12:"status_id_op";s:2:"eq";s:15:"status_id_value";s:1:"1";s:11:"custom_1_op";s:2:"in";s:14:"custom_1_value";a:0:{}s:11:"custom_2_op";s:2:"in";s:14:"custom_2_value";a:0:{}s:17:"custom_3_relative";s:1:"0";s:13:"custom_3_from";s:0:"";s:11:"custom_3_to";s:0:"";s:11:"description";s:75:"Detailed report for canvassing, phone-banking, walk lists or other surveys.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviReport";s:6:"groups";s:0:"";s:9:"domain_id";i:1;}');
-UPDATE civicrm_domain SET version = '5.50.1';
+UPDATE civicrm_domain SET version = '5.50.2';
diff --git a/civicrm/sql/civicrm_generated.mysql b/civicrm/sql/civicrm_generated.mysql
index 7ee912dba3..493309f20c 100644
--- a/civicrm/sql/civicrm_generated.mysql
+++ b/civicrm/sql/civicrm_generated.mysql
@@ -2938,7 +2938,7 @@ UNLOCK TABLES;
 LOCK TABLES `civicrm_domain` WRITE;
 /*!40000 ALTER TABLE `civicrm_domain` DISABLE KEYS */;
 INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES
- (1,'Default Domain Name',NULL,'5.50.1',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
+ (1,'Default Domain Name',NULL,'5.50.2',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
 /*!40000 ALTER TABLE `civicrm_domain` ENABLE KEYS */;
 UNLOCK TABLES;
 
diff --git a/civicrm/templates/CRM/common/l10n.js.tpl b/civicrm/templates/CRM/common/l10n.js.tpl
index 67f69ada05..7e804f5568 100644
--- a/civicrm/templates/CRM/common/l10n.js.tpl
+++ b/civicrm/templates/CRM/common/l10n.js.tpl
@@ -29,7 +29,7 @@
   CRM.config.entityRef = $.extend({ldelim}{rdelim}, {$entityRef|@json_encode}, CRM.config.entityRef || {ldelim}{rdelim});
 
   // Initialize CRM.url and CRM.formatMoney
-  CRM.url({ldelim}back: '{crmURL p="civicrm/crmajax-placeholder-url-path" q="civicrm-placeholder-url-query=1" h=0 fb=1}', front: '{crmURL p="civicrm/crmajax-placeholder-url-path" q="civicrm-placeholder-url-query=1" h=0 fe=1}'{rdelim});
+  CRM.url({ldelim}back: '{crmURL p="civicrm/placeholder-url-path" q="civicrm-placeholder-url-query=1" h=0 fb=1}', front: '{crmURL p="civicrm/placeholder-url-path" q="civicrm-placeholder-url-query=1" h=0 fe=1}'{rdelim});
   CRM.formatMoney('init', false, {$moneyFormat|@json_encode});
 
   // Localize select2
diff --git a/civicrm/vendor/autoload.php b/civicrm/vendor/autoload.php
index 6a5e44c5ab..fc48045d15 100644
--- a/civicrm/vendor/autoload.php
+++ b/civicrm/vendor/autoload.php
@@ -4,4 +4,4 @@
 
 require_once __DIR__ . '/composer/autoload_real.php';
 
-return ComposerAutoloaderInit97c9e40edab64e2c93752ad5b5fd6a37::getLoader();
+return ComposerAutoloaderInitd4c716c4ee5d5afc7cf2f8bc4b092fca::getLoader();
diff --git a/civicrm/vendor/composer/autoload_real.php b/civicrm/vendor/composer/autoload_real.php
index 31b2eecf15..c26ec2a7a9 100644
--- a/civicrm/vendor/composer/autoload_real.php
+++ b/civicrm/vendor/composer/autoload_real.php
@@ -2,7 +2,7 @@
 
 // autoload_real.php @generated by Composer
 
-class ComposerAutoloaderInit97c9e40edab64e2c93752ad5b5fd6a37
+class ComposerAutoloaderInitd4c716c4ee5d5afc7cf2f8bc4b092fca
 {
     private static $loader;
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit97c9e40edab64e2c93752ad5b5fd6a37
             return self::$loader;
         }
 
-        spl_autoload_register(array('ComposerAutoloaderInit97c9e40edab64e2c93752ad5b5fd6a37', 'loadClassLoader'), true, true);
+        spl_autoload_register(array('ComposerAutoloaderInitd4c716c4ee5d5afc7cf2f8bc4b092fca', 'loadClassLoader'), true, true);
         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
-        spl_autoload_unregister(array('ComposerAutoloaderInit97c9e40edab64e2c93752ad5b5fd6a37', 'loadClassLoader'));
+        spl_autoload_unregister(array('ComposerAutoloaderInitd4c716c4ee5d5afc7cf2f8bc4b092fca', 'loadClassLoader'));
 
         $includePaths = require __DIR__ . '/include_paths.php';
         $includePaths[] = get_include_path();
@@ -31,7 +31,7 @@ class ComposerAutoloaderInit97c9e40edab64e2c93752ad5b5fd6a37
         if ($useStaticLoader) {
             require_once __DIR__ . '/autoload_static.php';
 
-            call_user_func(\Composer\Autoload\ComposerStaticInit97c9e40edab64e2c93752ad5b5fd6a37::getInitializer($loader));
+            call_user_func(\Composer\Autoload\ComposerStaticInitd4c716c4ee5d5afc7cf2f8bc4b092fca::getInitializer($loader));
         } else {
             $map = require __DIR__ . '/autoload_namespaces.php';
             foreach ($map as $namespace => $path) {
@@ -52,19 +52,19 @@ class ComposerAutoloaderInit97c9e40edab64e2c93752ad5b5fd6a37
         $loader->register(true);
 
         if ($useStaticLoader) {
-            $includeFiles = Composer\Autoload\ComposerStaticInit97c9e40edab64e2c93752ad5b5fd6a37::$files;
+            $includeFiles = Composer\Autoload\ComposerStaticInitd4c716c4ee5d5afc7cf2f8bc4b092fca::$files;
         } else {
             $includeFiles = require __DIR__ . '/autoload_files.php';
         }
         foreach ($includeFiles as $fileIdentifier => $file) {
-            composerRequire97c9e40edab64e2c93752ad5b5fd6a37($fileIdentifier, $file);
+            composerRequired4c716c4ee5d5afc7cf2f8bc4b092fca($fileIdentifier, $file);
         }
 
         return $loader;
     }
 }
 
-function composerRequire97c9e40edab64e2c93752ad5b5fd6a37($fileIdentifier, $file)
+function composerRequired4c716c4ee5d5afc7cf2f8bc4b092fca($fileIdentifier, $file)
 {
     if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
         require $file;
diff --git a/civicrm/vendor/composer/autoload_static.php b/civicrm/vendor/composer/autoload_static.php
index 4038a28f16..0955c06f3f 100644
--- a/civicrm/vendor/composer/autoload_static.php
+++ b/civicrm/vendor/composer/autoload_static.php
@@ -4,7 +4,7 @@
 
 namespace Composer\Autoload;
 
-class ComposerStaticInit97c9e40edab64e2c93752ad5b5fd6a37
+class ComposerStaticInitd4c716c4ee5d5afc7cf2f8bc4b092fca
 {
     public static $files = array (
         '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
@@ -684,11 +684,11 @@ class ComposerStaticInit97c9e40edab64e2c93752ad5b5fd6a37
     public static function getInitializer(ClassLoader $loader)
     {
         return \Closure::bind(function () use ($loader) {
-            $loader->prefixLengthsPsr4 = ComposerStaticInit97c9e40edab64e2c93752ad5b5fd6a37::$prefixLengthsPsr4;
-            $loader->prefixDirsPsr4 = ComposerStaticInit97c9e40edab64e2c93752ad5b5fd6a37::$prefixDirsPsr4;
-            $loader->prefixesPsr0 = ComposerStaticInit97c9e40edab64e2c93752ad5b5fd6a37::$prefixesPsr0;
-            $loader->fallbackDirsPsr0 = ComposerStaticInit97c9e40edab64e2c93752ad5b5fd6a37::$fallbackDirsPsr0;
-            $loader->classMap = ComposerStaticInit97c9e40edab64e2c93752ad5b5fd6a37::$classMap;
+            $loader->prefixLengthsPsr4 = ComposerStaticInitd4c716c4ee5d5afc7cf2f8bc4b092fca::$prefixLengthsPsr4;
+            $loader->prefixDirsPsr4 = ComposerStaticInitd4c716c4ee5d5afc7cf2f8bc4b092fca::$prefixDirsPsr4;
+            $loader->prefixesPsr0 = ComposerStaticInitd4c716c4ee5d5afc7cf2f8bc4b092fca::$prefixesPsr0;
+            $loader->fallbackDirsPsr0 = ComposerStaticInitd4c716c4ee5d5afc7cf2f8bc4b092fca::$fallbackDirsPsr0;
+            $loader->classMap = ComposerStaticInitd4c716c4ee5d5afc7cf2f8bc4b092fca::$classMap;
 
         }, null, ClassLoader::class);
     }
diff --git a/civicrm/vendor/composer/installed.json b/civicrm/vendor/composer/installed.json
index 5c8bff4677..83ac6d0bc3 100644
--- a/civicrm/vendor/composer/installed.json
+++ b/civicrm/vendor/composer/installed.json
@@ -843,17 +843,17 @@
     },
     {
         "name": "guzzlehttp/guzzle",
-        "version": "6.5.6",
-        "version_normalized": "6.5.6.0",
+        "version": "6.5.7",
+        "version_normalized": "6.5.7.0",
         "source": {
             "type": "git",
             "url": "https://github.com/guzzle/guzzle.git",
-            "reference": "f092dd734083473658de3ee4bef093ed77d2689c"
+            "reference": "724562fa861e21a4071c652c8a159934e4f05592"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f092dd734083473658de3ee4bef093ed77d2689c",
-            "reference": "f092dd734083473658de3ee4bef093ed77d2689c",
+            "url": "https://api.github.com/repos/guzzle/guzzle/zipball/724562fa861e21a4071c652c8a159934e4f05592",
+            "reference": "724562fa861e21a4071c652c8a159934e4f05592",
             "shasum": ""
         },
         "require": {
@@ -871,7 +871,7 @@
         "suggest": {
             "psr/log": "Required for using the Log middleware"
         },
-        "time": "2022-05-25T13:19:12+00:00",
+        "time": "2022-06-09T21:36:50+00:00",
         "type": "library",
         "extra": {
             "branch-alias": {
@@ -941,7 +941,7 @@
         ],
         "support": {
             "issues": "https://github.com/guzzle/guzzle/issues",
-            "source": "https://github.com/guzzle/guzzle/tree/6.5.6"
+            "source": "https://github.com/guzzle/guzzle/tree/6.5.7"
         }
     },
     {
diff --git a/civicrm/vendor/guzzlehttp/guzzle/CHANGELOG.md b/civicrm/vendor/guzzlehttp/guzzle/CHANGELOG.md
index 95d26df215..cd3db22d85 100644
--- a/civicrm/vendor/guzzlehttp/guzzle/CHANGELOG.md
+++ b/civicrm/vendor/guzzlehttp/guzzle/CHANGELOG.md
@@ -1,5 +1,10 @@
 # Change Log
 
+## 6.5.7 - 2022-06-09
+
+* Fix failure to strip Authorization header on HTTP downgrade
+* Fix failure to strip the Cookie header on change in host or HTTP downgrade
+
 ## 6.5.6 - 2022-05-25
 
 * Fix cross-domain cookie leakage
diff --git a/civicrm/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php b/civicrm/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php
index e4644b7ac1..fd86c60a71 100644
--- a/civicrm/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php
+++ b/civicrm/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php
@@ -141,7 +141,7 @@ class RedirectMiddleware
     }
 
     /**
-     * Check for too many redirects
+     * Check for too many redirects.
      *
      * @return void
      *
@@ -190,7 +190,7 @@ class RedirectMiddleware
             $modify['body'] = '';
         }
 
-        $uri = $this->redirectUri($request, $response, $protocols);
+        $uri = self::redirectUri($request, $response, $protocols);
         if (isset($options['idn_conversion']) && ($options['idn_conversion'] !== false)) {
             $idnOptions = ($options['idn_conversion'] === true) ? IDNA_DEFAULT : $options['idn_conversion'];
             $uri = Utils::idnUriConvert($uri, $idnOptions);
@@ -210,16 +210,42 @@ class RedirectMiddleware
             $modify['remove_headers'][] = 'Referer';
         }
 
-        // Remove Authorization header if host is different.
-        if ($request->getUri()->getHost() !== $modify['uri']->getHost()) {
+        // Remove Authorization and Cookie headers if required.
+        if (self::shouldStripSensitiveHeaders($request->getUri(), $modify['uri'])) {
             $modify['remove_headers'][] = 'Authorization';
+            $modify['remove_headers'][] = 'Cookie';
         }
 
         return Psr7\modify_request($request, $modify);
     }
 
     /**
-     * Set the appropriate URL on the request based on the location header
+     * Determine if we should strip sensitive headers from the request.
+     *
+     * We return true if either of the following conditions are true:
+     *
+     * 1. the host is different;
+     * 2. the scheme has changed, and now is non-https.
+     *
+     * @return bool
+     */
+    private static function shouldStripSensitiveHeaders(
+        UriInterface $originalUri,
+        UriInterface $modifiedUri
+    ) {
+        if (strcasecmp($originalUri->getHost(), $modifiedUri->getHost()) !== 0) {
+            return true;
+        }
+
+        if ($originalUri->getScheme() !== $modifiedUri->getScheme() && 'https' !== $modifiedUri->getScheme()) {
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * Set the appropriate URL on the request based on the location header.
      *
      * @param RequestInterface  $request
      * @param ResponseInterface $response
@@ -227,7 +253,7 @@ class RedirectMiddleware
      *
      * @return UriInterface
      */
-    private function redirectUri(
+    private static function redirectUri(
         RequestInterface $request,
         ResponseInterface $response,
         array $protocols
diff --git a/civicrm/xml/version.xml b/civicrm/xml/version.xml
index d36edc5b46..a35a369400 100644
--- a/civicrm/xml/version.xml
+++ b/civicrm/xml/version.xml
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="iso-8859-1" ?>
 <version>
-  <version_no>5.50.1</version_no>
+  <version_no>5.50.2</version_no>
 </version>
-- 
GitLab