Skip to content

Commit

Permalink
Merge pull request #205 from totten/master-backdrop
Browse files Browse the repository at this point in the history
Backdrop - Fix bootstrap warning about `explode()` and `null`
  • Loading branch information
totten authored Aug 10, 2024
2 parents 3eee2b3 + e475999 commit 73c4bc7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/src/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ public function boot($options = array()) {
// Hint for D7 multisite
$_SERVER['HTTP_HOST'] = $options['httpHost'];
}
elseif (empty($_SERVER['HTTP_HOST']) && $cmsType === 'backdrop') {
// backdrop_settings_initialize() tries to configure cookie policy - and complains if HTTP_HOST is missing
$_SERVER['HTTP_HOST'] = 'localhost';
}
if (ord($_SERVER['SCRIPT_NAME']) != 47) {
$_SERVER['SCRIPT_NAME'] = '/' . $_SERVER['SCRIPT_NAME'];
}
Expand Down Expand Up @@ -254,6 +258,10 @@ public function generate() {
'REQUEST_METHOD',
'SCRIPT_NAME',
);
if (CIVICRM_UF === 'Backdrop') {
$srvVars[] = 'HTTP_HOST';
// ^^ This might make sense for all UF's, but it would require more testing to QA.
}
foreach ($srvVars as $srvVar) {
$code[] = sprintf('$_SERVER["%s"] = %s;',
$srvVar, var_export($_SERVER[$srvVar], 1));
Expand Down Expand Up @@ -377,11 +385,11 @@ protected function findCivicrmSettingsPhp($searchDir) {
$settings = $this->findFirstFile(
[
$cmsRoot,
implode(DIRECTORY_SEPARATOR, [$cmsRoot, 'data'])
implode(DIRECTORY_SEPARATOR, [$cmsRoot, 'data']),
],
[
'civicrm.standalone.php',
'civicrm.settings.php',
'civicrm.standalone.php',
'civicrm.settings.php',
]
);
break;
Expand Down

0 comments on commit 73c4bc7

Please sign in to comment.