diff core/lib/Drupal/Core/EventSubscriber/OptionsRequestSubscriber.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
line wrap: on
line diff
--- a/core/lib/Drupal/Core/EventSubscriber/OptionsRequestSubscriber.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/core/lib/Drupal/Core/EventSubscriber/OptionsRequestSubscriber.php	Thu Feb 28 13:21:36 2019 +0000
@@ -46,11 +46,11 @@
       // 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);
       }