Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ See also the [GitHub releases page](https://github.com/FriendsOfSymfony/FOSHttpC
3.x
===

3.1.1
-----

### Varnish Cache

* Fixed `banPath` to escape array of host names to be a correct regular expression.

3.1.0
-----

Expand Down
2 changes: 1 addition & 1 deletion src/ProxyClient/Varnish.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function banPath(string $path, ?string $contentType = null, array|string|
if (!count($hosts)) {
throw new InvalidArgumentException('Either supply a list of hosts or null, but not an empty array.');
}
$hosts = '^('.implode('|', $hosts).')$';
$hosts = '^('.implode('|', array_map(preg_quote(...), $hosts)).')$';
}

$headers = [
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/ProxyClient/VarnishTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function testBanPath(): void
\Mockery::on(
function (RequestInterface $request) {
$this->assertEquals('BAN', $request->getMethod());
$this->assertEquals('^(fos.lo|fos2.lo)$', $request->getHeaderLine('X-Host'));
$this->assertEquals('^(fos\.lo|fos2\.lo)$', $request->getHeaderLine('X-Host'));
$this->assertEquals('/articles/.*', $request->getHeaderLine('X-Url'));
$this->assertEquals('text/html', $request->getHeaderLine('X-Content-Type'));

Expand Down
Loading