From 2af200ba0875e44d954d0299389364b8e2389b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Costa=20Silva?= <1574795+joaocsilva@users.noreply.github.com> Date: Wed, 12 Jun 2024 10:54:15 +0100 Subject: [PATCH] DQA-9566: DRUPAL_REVERSE_PROXY not properly set (#781) --- src/TaskRunner/Commands/DrupalCommands.php | 4 ++-- tests/fixtures/commands/drupal-settings-setup.yml | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/TaskRunner/Commands/DrupalCommands.php b/src/TaskRunner/Commands/DrupalCommands.php index 3d3b98e1e..e3ef8588c 100644 --- a/src/TaskRunner/Commands/DrupalCommands.php +++ b/src/TaskRunner/Commands/DrupalCommands.php @@ -620,8 +620,8 @@ protected function getToolkitSettingsBlock() \$settings['file_temp_path'] = getenv('DRUPAL_FILE_TEMP_PATH') !== FALSE ? getenv('DRUPAL_FILE_TEMP_PATH') : '/tmp'; // Reverse proxy. -if (intval(getenv('DRUPAL_REVERSE_PROXY_ENABLE')) === 1) { - \$settings['reverse_proxy'] = (bool) getenv('DRUPAL_REVERSE_PROXY_ENABLE'); +if (filter_var(getenv('DRUPAL_REVERSE_PROXY_ENABLE'), FILTER_VALIDATE_BOOLEAN)) { + \$settings['reverse_proxy'] = getenv('DRUPAL_REVERSE_PROXY_ENABLE'); \$settings['reverse_proxy_addresses'] = explode(',', getenv('DRUPAL_REVERSE_PROXY_ADDRESSES')); } diff --git a/tests/fixtures/commands/drupal-settings-setup.yml b/tests/fixtures/commands/drupal-settings-setup.yml index 04dd76e26..11a2c17a5 100644 --- a/tests/fixtures/commands/drupal-settings-setup.yml +++ b/tests/fixtures/commands/drupal-settings-setup.yml @@ -40,8 +40,8 @@ $settings['file_temp_path'] = getenv('DRUPAL_FILE_TEMP_PATH') !== FALSE ? getenv('DRUPAL_FILE_TEMP_PATH') : '/tmp'; // Reverse proxy. - if (intval(getenv('DRUPAL_REVERSE_PROXY_ENABLE')) === 1) { - $settings['reverse_proxy'] = (bool) getenv('DRUPAL_REVERSE_PROXY_ENABLE'); + if (filter_var(getenv('DRUPAL_REVERSE_PROXY_ENABLE'), FILTER_VALIDATE_BOOLEAN)) { + $settings['reverse_proxy'] = getenv('DRUPAL_REVERSE_PROXY_ENABLE'); $settings['reverse_proxy_addresses'] = explode(',', getenv('DRUPAL_REVERSE_PROXY_ADDRESSES')); } @@ -103,8 +103,8 @@ $settings['file_temp_path'] = getenv('DRUPAL_FILE_TEMP_PATH') !== FALSE ? getenv('DRUPAL_FILE_TEMP_PATH') : '/tmp'; // Reverse proxy. - if (intval(getenv('DRUPAL_REVERSE_PROXY_ENABLE')) === 1) { - $settings['reverse_proxy'] = (bool) getenv('DRUPAL_REVERSE_PROXY_ENABLE'); + if (filter_var(getenv('DRUPAL_REVERSE_PROXY_ENABLE'), FILTER_VALIDATE_BOOLEAN)) { + $settings['reverse_proxy'] = getenv('DRUPAL_REVERSE_PROXY_ENABLE'); $settings['reverse_proxy_addresses'] = explode(',', getenv('DRUPAL_REVERSE_PROXY_ADDRESSES')); } @@ -167,8 +167,8 @@ $settings['file_temp_path'] = getenv('DRUPAL_FILE_TEMP_PATH') !== FALSE ? getenv('DRUPAL_FILE_TEMP_PATH') : '/tmp'; // Reverse proxy. - if (intval(getenv('DRUPAL_REVERSE_PROXY_ENABLE')) === 1) { - $settings['reverse_proxy'] = (bool) getenv('DRUPAL_REVERSE_PROXY_ENABLE'); + if (filter_var(getenv('DRUPAL_REVERSE_PROXY_ENABLE'), FILTER_VALIDATE_BOOLEAN)) { + $settings['reverse_proxy'] = getenv('DRUPAL_REVERSE_PROXY_ENABLE'); $settings['reverse_proxy_addresses'] = explode(',', getenv('DRUPAL_REVERSE_PROXY_ADDRESSES')); }