Skip to content
This repository has been archived by the owner on Feb 23, 2019. It is now read-only.

Incorrect Use of Removing Query String From URLs #382

Merged
merged 1 commit into from
Feb 14, 2017
Merged

Conversation

amiga-500
Copy link
Collaborator

@amiga-500 amiga-500 commented Feb 14, 2017

The remove_query() function is used to strip out WP's query string name-value pair from a URL. More specifically, it removes the ver=4.#.# held within a query string. However, some problems were identified:

  • In DbCache_Environment.php and ObjectCache_Environment.php the line show below has an issue. This line generates a new URL with its own query string. However, it uses remove_query() which can still potentially return back a query string of its own. Recall that remove_query() only strips out ver=4.#.#. It seems the author's intention was to use remove_query_all(), which strips out a query string entirely, readying it for the new one: '?page=w3tc_dashboard&':
$url = basename( Util_Environment::remove_query( $_SERVER['REQUEST_URI'] ) ) . '?page=w3tc_dashboard&';
  • When using the Prevent Caching of Objects After Settings Change feature for CSS & JS files, inside UriRewriter.php, which handles URIs contained in CSS files, there is a check to see if a query string exists. If so, then it follows by stripping ?ver=4.#.# and then attaching $_browserCacheId. The problem is that if the URI query string consisted only of ?ver=4.#.# the final URI will end up malformed (e.g., it would end up like this: test.css&x47202 instead of this: test.css?x47202).

:octocat:

@amiga-500 amiga-500 changed the title Handling "remove_query()" Removing WP Query String From URLs Feb 14, 2017
@amiga-500 amiga-500 merged commit 1be5a23 into v0.9.5.x Feb 14, 2017
@amiga-500 amiga-500 deleted the remove_query branch February 14, 2017 16:09
@amiga-500 amiga-500 changed the title Removing WP Query String From URLs Incorrect Use of Removing Query String From URLs Feb 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant