pluginkollektiv / cachify

Smart but efficient cache solution for WordPress. Use DB, HDD, APC or Memcached for storing your blog pages. Make WordPress faster!
https://wordpress.org/plugins/cachify/
GNU General Public License v2.0
99 stars 31 forks source link

fix URL parsing for cache key generation (#275) #276

Closed stklcode closed 1 year ago

stklcode commented 1 year ago

As part of refactoring in #190 the URL parsing has been altered, s.t. we pass a concatenation of host and path to wp_parse_url(). This results in the actual host not being parsed at all which raises a PHP warning.

Prefix the URL with double slashes (the protocol is not of interest here) to fix the parsing.

We could use a full URL here, like

$url = wp_unslash( $_SERVER['REQUEST_SCHEME'] ) '://' . wp_unslash( $_SERVER['HTTP_HOST'] ) . wp_unslash( $_SERVER['REQUEST_URI'] );

or even add port, query, etc. to make it complete, but we only process host and path in the very next lines, so a reduced, protocol-agnostic URL is sufficient here.

resolves #275