Skip to content

Commit 41caccd

Browse files
authored
Merge pull request #1 from dwnload/develop
Version 1.0.4
2 parents f26fe99 + b5874b1 commit 41caccd

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

CHANGELONG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## 1.0.4 - 2018-04-19
8+
### Updated
9+
- `RestDispatch::preDispatch` should set the $request_uri from `CacheApiTrait::getRequestUri` and not use
10+
`WP_REST_Request::get_route` to avoid query parameters getting stripped out of the cache request.
11+
- `CacheApiTrait::getRequestUri` to sanitize the REQUEST_URI
12+
13+
## 1.0.3 - 2018-04-18
14+
### Updated
15+
- Bumped [thefrosty/wp-utilities](https://github.com/thefrosty/wp-utilities/) to version 1.1.3
16+
717
## 1.0.2 - 2018-04-18
818
### Updated
919
- Bumped [thefrosty/wp-utilities](https://github.com/thefrosty/wp-utilities/) to version 1.1.2

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "dwnload/wp-rest-api-object-cache",
33
"description": "Enable object caching for WordPress' REST API. Aids in increased response times of your applications endpoints.",
44
"type": "wordpress-plugin",
5-
"version": "1.0.3",
5+
"version": "1.0.4",
66
"license": "MIT",
77
"authors": [
88
{

src/RestApi/CacheApiTrait.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,10 @@ protected function wpCacheDeleteByKey(string $key) : bool
8686
* Return the current REQUEST_URI from the global server variable.
8787
* Don't use `FILTER_SANITIZE_URL` since it will return false when 'http' isn't present.
8888
*
89-
* @param string|null $route The request route.
9089
* @return string
9190
*/
92-
protected function getRequestUri(string $route = null) : string
91+
protected function getRequestUri() : string
9392
{
94-
return filter_var_string($route ?? $_SERVER['REQUEST_URI']);
93+
return filter_var_string(wp_unslash($_SERVER['REQUEST_URI']));
9594
}
9695
}

src/RestApi/RestDispatch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function addHooks()
6262
*/
6363
public function preDispatch($result, WP_REST_Server $server, WP_REST_Request $request)
6464
{
65-
$request_uri = $request->get_route() ?? $this->getRequestUri();
65+
$request_uri = $this->getRequestUri();
6666
$group = $this->getCacheGroup();
6767
$key = $this->getCacheKey($request_uri, $server, $request);
6868

0 commit comments

Comments
 (0)