From 38ee83e1d04f2bb0ab1f2e210042380c72d22009 Mon Sep 17 00:00:00 2001 From: Jacob Dreesen Date: Mon, 16 Jun 2025 17:31:29 +0200 Subject: [PATCH] Escape special characters in Varnish::banPath() host patterns --- src/ProxyClient/Varnish.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ProxyClient/Varnish.php b/src/ProxyClient/Varnish.php index a4b7137e..ab542059 100644 --- a/src/ProxyClient/Varnish.php +++ b/src/ProxyClient/Varnish.php @@ -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 = [