X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FEventSubscriber%2FOptionsRequestSubscriber.php;fp=web%2Fcore%2Flib%2FDrupal%2FCore%2FEventSubscriber%2FOptionsRequestSubscriber.php;h=ee22937dcaada2f8a96db738261179170e0f9ff8;hp=3abc55c53a64d3421a1857e048a586fef794d117;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/lib/Drupal/Core/EventSubscriber/OptionsRequestSubscriber.php b/web/core/lib/Drupal/Core/EventSubscriber/OptionsRequestSubscriber.php index 3abc55c53..ee22937dc 100644 --- a/web/core/lib/Drupal/Core/EventSubscriber/OptionsRequestSubscriber.php +++ b/web/core/lib/Drupal/Core/EventSubscriber/OptionsRequestSubscriber.php @@ -46,11 +46,11 @@ class OptionsRequestSubscriber implements EventSubscriberInterface { // In case we don't have any routes, a 403 should be thrown by the normal // request handling. if (count($routes) > 0) { - $methods = array_map(function (Route $route) { - return $route->getMethods(); - }, $routes->all()); // Flatten and unique the available methods. - $methods = array_unique(call_user_func_array('array_merge', $methods)); + $methods = array_reduce($routes->all(), function ($methods, Route $route) { + return array_merge($methods, $route->getMethods()); + }, []); + $methods = array_unique($methods); $response = new Response('', 200, ['Allow' => implode(', ', $methods)]); $event->setResponse($response); }