From 4a4b62bf4d012f4052a1127ef075a01809bc25be Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 6 Jun 2019 11:21:46 +0200 Subject: [PATCH] [HttpKernel] fix link to source generation --- .../Component/HttpKernel/Debug/FileLinkFormatter.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php b/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php index 54defbf1d1..eb24167529 100644 --- a/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php +++ b/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php @@ -68,7 +68,7 @@ class FileLinkFormatter */ public function __sleep(): array { - $this->getFileLinkFormat(); + $this->fileLinkFormat = $this->getFileLinkFormat(); return ['fileLinkFormat']; } @@ -87,17 +87,19 @@ class FileLinkFormatter private function getFileLinkFormat() { + if ($this->fileLinkFormat) { + return $this->fileLinkFormat; + } + if ($this->requestStack && $this->baseDir && $this->urlFormat) { $request = $this->requestStack->getMasterRequest(); if ($request instanceof Request && (!$this->urlFormat instanceof \Closure || $this->urlFormat = ($this->urlFormat)())) { - $this->fileLinkFormat = [ + return [ $request->getSchemeAndHttpHost().$request->getBasePath().$this->urlFormat, $this->baseDir.\DIRECTORY_SEPARATOR, '', ]; } } - - return $this->fileLinkFormat; } }