Skip to content

Commit

Permalink
Move http_header array_merge before condition #278
Browse files Browse the repository at this point in the history
  • Loading branch information
girishpanchal30 committed Jan 7, 2022
1 parent 8b42331 commit c40eb1b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/SiteConfig/ConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,11 @@ public function mergeConfig(SiteConfig $currentConfig, SiteConfig $newConfig)
// find_string: <other-img
// replace_string: <img
// To fix that issue, we combine find & replace as key & value in one array, we merge them and then rebuild find & replace string in the current config

// merge http_header array from currentConfig into newConfig
// because final values override former values in case of named keys
$currentConfig->http_header = array_merge($newConfig->http_header, $currentConfig->http_header);

if (count($currentConfig->find_string) !== count($currentConfig->replace_string)) {
return $currentConfig;
}
Expand All @@ -346,9 +349,6 @@ public function mergeConfig(SiteConfig $currentConfig, SiteConfig $newConfig)
$currentConfig->replace_string[] = $replaceString;
}

// because final values override former values in case of named keys
$currentConfig->http_header = array_merge($newConfig->http_header, $currentConfig->http_header);

return $currentConfig;
}

Expand Down

0 comments on commit c40eb1b

Please sign in to comment.