comparison vendor/symfony/psr-http-message-bridge/Factory/HttpFoundationFactory.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
138 /** 138 /**
139 * {@inheritdoc} 139 * {@inheritdoc}
140 */ 140 */
141 public function createResponse(ResponseInterface $psrResponse) 141 public function createResponse(ResponseInterface $psrResponse)
142 { 142 {
143 $cookies = $psrResponse->getHeader('Set-Cookie');
144 $psrResponse = $psrResponse->withoutHeader('Set-Cookie');
145
143 $response = new Response( 146 $response = new Response(
144 $psrResponse->getBody()->__toString(), 147 $psrResponse->getBody()->__toString(),
145 $psrResponse->getStatusCode(), 148 $psrResponse->getStatusCode(),
146 $psrResponse->getHeaders() 149 $psrResponse->getHeaders()
147 ); 150 );
148 $response->setProtocolVersion($psrResponse->getProtocolVersion()); 151 $response->setProtocolVersion($psrResponse->getProtocolVersion());
149 152
150 foreach ($psrResponse->getHeader('Set-Cookie') as $cookie) { 153 foreach ($cookies as $cookie) {
151 $response->headers->setCookie($this->createCookie($cookie)); 154 $response->headers->setCookie($this->createCookie($cookie));
152 } 155 }
153 156
154 return $response; 157 return $response;
155 } 158 }
205 continue; 208 continue;
206 } 209 }
207 210
208 if ('httponly' === strtolower($name)) { 211 if ('httponly' === strtolower($name)) {
209 $cookieHttpOnly = true; 212 $cookieHttpOnly = true;
213
214 continue;
215 }
216
217 if ('samesite' === strtolower($name) && null !== $value) {
218 $samesite = $value;
210 219
211 continue; 220 continue;
212 } 221 }
213 } 222 }
214 223
221 $cookieValue, 230 $cookieValue,
222 isset($cookieExpire) ? $cookieExpire : 0, 231 isset($cookieExpire) ? $cookieExpire : 0,
223 isset($cookiePath) ? $cookiePath : '/', 232 isset($cookiePath) ? $cookiePath : '/',
224 isset($cookieDomain) ? $cookieDomain : null, 233 isset($cookieDomain) ? $cookieDomain : null,
225 isset($cookieSecure), 234 isset($cookieSecure),
226 isset($cookieHttpOnly) 235 isset($cookieHttpOnly),
236 false,
237 isset($samesite) ? $samesite : null
227 ); 238 );
228 } 239 }
229 } 240 }