Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/routing/Generator/UrlGenerator.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 |
---|---|
137 $url = ''; | 137 $url = ''; |
138 $optional = true; | 138 $optional = true; |
139 $message = 'Parameter "{parameter}" for route "{route}" must match "{expected}" ("{given}" given) to generate a corresponding URL.'; | 139 $message = 'Parameter "{parameter}" for route "{route}" must match "{expected}" ("{given}" given) to generate a corresponding URL.'; |
140 foreach ($tokens as $token) { | 140 foreach ($tokens as $token) { |
141 if ('variable' === $token[0]) { | 141 if ('variable' === $token[0]) { |
142 if (!$optional || !array_key_exists($token[3], $defaults) || null !== $mergedParams[$token[3]] && (string) $mergedParams[$token[3]] !== (string) $defaults[$token[3]]) { | 142 if (!$optional || !\array_key_exists($token[3], $defaults) || null !== $mergedParams[$token[3]] && (string) $mergedParams[$token[3]] !== (string) $defaults[$token[3]]) { |
143 // check requirement | 143 // check requirement (while ignoring look-around patterns) |
144 if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]])) { | 144 if (null !== $this->strictRequirements && !preg_match('#^'.preg_replace('/\(\?(?:=|<=|!|<!)((?:[^()\\\\]+|\\\\.|\((?1)\))*)\)/', '', $token[2]).'$#'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]])) { |
145 if ($this->strictRequirements) { | 145 if ($this->strictRequirements) { |
146 throw new InvalidParameterException(strtr($message, ['{parameter}' => $token[3], '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$token[3]]])); | 146 throw new InvalidParameterException(strtr($message, ['{parameter}' => $token[3], '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$token[3]]])); |
147 } | 147 } |
148 | 148 |
149 if ($this->logger) { | 149 if ($this->logger) { |
193 | 193 |
194 if ($hostTokens) { | 194 if ($hostTokens) { |
195 $routeHost = ''; | 195 $routeHost = ''; |
196 foreach ($hostTokens as $token) { | 196 foreach ($hostTokens as $token) { |
197 if ('variable' === $token[0]) { | 197 if ('variable' === $token[0]) { |
198 if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#i'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]])) { | 198 // check requirement (while ignoring look-around patterns) |
199 if (null !== $this->strictRequirements && !preg_match('#^'.preg_replace('/\(\?(?:=|<=|!|<!)((?:[^()\\\\]+|\\\\.|\((?1)\))*)\)/', '', $token[2]).'$#i'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]])) { | |
199 if ($this->strictRequirements) { | 200 if ($this->strictRequirements) { |
200 throw new InvalidParameterException(strtr($message, ['{parameter}' => $token[3], '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$token[3]]])); | 201 throw new InvalidParameterException(strtr($message, ['{parameter}' => $token[3], '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$token[3]]])); |
201 } | 202 } |
202 | 203 |
203 if ($this->logger) { | 204 if ($this->logger) { |