diff --git a/src/Illuminate/Routing/ImplicitRouteBinding.php b/src/Illuminate/Routing/ImplicitRouteBinding.php index c6d1953462a6..0114f1ac7986 100644 --- a/src/Illuminate/Routing/ImplicitRouteBinding.php +++ b/src/Illuminate/Routing/ImplicitRouteBinding.php @@ -36,7 +36,6 @@ public static function resolveForRoute($container, $route) $instance = $container->make(Reflector::getParameterClassName($parameter)); $parent = $route->parentOfParameter($parameterName); - if ($parent instanceof UrlRoutable && in_array($parameterName, array_keys($route->bindingFields()))) { if (! $model = $parent->resolveChildRouteBinding( $parameterName, $parameterValue, $route->bindingFieldFor($parameterName) diff --git a/src/Illuminate/Routing/Route.php b/src/Illuminate/Routing/Route.php index f67756d353a0..37ba1aaa4236 100755 --- a/src/Illuminate/Routing/Route.php +++ b/src/Illuminate/Routing/Route.php @@ -238,8 +238,7 @@ protected function runCallable() */ protected function isSerializedClosure() { - return is_string($this->action['uses']) && - Str::startsWith($this->action['uses'], 'C:32:"Opis\\Closure\\SerializableClosure') !== false; + return RouteAction::containsSerializedClosure($this->action); } /** diff --git a/src/Illuminate/Routing/RouteAction.php b/src/Illuminate/Routing/RouteAction.php index 9d7eb76a85d8..5a8188e27bbd 100644 --- a/src/Illuminate/Routing/RouteAction.php +++ b/src/Illuminate/Routing/RouteAction.php @@ -94,4 +94,16 @@ protected static function makeInvokable($action) return $action.'@__invoke'; } + + /** + * Determine if the given array actions contains a serialized Closure. + * + * @param array $action + * @return bool + */ + public static function containsSerializedClosure(array $action) + { + return is_string($action['uses']) && + Str::startsWith($action['uses'], 'C:32:"Opis\\Closure\\SerializableClosure') !== false; + } } diff --git a/src/Illuminate/Routing/RouteSignatureParameters.php b/src/Illuminate/Routing/RouteSignatureParameters.php index bd7e932fb316..03d3137b511c 100644 --- a/src/Illuminate/Routing/RouteSignatureParameters.php +++ b/src/Illuminate/Routing/RouteSignatureParameters.php @@ -18,9 +18,13 @@ class RouteSignatureParameters */ public static function fromAction(array $action, $subClass = null) { - $parameters = is_string($action['uses']) - ? static::fromClassMethodString($action['uses']) - : (new ReflectionFunction($action['uses']))->getParameters(); + $callback = RouteAction::containsSerializedClosure($action) + ? unserialize($action['uses'])->getClosure() + : $action['uses']; + + $parameters = is_string($callback) + ? static::fromClassMethodString($callback) + : (new ReflectionFunction($callback))->getParameters(); return is_null($subClass) ? $parameters : array_filter($parameters, function ($p) use ($subClass) { return Reflector::isParameterSubclassOf($p, $subClass);