Skip to content
Snippets Groups Projects
Unverified Commit d7e9e37d authored by Scott Joudry's avatar Scott Joudry
Browse files

Issue #3258507 - rather than str_replace the entire placeholder array, replace...

Issue #3258507 - rather than str_replace the entire placeholder array, replace one at a time in the reverse order they were added. This benchmarks faster too for some reason.
parent dbe9044b
No related branches found
No related tags found
No related merge requests found
...@@ -184,7 +184,9 @@ class MinifyHTMLExit implements EventSubscriberInterface { ...@@ -184,7 +184,9 @@ class MinifyHTMLExit implements EventSubscriberInterface {
// Restore all values that are currently represented by a placeholder. // Restore all values that are currently represented by a placeholder.
if (!empty($this->placeholders)) { if (!empty($this->placeholders)) {
$this->content = str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->content); foreach (array_reverse($this->placeholders, TRUE) as $placeholder => $value) {
$this->content = str_replace($placeholder, $value, $this->content);
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment