From 8de2a34eade86d965b83a91bdafe792a5a15273b Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Mon, 6 Jul 2020 12:39:15 +1000 Subject: [PATCH] Fix function declaration to ensure that passing in frontend variable doesn't cause htmlizing by accident in unit tests --- CRM/Utils/System.php | 2 +- CRM/Utils/System/Base.php | 5 ++++- CRM/Utils/System/Drupal8.php | 3 ++- CRM/Utils/System/DrupalBase.php | 3 ++- CRM/Utils/System/Joomla.php | 3 ++- CRM/Utils/System/Soap.php | 2 +- CRM/Utils/System/UnitTests.php | 4 ++-- CRM/Utils/System/WordPress.php | 3 ++- 8 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CRM/Utils/System.php b/CRM/Utils/System.php index 16ad53f921..9a7d12db03 100644 --- a/CRM/Utils/System.php +++ b/CRM/Utils/System.php @@ -272,7 +272,7 @@ class CRM_Utils_System { } $config = CRM_Core_Config::singleton(); - $url = $config->userSystem->url($path, $query, $absolute, $fragment, $frontend, $forceBackend); + $url = $config->userSystem->url($path, $query, $absolute, $fragment, $frontend, $forceBackend, $htmlize); if ($htmlize) { $url = htmlentities($url); diff --git a/CRM/Utils/System/Base.php b/CRM/Utils/System/Base.php index 3fad89433a..5c4f1d58bb 100644 --- a/CRM/Utils/System/Base.php +++ b/CRM/Utils/System/Base.php @@ -124,6 +124,8 @@ abstract class CRM_Utils_System_Base { * This link should be to the CMS front end (applies to WP & Joomla). * @param bool $forceBackend * This link should be to the CMS back end (applies to WP & Joomla). + * @param bool $htmlize + * Whether to encode special html characters such as &. * * @return string */ @@ -133,7 +135,8 @@ abstract class CRM_Utils_System_Base { $absolute = FALSE, $fragment = NULL, $frontend = FALSE, - $forceBackend = FALSE + $forceBackend = FALSE, + $htmlize = TRUE ) { return NULL; } diff --git a/CRM/Utils/System/Drupal8.php b/CRM/Utils/System/Drupal8.php index fad974b80d..53e2a67dea 100644 --- a/CRM/Utils/System/Drupal8.php +++ b/CRM/Utils/System/Drupal8.php @@ -280,7 +280,8 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase { $absolute = FALSE, $fragment = NULL, $frontend = FALSE, - $forceBackend = FALSE + $forceBackend = FALSE, + $htmlize = TRUE ) { $query = html_entity_decode($query); diff --git a/CRM/Utils/System/DrupalBase.php b/CRM/Utils/System/DrupalBase.php index 4aa3b97808..aeef820d20 100644 --- a/CRM/Utils/System/DrupalBase.php +++ b/CRM/Utils/System/DrupalBase.php @@ -153,7 +153,8 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { $absolute = FALSE, $fragment = NULL, $frontend = FALSE, - $forceBackend = FALSE + $forceBackend = FALSE, + $htmlize = TRUE ) { $config = CRM_Core_Config::singleton(); $script = 'index.php'; diff --git a/CRM/Utils/System/Joomla.php b/CRM/Utils/System/Joomla.php index bea96efdaf..f7b4b68213 100644 --- a/CRM/Utils/System/Joomla.php +++ b/CRM/Utils/System/Joomla.php @@ -239,7 +239,8 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base { $absolute = FALSE, $fragment = NULL, $frontend = FALSE, - $forceBackend = FALSE + $forceBackend = FALSE, + $htmlize = TRUE ) { $config = CRM_Core_Config::singleton(); $separator = '&'; diff --git a/CRM/Utils/System/Soap.php b/CRM/Utils/System/Soap.php index 0881ecb818..90a04c6686 100644 --- a/CRM/Utils/System/Soap.php +++ b/CRM/Utils/System/Soap.php @@ -43,7 +43,7 @@ class CRM_Utils_System_Soap extends CRM_Utils_System_Base { /** * @inheritDoc */ - public function url($path = NULL, $query = NULL, $absolute = TRUE, $fragment = NULL) { + public function url($path = NULL, $query = NULL, $absolute = TRUE, $fragment = NULL, $frontend = FALSE, $forceBackend = FALSE, $htmlize = TRUE) { if (isset(self::$ufClass)) { $className = self::$ufClass; $url = $className::url($path, $query, $absolute, $fragment); diff --git a/CRM/Utils/System/UnitTests.php b/CRM/Utils/System/UnitTests.php index f1d3ce640a..14762fff7f 100644 --- a/CRM/Utils/System/UnitTests.php +++ b/CRM/Utils/System/UnitTests.php @@ -75,9 +75,9 @@ class CRM_Utils_System_UnitTests extends CRM_Utils_System_Base { $query = NULL, $absolute = FALSE, $fragment = NULL, - $htmlize = TRUE, $frontend = FALSE, - $forceBackend = FALSE + $forceBackend = FALSE, + $htmlize = TRUE ) { $config = CRM_Core_Config::singleton(); static $script = 'index.php'; diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index d844e98b45..a4c79c7193 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -265,7 +265,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { $absolute = FALSE, $fragment = NULL, $frontend = FALSE, - $forceBackend = FALSE + $forceBackend = FALSE, + $htmlize = TRUE ) { $config = CRM_Core_Config::singleton(); $script = ''; -- 2.25.1