diff --git a/src/Network/HTTPRequest.php b/src/Network/HTTPRequest.php index cf9b53a92a..d47e969d51 100644 --- a/src/Network/HTTPRequest.php +++ b/src/Network/HTTPRequest.php @@ -197,12 +197,14 @@ class HTTPRequest implements IHTTPRequest $curlOptions[CURLOPT_BINARYTRANSFER] = 1; } + $logger = $this->logger; + $onRedirect = function( RequestInterface $request, ResponseInterface $response, UriInterface $uri - ) { - $this->logger->notice('Curl redirect.', ['url' => $request->getUri(), 'to' => $uri]); + ) use ($logger) { + $logger->notice('Curl redirect.', ['url' => $request->getUri(), 'to' => $uri]); }; $onHeaders = function (ResponseInterface $response) use ($opts) {