comparison vendor/symfony/routing/Matcher/UrlMatcher.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children 1fec387a4317
comparison
equal deleted inserted replaced
11:bfffd8d7479a 12:7a779792577d
205 * @return array The first element represents the status, the second contains additional information 205 * @return array The first element represents the status, the second contains additional information
206 */ 206 */
207 protected function handleRouteRequirements($pathinfo, $name, Route $route) 207 protected function handleRouteRequirements($pathinfo, $name, Route $route)
208 { 208 {
209 // expression condition 209 // expression condition
210 if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), array('context' => $this->context, 'request' => $this->request))) { 210 if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), array('context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)))) {
211 return array(self::REQUIREMENT_MISMATCH, null); 211 return array(self::REQUIREMENT_MISMATCH, null);
212 } 212 }
213 213
214 // check HTTP scheme requirement 214 // check HTTP scheme requirement
215 $scheme = $this->context->getScheme(); 215 $scheme = $this->context->getScheme();
246 $this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders); 246 $this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders);
247 } 247 }
248 248
249 return $this->expressionLanguage; 249 return $this->expressionLanguage;
250 } 250 }
251
252 /**
253 * @internal
254 */
255 protected function createRequest($pathinfo)
256 {
257 if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
258 return null;
259 }
260
261 return Request::create($this->context->getScheme().'://'.$this->context->getHost().$this->context->getBaseUrl().$pathinfo, $this->context->getMethod(), $this->context->getParameters(), array(), array(), array(
262 'SCRIPT_FILENAME' => $this->context->getBaseUrl(),
263 'SCRIPT_NAME' => $this->context->getBaseUrl(),
264 ));
265 }
251 } 266 }