From 0e32abb628ef6b9ef0c96960e804e51d73aceb41 Mon Sep 17 00:00:00 2001 From: Seth Hendrick <32778-ponies@users.noreply.drupalcode.org> Date: Wed, 8 Jan 2025 12:59:08 -0800 Subject: [PATCH 1/4] HSD8-1687: Added a null coalesce to preg_replace parameter in hs_field_helpers to prevent deprecated function PHP debug message. --- docroot/modules/humsci/hs_field_helpers/hs_field_helpers.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docroot/modules/humsci/hs_field_helpers/hs_field_helpers.module b/docroot/modules/humsci/hs_field_helpers/hs_field_helpers.module index 96d5ec4fa5..fef19fd8d3 100644 --- a/docroot/modules/humsci/hs_field_helpers/hs_field_helpers.module +++ b/docroot/modules/humsci/hs_field_helpers/hs_field_helpers.module @@ -233,7 +233,7 @@ function _hs_field_helpers_cleanup_pattern_regions(array &$pattern, $pattern_id) // Remove all wrapper divs so we can check if the region actually has any // visible output. - $rendered = preg_replace("/(.*?)<\/div>/s", "$1", $rendered); + $rendered = preg_replace("/(.*?)<\/div>/s", "$1", $rendered ?? ''); $rendered = preg_replace("/
(.*?)<\/div>/s", "$1", $rendered); if (empty(trim($rendered))) { unset($pattern[$region]); From cb7783c2a057024d095529ed19366d2343f7d3d4 Mon Sep 17 00:00:00 2001 From: Seth Hendrick <32778-ponies@users.noreply.drupalcode.org> Date: Wed, 8 Jan 2025 14:38:49 -0800 Subject: [PATCH 2/4] HSD8-1687: Added a null coalesce to str_pos to prevent deprecated function PHP debug message. --- docroot/modules/humsci/hs_layouts/hs_layouts.module | 2 +- .../humsci/hs_views_helper/src/Plugin/views/query/Sql.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docroot/modules/humsci/hs_layouts/hs_layouts.module b/docroot/modules/humsci/hs_layouts/hs_layouts.module index 463e1dd9c9..a1debe0faa 100644 --- a/docroot/modules/humsci/hs_layouts/hs_layouts.module +++ b/docroot/modules/humsci/hs_layouts/hs_layouts.module @@ -209,7 +209,7 @@ function hs_layouts_preprocess_pattern_vertical_card(&$variables) { $renderer = \Drupal::service('renderer'); $title_rendered = is_array($variables['title']) ? $renderer->renderInIsolation($variables['title']) : $variables['title']; - if (strpos($title_rendered, ' Date: Thu, 9 Jan 2025 13:20:58 -0800 Subject: [PATCH 3/4] Moved null variable check outside function call. --- .../hs_field_helpers/hs_field_helpers.module | 14 +++++++++----- .../modules/humsci/hs_layouts/hs_layouts.module | 2 +- .../hs_views_helper/src/Plugin/views/query/Sql.php | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docroot/modules/humsci/hs_field_helpers/hs_field_helpers.module b/docroot/modules/humsci/hs_field_helpers/hs_field_helpers.module index fef19fd8d3..b243fc25ed 100644 --- a/docroot/modules/humsci/hs_field_helpers/hs_field_helpers.module +++ b/docroot/modules/humsci/hs_field_helpers/hs_field_helpers.module @@ -231,12 +231,16 @@ function _hs_field_helpers_cleanup_pattern_regions(array &$pattern, $pattern_id) $rendered = $element; } - // Remove all wrapper divs so we can check if the region actually has any - // visible output. - $rendered = preg_replace("/(.*?)<\/div>/s", "$1", $rendered ?? ''); - $rendered = preg_replace("/
(.*?)<\/div>/s", "$1", $rendered); - if (empty(trim($rendered))) { + if (is_null($rendered)) { unset($pattern[$region]); + } else { + // Remove all wrapper divs so we can check if the region actually has any + // visible output. + $rendered = preg_replace("/(.*?)<\/div>/s", "$1", $rendered); + $rendered = preg_replace("/
(.*?)<\/div>/s", "$1", $rendered); + if (empty(trim($rendered))) { + unset($pattern[$region]); + } } continue; diff --git a/docroot/modules/humsci/hs_layouts/hs_layouts.module b/docroot/modules/humsci/hs_layouts/hs_layouts.module index a1debe0faa..110c2edb9b 100644 --- a/docroot/modules/humsci/hs_layouts/hs_layouts.module +++ b/docroot/modules/humsci/hs_layouts/hs_layouts.module @@ -209,7 +209,7 @@ function hs_layouts_preprocess_pattern_vertical_card(&$variables) { $renderer = \Drupal::service('renderer'); $title_rendered = is_array($variables['title']) ? $renderer->renderInIsolation($variables['title']) : $variables['title']; - if (strpos($title_rendered ?? '', ' Date: Thu, 9 Jan 2025 17:51:31 -0800 Subject: [PATCH 4/4] Added a patch for the Shield module to prevent Watchdog warning messages. --- composer.json | 3 +++ ...-undefined_array_key_explode-3479117.patch | 27 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 patches/shield-undefined_array_key_explode-3479117.patch diff --git a/composer.json b/composer.json index 2360b97c15..36d60c781b 100644 --- a/composer.json +++ b/composer.json @@ -283,6 +283,9 @@ "https://www.drupal.org/project/redirect/issues/3057250": "https://www.drupal.org/files/issues/2024-08-11/redirect--2024-08-11--3057250-79.patch", "https://www.drupal.org/project/redirect/issues/3018897": "https://www.drupal.org/files/issues/2024-08-12/redirect-3018897-28.patch" }, + "drupal/shield": { + "https://www.drupal.org/project/shield/issues/3479117": "patches/shield-undefined_array_key_explode-3479117.patch" + }, "drupal/ui_patterns": { "Ui Patterns Views Preview": "patches/contrib/ui_patterns_views-preview.patch" }, diff --git a/patches/shield-undefined_array_key_explode-3479117.patch b/patches/shield-undefined_array_key_explode-3479117.patch new file mode 100644 index 0000000000..595ec2fe5f --- /dev/null +++ b/patches/shield-undefined_array_key_explode-3479117.patch @@ -0,0 +1,27 @@ +diff --git a/src/ShieldMiddleware.php b/src/ShieldMiddleware.php +index f2a0b56..eb9d993 100644 +--- a/src/ShieldMiddleware.php ++++ b/src/ShieldMiddleware.php +@@ -209,10 +209,20 @@ class ShieldMiddleware implements HttpKernelInterface { + $input_pass = $request->server->get('PHP_AUTH_PW'); + } + elseif (!empty($request->server->get('HTTP_AUTHORIZATION'))) { +- [$input_user, $input_pass] = explode(':', base64_decode(substr($request->server->get('HTTP_AUTHORIZATION'), 6)), 2); ++ $decoded = base64_decode(substr($request->server->get('HTTP_AUTHORIZATION'), 6)); ++ $credentials = explode(':', $decoded, 2); ++ ++ if (count($credentials) === 2) { ++ [$input_user, $input_pass] = $credentials; ++ } + } + elseif (!empty($request->server->get('REDIRECT_HTTP_AUTHORIZATION'))) { +- [$input_user, $input_pass] = explode(':', base64_decode(substr($request->server->get('REDIRECT_HTTP_AUTHORIZATION'), 6)), 2); ++ $decoded = base64_decode(substr($request->server->get('REDIRECT_HTTP_AUTHORIZATION'), 6)); ++ $credentials = explode(':', $decoded, 2); ++ ++ if (count($credentials) === 2) { ++ [$input_user, $input_pass] = $credentials; ++ } + } + if (isset($input_user) && $input_user === $user && hash_equals($pass, $input_pass)) { + $request->headers->set('X-Shield-Status', 'authenticated');