str_replace uses same value for search and replace parameters
joyously opened this issue · comments
https://github.com/leonstafford/static-html-output/blob/10cf1af363a07c90d1bec426f7db99f40cadfff9/src/HTMLProcessor.php#L1161-L1166
and
https://github.com/leonstafford/static-html-output/blob/10cf1af363a07c90d1bec426f7db99f40cadfff9/src/HTMLProcessor.php#L1185-L1190
both look like a noop, replacing the patterns with the patterns.
Should these have a call to getBaseURLRewriteReplacements()
instead?
Thanks for reporting, @joyously! Been a while since I looked at this.
Are you able to confirm behaviour if you modify as intended?
There should be unit/integration tests covering this code, so will be good to see if/how they fail.
I haven't tried it yet, but suggested it based on logic.
Looking more closely at getBaseURLRewriteReplacements()
, the patterns don't quite make sense to me.
Putting them side by side, the first three seem okay, but after that, I don't know.
$this->placeholder_url, $this->base_url,
addcslashes( $this->placeholder_url, '/' ), addcslashes( $this->base_url, '/' ),
$this->getProtocolRelativeURL( $this->getProtocolRelativeURL(
$this->placeholder_url $this->base_url
), ),
$this->getProtocolRelativeURL( $this->getProtocolRelativeURL(
$this->placeholder_url rtrim( $this->base_url, '/' )
), ),
$this->getProtocolRelativeURL( $this->getProtocolRelativeURL(
$this->placeholder_url . '/' $this->base_url . '//'
), ),
$this->getProtocolRelativeURL( $this->getProtocolRelativeURL(
addcslashes( $this->placeholder_url, '/' ) addcslashes( $this->base_url, '/' )
), ),