-
-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix PHP Error/Warnning #279
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -327,6 +327,15 @@ 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; | ||
} | ||
Comment on lines
+335
to
+337
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks weird to me. Sohuld not we rather return There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right, I'll move that check in |
||
|
||
girishpanchal30 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
$findReplaceCurrentConfig = array_combine($currentConfig->find_string, $currentConfig->replace_string); | ||
$findReplaceNewConfig = array_combine($newConfig->find_string, $newConfig->replace_string); | ||
$findReplaceMerged = array_merge((array) $findReplaceCurrentConfig, (array) $findReplaceNewConfig); | ||
|
@@ -340,10 +349,6 @@ public function mergeConfig(SiteConfig $currentConfig, SiteConfig $newConfig) | |
$currentConfig->replace_string[] = $replaceString; | ||
} | ||
|
||
// 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); | ||
|
||
return $currentConfig; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If https://www.php.net/manual/en/domdocument.savexml.php#44422 is correct, this would just save a page from unknown encoding as UTF-8. No idea how would it try to do that, possibly leading to some corruption.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, but that's not really a problem as it's inside the log, maybe the log will only be unreadable?