From fa38e5842cf594e102381a95f0eb702898065e0c Mon Sep 17 00:00:00 2001 From: Jack Sleight Date: Thu, 20 Jun 2024 10:33:21 +0100 Subject: [PATCH 1/2] Fix nocache tags on shared error pages --- src/StaticCaching/ServiceProvider.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/StaticCaching/ServiceProvider.php b/src/StaticCaching/ServiceProvider.php index 5ce15cead2..d651e83884 100644 --- a/src/StaticCaching/ServiceProvider.php +++ b/src/StaticCaching/ServiceProvider.php @@ -82,10 +82,12 @@ public function boot() return 'handle('.$exp.', \Illuminate\Support\Arr::except(get_defined_vars(), [\'__data\', \'__path\'])); ?>'; }); - Request::macro('fakeStaticCacheStatus', function (int $status) { + $session = $this->app[Session::class]; + Request::macro('fakeStaticCacheStatus', function (int $status) use ($session) { $url = '/__shared-errors/'.$status; $this->pathInfo = $url; $this->requestUri = $url; + $session->setUrl($url); return $this; }); From 85227046646f24cec1be92df6298052b765182ba Mon Sep 17 00:00:00 2001 From: Jack Sleight Date: Thu, 20 Jun 2024 10:54:40 +0100 Subject: [PATCH 2/2] Not like that --- src/StaticCaching/ServiceProvider.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/StaticCaching/ServiceProvider.php b/src/StaticCaching/ServiceProvider.php index d651e83884..f882adc779 100644 --- a/src/StaticCaching/ServiceProvider.php +++ b/src/StaticCaching/ServiceProvider.php @@ -82,12 +82,11 @@ public function boot() return 'handle('.$exp.', \Illuminate\Support\Arr::except(get_defined_vars(), [\'__data\', \'__path\'])); ?>'; }); - $session = $this->app[Session::class]; - Request::macro('fakeStaticCacheStatus', function (int $status) use ($session) { + Request::macro('fakeStaticCacheStatus', function (int $status) { $url = '/__shared-errors/'.$status; $this->pathInfo = $url; $this->requestUri = $url; - $session->setUrl($url); + app(Session::class)->setUrl($url); return $this; });