elementor / static-html-output

Static HTML Output Plugin for WordPress

Home Page:https://statichtmloutput.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

str_replace uses same value for search and replace parameters

joyously opened this issue · comments

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.

https://github.com/leonstafford/static-html-output/blob/10cf1af363a07c90d1bec426f7db99f40cadfff9/src/HTMLProcessor.php#L1261-L1277

https://github.com/leonstafford/static-html-output/blob/10cf1af363a07c90d1bec426f7db99f40cadfff9/src/HTMLProcessor.php#L1285-L1301

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, '/' )
),                                                   ),