ame = sha1($this->getFileName()); } return $this->hashedName; } /** * Get the file tokens. * * @return array */ protected function getFileTokens() { $key = $this->getHashedFileName(); if (! isset(static::$files[$key])) { static::$files[$key] = token_get_all(file_get_contents($this->getFileName())); } return static::$files[$key]; } /** * Get the tokens. * * @return array */ protected function getTokens() { if ($this->tokens === null) { $tokens = $this->getFileTokens(); $startLine = $this->getStartLine(); $endLine = $this->getEndLine(); $results = []; $start = false; foreach ($tokens as &$token) { if (! is_array($token)) { if ($start) { $results[] = $token; } continue; } $line = $token[2]; if ($line <= $endLine) { if ($line >= $startLine) { $start = true; $results[] = $token; } continue; } break; } $this->tokens = $results; } return $this->tokens; } /** * Get the classes. * * @return array */ protected function getClasses() { $line = $this->getStartLine(); foreach ($this->getStructures() as $struct) { if ($struct['type'] === 'namespace' && $struct['start'] <= $line && $struct['end'] >= $line ) { return $struct['classes']; } } return []; } /** * Get the functions. * * @return array */ protected function getFunctions() { $key = $this->getHashedFileName(); if (! isset(static::$functions[$key])) { $this->fetchItems(); } return static::$functions[$key]; } /** * Gets the constants. * * @return array */ protected function getConstants() { $key = $this->getHashedFileName(); if (! isset(static::$constants[$key])) { $this->fetchItems(); } return static::$constants[$key]; } /** * Get the structures. * * @return array */ protected function getStructures() { $key = $this->getHashedFileName(); if (! isset(static::$structures[$key])) { $this->fetchItems(); } return static::$structures[$key]; } /** * Fetch the items. * * @return void. */ protected function fetchItems() { $key = $this->getHashedFileName(); $classes = []; $functions = []; $constants = []; $structures = []; $tokens = $this->getFileTokens(); $open = 0; $state = 'start'; $lastState = ''; $prefix = ''; $name = ''; $alias = ''; $isFunc = $isConst = false; $startLine = $lastKnownLine = 0; $structType = $structName = ''; $structIgnore = false; $namespace = ''; $namespaceStartLine = 0; $namespaceBraced = false; $namespaceClasses = []; foreach ($tokens as $token) { if (is_array($token)) { $lastKnownLine = $token[2]; } switch ($state) { case 'start': switch ($token[0]) { case T_NAMESPACE: $structures[] = [ 'type' => 'namespace', 'name' => $namespace, 'start' => $namespaceStartLine, 'end' => $token[2] - 1, 'classes' => $namespaceClasses, ]; $namespace = ''; $namespaceClasses = []; $state = 'namespace'; $namespaceStartLine = $token[2]; break; case T_CLASS: case T_INTERFACE: case T_TRAIT: $state = 'before_structure'; $startLine = $token[2]; $structType = $token[0] == T_CLASS ? 'class' : ($token[0] == T_INTERFACE ? 'interface' : 'trait'); break; case T_USE: $state = 'use'; $prefix = $name = $alias = ''; $isFunc = $isConst = false; break; case T_FUNCTION: $state = 'structure'; $structIgnore = true; break; case T_NEW: $state = 'new'; break; case T_OBJECT_OPERATOR: case T_DOUBLE_COLON: $state = 'invoke'; break; case '}': if ($namespaceBraced) { $structures[] = [ 'type' => 'namespace', 'name' => $namespace, 'start' => $namespaceStartLine, 'end' => $lastKnownLine, 'classes' => $namespaceClasses, ]; $namespaceBraced = false; $namespace = ''; $namespaceClasses = []; } break; } break; case 'namespace': switch ($token[0]) { case T_STRING: case T_NAME_QUALIFIED: $namespace = $token[1]; break; case ';': case '{': $state = 'start'; $namespaceBraced = $token[0] === '{'; break; } break; case 'use': switch ($token[0]) { case T_FUNCTION: $isFunc = true; break; case T_CONST: $isConst = true; break; case T_NS_SEPARATOR: $name .= $token[1]; break; case T_STRING: $name .= $token[1]; $alias = $token[1]; break; case T_NAME_QUALIFIED: $name .= $token[1]; $pieces = explode('\\', $token[1]); $alias = end($pieces); break; case T_AS: $lastState = 'use'; $state = 'alias'; break; case '{': $prefix = $name; $name = $alias = ''; $state = 'use-group'; break; case ',': case ';': if ($name === '' || $name[0] !== '\\') { $name = '\\'.$name; } if ($alias !== '') { if ($isFunc) { $functions[strtolower($alias)] = $name; } elseif ($isConst) { $constants[$alias] = $name; } else { $classes[strtolower($alias)] = $name; $namespaceClasses[strtolower($alias)] = $name; } } $name = $alias = ''; $state = $token === ';' ? 'start' : 'use'; break; } break; case 'use-group': switch ($token[0]) { case T_NS_SEPARATOR: $name .= $token[1]; break; case T_NAME_QUALIFIED: $name .= $token[1]; $pieces = explode('\\', $token[1]); $alias = end($pieces); break; case T_STRING: $name .= $token[1]; $alias = $token[1]; break; case T_AS: $lastState = 'use-group'; $state = 'alias'; break; case ',': case '}': if ($prefix === '' || $prefix[0] !== '\\') { $prefix = '\\'.$prefix; } if ($alias !== '') { if ($isFunc) { $functions[strtolower($alias)] = $prefix.$name; } elseif ($isConst) { $constants[$alias] = $prefix.$name; } else { $classes[strtolower($alias)] = $prefix.$name; $namespaceClasses[strtolower($alias)] = $prefix.$name; } } $name = $alias = ''; $state = $token === '}' ? 'use' : 'use-group'; break; } break; case 'alias': if ($token[0] === T_STRING) { $alias = $token[1]; $state = $lastState; } break; case 'new': switch ($token[0]) { case T_WHITESPACE: case T_COMMENT: case T_DOC_COMMENT: break 2; case T_CLASS: $state = 'structure'; $structIgnore = true; break; default: $state = 'start'; } break; case 'invoke': switch ($token[0]) { case T_WHITESPACE: case T_COMMENT: case T_DOC_COMMENT: break 2; default: $state = 'start'; } break; case 'before_structure': if ($token[0] == T_STRING) { $structName = $token[1]; $state = 'structure'; } break; case 'structure': switch ($token[0]) { case '{': case T_CURLY_OPEN: case T_DOLLAR_OPEN_CURLY_BRACES: $open++; break; case '}': if (--$open == 0) { if (! $structIgnore) { $structures[] = [ 'type' => $structType, 'name' => $structName, 'start' => $startLine, 'end' => $lastKnownLine, ]; } $structIgnore = false; $state = 'start'; } break; } break; } } $structures[] = [ 'type' => 'namespace', 'name' => $namespace, 'start' => $namespaceStartLine, 'end' => PHP_INT_MAX, 'classes' => $namespaceClasses, ]; static::$classes[$key] = $classes; static::$functions[$key] = $functions; static::$constants[$key] = $constants; static::$structures[$key] = $structures; } /** * Returns the namespace associated to the closure. * * @return string */ protected function getClosureNamespaceName() { $startLine = $this->getStartLine(); $endLine = $this->getEndLine(); foreach ($this->getStructures() as $struct) { if ($struct['type'] === 'namespace' && $struct['start'] <= $startLine && $struct['end'] >= $endLine ) { return $struct['name']; } } return ''; } /** * Parse the given token. * * @param string $token * @return array */ protected function parseNameQualified($token) { $pieces = explode('\\', $token); $id_start = array_shift($pieces); $id_start_ci = strtolower($id_start); $id_name = '\\'.implode('\\', $pieces); return [$id_start, $id_start_ci, $id_name]; } } ame = sha1($this->getFileName()); } return $this->hashedName; } /** * Get the file tokens. * * @return array */ protected function getFileTokens() { $key = $this->getHashedFileName(); if (! isset(static::$files[$key])) { static::$files[$key] = token_get_all(file_get_contents($this->getFileName())); } return static::$files[$key]; } /** * Get the tokens. * * @return array */ protected function getTokens() { if ($this->tokens === null) { $tokens = $this->getFileTokens(); $startLine = $this->getStartLine(); $endLine = $this->getEndLine(); $results = []; $start = false; foreach ($tokens as &$token) { if (! is_array($token)) { if ($start) { $results[] = $token; } continue; } $line = $token[2]; if ($line <= $endLine) { if ($line >= $startLine) { $start = true; $results[] = $token; } continue; } break; } $this->tokens = $results; } return $this->tokens; } /** * Get the classes. * * @return array */ protected function getClasses() { $line = $this->getStartLine(); foreach ($this->getStructures() as $struct) { if ($struct['type'] === 'namespace' && $struct['start'] <= $line && $struct['end'] >= $line ) { return $struct['classes']; } } return []; } /** * Get the functions. * * @return array */ protected function getFunctions() { $key = $this->getHashedFileName(); if (! isset(static::$functions[$key])) { $this->fetchItems(); } return static::$functions[$key]; } /** * Gets the constants. * * @return array */ protected function getConstants() { $key = $this->getHashedFileName(); if (! isset(static::$constants[$key])) { $this->fetchItems(); } return static::$constants[$key]; } /** * Get the structures. * * @return array */ protected function getStructures() { $key = $this->getHashedFileName(); if (! isset(static::$structures[$key])) { $this->fetchItems(); } return static::$structures[$key]; } /** * Fetch the items. * * @return void. */ protected function fetchItems() { $key = $this->getHashedFileName(); $classes = []; $functions = []; $constants = []; $structures = []; $tokens = $this->getFileTokens(); $open = 0; $state = 'start'; $lastState = ''; $prefix = ''; $name = ''; $alias = ''; $isFunc = $isConst = false; $startLine = $lastKnownLine = 0; $structType = $structName = ''; $structIgnore = false; $namespace = ''; $namespaceStartLine = 0; $namespaceBraced = false; $namespaceClasses = []; foreach ($tokens as $token) { if (is_array($token)) { $lastKnownLine = $token[2]; } switch ($state) { case 'start': switch ($token[0]) { case T_NAMESPACE: $structures[] = [ 'type' => 'namespace', 'name' => $namespace, 'start' => $namespaceStartLine, 'end' => $token[2] - 1, 'classes' => $namespaceClasses, ]; $namespace = ''; $namespaceClasses = []; $state = 'namespace'; $namespaceStartLine = $token[2]; break; case T_CLASS: case T_INTERFACE: case T_TRAIT: $state = 'before_structure'; $startLine = $token[2]; $structType = $token[0] == T_CLASS ? 'class' : ($token[0] == T_INTERFACE ? 'interface' : 'trait'); break; case T_USE: $state = 'use'; $prefix = $name = $alias = ''; $isFunc = $isConst = false; break; case T_FUNCTION: $state = 'structure'; $structIgnore = true; break; case T_NEW: $state = 'new'; break; case T_OBJECT_OPERATOR: case T_DOUBLE_COLON: $state = 'invoke'; break; case '}': if ($namespaceBraced) { $structures[] = [ 'type' => 'namespace', 'name' => $namespace, 'start' => $namespaceStartLine, 'end' => $lastKnownLine, 'classes' => $namespaceClasses, ]; $namespaceBraced = false; $namespace = ''; $namespaceClasses = []; } break; } break; case 'namespace': switch ($token[0]) { case T_STRING: case T_NAME_QUALIFIED: $namespace = $token[1]; break; case ';': case '{': $state = 'start'; $namespaceBraced = $token[0] === '{'; break; } break; case 'use': switch ($token[0]) { case T_FUNCTION: $isFunc = true; break; case T_CONST: $isConst = true; break; case T_NS_SEPARATOR: $name .= $token[1]; break; case T_STRING: $name .= $token[1]; $alias = $token[1]; break; case T_NAME_QUALIFIED: $name .= $token[1]; $pieces = explode('\\', $token[1]); $alias = end($pieces); break; case T_AS: $lastState = 'use'; $state = 'alias'; break; case '{': $prefix = $name; $name = $alias = ''; $state = 'use-group'; break; case ',': case ';': if ($name === '' || $name[0] !== '\\') { $name = '\\'.$name; } if ($alias !== '') { if ($isFunc) { $functions[strtolower($alias)] = $name; } elseif ($isConst) { $constants[$alias] = $name; } else { $classes[strtolower($alias)] = $name; $namespaceClasses[strtolower($alias)] = $name; } } $name = $alias = ''; $state = $token === ';' ? 'start' : 'use'; break; } break; case 'use-group': switch ($token[0]) { case T_NS_SEPARATOR: $name .= $token[1]; break; case T_NAME_QUALIFIED: $name .= $token[1]; $pieces = explode('\\', $token[1]); $alias = end($pieces); break; case T_STRING: $name .= $token[1]; $alias = $token[1]; break; case T_AS: $lastState = 'use-group'; $state = 'alias'; break; case ',': case '}': if ($prefix === '' || $prefix[0] !== '\\') { $prefix = '\\'.$prefix; } if ($alias !== '') { if ($isFunc) { $functions[strtolower($alias)] = $prefix.$name; } elseif ($isConst) { $constants[$alias] = $prefix.$name; } else { $classes[strtolower($alias)] = $prefix.$name; $namespaceClasses[strtolower($alias)] = $prefix.$name; } } $name = $alias = ''; $state = $token === '}' ? 'use' : 'use-group'; break; } break; case 'alias': if ($token[0] === T_STRING) { $alias = $token[1]; $state = $lastState; } break; case 'new': switch ($token[0]) { case T_WHITESPACE: case T_COMMENT: case T_DOC_COMMENT: break 2; case T_CLASS: $state = 'structure'; $structIgnore = true; break; default: $state = 'start'; } break; case 'invoke': switch ($token[0]) { case T_WHITESPACE: case T_COMMENT: case T_DOC_COMMENT: break 2; default: $state = 'start'; } break; case 'before_structure': if ($token[0] == T_STRING) { $structName = $token[1]; $state = 'structure'; } break; case 'structure': switch ($token[0]) { case '{': case T_CURLY_OPEN: case T_DOLLAR_OPEN_CURLY_BRACES: $open++; break; case '}': if (--$open == 0) { if (! $structIgnore) { $structures[] = [ 'type' => $structType, 'name' => $structName, 'start' => $startLine, 'end' => $lastKnownLine, ]; } $structIgnore = false; $state = 'start'; } break; } break; } } $structures[] = [ 'type' => 'namespace', 'name' => $namespace, 'start' => $namespaceStartLine, 'end' => PHP_INT_MAX, 'classes' => $namespaceClasses, ]; static::$classes[$key] = $classes; static::$functions[$key] = $functions; static::$constants[$key] = $constants; static::$structures[$key] = $structures; } /** * Returns the namespace associated to the closure. * * @return string */ protected function getClosureNamespaceName() { $startLine = $this->getStartLine(); $endLine = $this->getEndLine(); foreach ($this->getStructures() as $struct) { if ($struct['type'] === 'namespace' && $struct['start'] <= $startLine && $struct['end'] >= $endLine ) { return $struct['name']; } } return ''; } /** * Parse the given token. * * @param string $token * @return array */ protected function parseNameQualified($token) { $pieces = explode('\\', $token); $id_start = array_shift($pieces); $id_start_ci = strtolower($id_start); $id_name = '\\'.implode('\\', $pieces); return [$id_start, $id_start_ci, $id_name]; } }
return spl_object_hash($argument); } return $argument; }, $callable instanceof Closure ? (new ReflectionClosure($callable))->getClosureUsedVariables() : [], ); $class = $callable instanceof Closure ? (new ReflectionClosure($callable))->getClosureCalledClass()?->getName() : null; $class ??= isset($trace[1]['class']) ? $trace[1]['class'] : null; * @param array<int, array<string, mixed>> $trace * @return static|null */ public static function tryFromTrace(array $trace, callable $callable) { if (! is_null($hash = static::hashFromTrace($trace, $callable))) { $object = static::objectFromTrace($trace); return new static($hash, $object, $callable); } } * @param callable(): TReturnType $callback * @return TReturnType */ function once(callable $callback) { $onceable = Onceable::tryFromTrace( debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2), $callback, ); return $onceable ? Once::instance()->value($onceable) : call_user_func($callback); * @param string $compiledPath * @return string|null */ protected function findCompiledView(string $compiledPath) { return once(fn () => $this->getKnownPaths())[$compiledPath] ?? null; } /** * Get the list of known paths from the compiler engine. * $exception = $previous; } $trace = (new Collection($exception->getTrace())) ->map(function ($frame) { if ($originalPath = $this->findCompiledView((string) Arr::get($frame, 'file', ''))) { $frame['file'] = $originalPath; $frame['line'] = $this->detectLineNumber($frame['file'], $frame['line']); } return $frame; public static function map(array $array, callable $callback) { $keys = array_keys($array); try { $items = array_map($callback, $array, $keys); } catch (ArgumentCountError) { $items = array_map($callback, $array); } return array_combine($keys, $items); * @param callable(TValue, TKey): TMapValue $callback * @return static<TKey, TMapValue> */ public function map(callable $callback) { return new static(Arr::map($this->items, $callback)); } /** * Run a dictionary map over the items. * $exception = $previous; } $trace = (new Collection($exception->getTrace())) ->map(function ($frame) { if ($originalPath = $this->findCompiledView((string) Arr::get($frame, 'file', ''))) { $frame['file'] = $originalPath; $frame['line'] = $this->detectLineNumber($frame['file'], $frame['line']); } * @param \Throwable $throwable * @return string */ public function render(Request $request, Throwable $throwable) { $flattenException = $this->bladeMapper->map( $this->htmlErrorRenderer->render($throwable), ); $exception = new Exception($flattenException, $request, $this->listener, $this->basePath); try { if (config('app.debug')) { if (app()->has(ExceptionRenderer::class)) { return $this->renderExceptionWithCustomRenderer($e); } elseif ($this->container->bound(Renderer::class)) { return $this->container->make(Renderer::class)->render(request(), $e); } } return $this->renderExceptionWithSymfony($e, config('app.debug')); } catch (Throwable $e) { * @return \Symfony\Component\HttpFoundation\Response */ protected function convertExceptionToResponse(Throwable $e) { return new SymfonyResponse( $this->renderExceptionContent($e), $this->isHttpException($e) ? $e->getStatusCode() : 500, $this->isHttpException($e) ? $e->getHeaders() : [] ); } * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse */ protected function prepareResponse($request, Throwable $e) { if (! $this->isHttpException($e) && config('app.debug')) { return $this->toIlluminateResponse($this->convertExceptionToResponse($e), $e)->prepare($request); } if (! $this->isHttpException($e)) { $e = new HttpException(500, $e->getMessage(), $e); } */ protected function renderExceptionResponse($request, Throwable $e) { return $this->shouldReturnJson($request, $e) ? $this->prepareJsonResponse($request, $e) : $this->prepareResponse($request, $e); } /** * Convert an authentication exception into a response. * return $this->finalizeRenderedResponse($request, match (true) { $e instanceof HttpResponseException => $e->getResponse(), $e instanceof AuthenticationException => $this->unauthenticated($request, $e), $e instanceof ValidationException => $this->convertValidationExceptionToResponse($e, $request), default => $this->renderExceptionResponse($request, $e), }, $e); } /** * Prepare the final, rendered response to be returned to the browser. $handler = $this->container->make(ExceptionHandler::class); $handler->report($e); $response = $handler->render($passable, $e); if (is_object($response) && method_exists($response, 'withException')) { $response->withException($e); } { return function ($passable) use ($destination) { try { return $destination($passable); } catch (Throwable $e) { return $this->handleException($passable, $e); } }; } /** Config::set('app.locale_source', 'system'); $user = $request->user(); if (! $user) { return $next($request); } $userLocale = $user->userlang ?? null; $useUserLocale = (bool) ($user->use_userlang ?? false); // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); App::setLocale($locale); // Можно установить и конфиг, если надо Config::set('app.locale', $locale); } return $next($request); }} // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); $user->setAttribute('last_seen_at', $now); } } } return $next($request); }} // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); } throw $exception; } return $next($request); }} // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); $this->isReading($request) || $this->runningUnitTests() || $this->inExceptArray($request) || $this->tokensMatch($request) ) { return tap($next($request), function ($response) use ($request) { if ($this->shouldAddXsrfTokenCookie()) { $this->addCookieToResponse($request, $response); } }); } // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); // Putting the errors in the view for every view allows the developer to just // assume that some errors are always available, which is convenient since // they don't have to continually run checks for the presence of errors. return $next($request); }} // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); $this->startSession($request, $session) ); $this->collectGarbage($session); $response = $next($request); $this->storeCurrentUrl($request, $session); $this->addCookieToResponse($response, $session); if ($this->manager->shouldBlock() || ($request->route() instanceof Route && $request->route()->locksFor())) { return $this->handleRequestWhileBlocking($request, $session, $next); } return $this->handleStatefulRequest($request, $session, $next); } /** * Handle the given request within session state. * // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $response = $next($request); foreach ($this->cookies->getQueuedCookies() as $cookie) { $response->headers->setCookie($cookie); } // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); * @param \Closure $next * @return \Symfony\Component\HttpFoundation\Response */ public function handle($request, Closure $next) { return $this->encrypt($next($this->decrypt($request))); } /** * Decrypt the cookies on the request. * // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); ); try { return $this->withinTransaction !== false ? $this->getContainer()->make('db')->connection($this->withinTransaction)->transaction(fn () => $pipeline($this->passable)) : $pipeline($this->passable); } finally { if ($this->finally) { ($this->finally)($this->passable); } } $middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route); return (new Pipeline($this->container)) ->send($request) ->through($middleware) ->then(fn ($request) => $this->prepareResponse( $request, $route->run() )); } /** $request->setRouteResolver(fn () => $route); $this->events->dispatch(new RouteMatched($route, $request)); return $this->prepareResponse($request, $this->runRouteWithinStack($route, $request) ); } /** * Run the given route within a Stack "onion" instance. * @param \Illuminate\Http\Request $request * @return \Symfony\Component\HttpFoundation\Response */ public function dispatchToRoute(Request $request) { return $this->runRoute($request, $this->findRoute($request)); } /** * Find the route matching a given request. * */ public function dispatch(Request $request) { $this->currentRequest = $request; return $this->dispatchToRoute($request); } /** * Dispatch the request to a route and return the response. * protected function dispatchToRouter() { return function ($request) { $this->app->instance('request', $request); return $this->router->dispatch($request); }; } /** * Call the terminate method on any terminable middleware. */ protected function prepareDestination(Closure $destination) { return function ($passable) use ($destination) { try { return $destination($passable); } catch (Throwable $e) { return $this->handleException($passable, $e); } }; } */ public function handle($request, Closure $next) { $this->clean($request); return $next($request); } /** * Clean the request's data. * if ($callback($request)) { return $next($request); } } return parent::handle($request, $next); } /** * Transform the given value. * // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); */ public function handle($request, Closure $next) { $this->clean($request); return $next($request); } /** * Clean the request's data. * if ($callback($request)) { return $next($request); } } return parent::handle($request, $next); } /** * Transform the given value. * // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); if ($max > 0 && $request->server('CONTENT_LENGTH') > $max) { throw new PostTooLargeException('The POST data is too large.'); } return $next($request); } /** * Determine the server 'post_max_size' as bytes. * // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); null, $this->getHeaders($data) ); } return $next($request); } /** * Determine if the incoming request has a maintenance mode bypass cookie. * // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); * @return \Illuminate\Http\Response */ public function handle($request, Closure $next) { if (! $this->hasMatchingPath($request)) { return $next($request); } $this->cors->setOptions($this->container['config']->get('cors', [])); if ($this->cors->isPreflightRequest($request)) { // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); { $request::setTrustedProxies([], $this->getTrustedHeaderNames()); $this->setTrustedProxyIpAddresses($request); return $next($request); } /** * Sets the trusted proxies on the request. * // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); * @param \Closure $next * @return \Symfony\Component\HttpFoundation\Response */ public function handle(Request $request, Closure $next) { return $next($request); } /** * Invoke the deferred callbacks. * // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); if (! mb_check_encoding($decodedPath, 'UTF-8')) { throw new MalformedUrlException; } return $next($request); }} // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); $normalizedPath = $trimmedPath; } } if ($normalizedPath === $path) { return $next($request); } $query = parse_url($requestUri, PHP_URL_QUERY); $normalizedUri = $normalizedPath . ($query ? '?' . $query : ''); // since the object we're given was already a fully instantiated object. $parameters = [$passable, $stack]; } $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters); return $this->handleCarry($carry); } catch (Throwable $e) { return $this->handleException($passable, $e); ); try { return $this->withinTransaction !== false ? $this->getContainer()->make('db')->connection($this->withinTransaction)->transaction(fn () => $pipeline($this->passable)) : $pipeline($this->passable); } finally { if ($this->finally) { ($this->finally)($this->passable); } } $this->bootstrap(); return (new Pipeline($this->app)) ->send($request) ->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware) ->then($this->dispatchToRouter()); } /** * Bootstrap the application for HTTP requests. * $this->requestStartedAt = Carbon::now(); try { $request->enableHttpMethodParameterOverride(); $response = $this->sendRequestThroughRouter($request); } catch (Throwable $e) { $this->reportException($e); $response = $this->renderException($request, $e); } */ public function handleRequest(Request $request) { $kernel = $this->make(HttpKernelContract::class); $response = $kernel->handle($request)->send(); $kernel->terminate($request, $response); } /**// Register the Composer autoloader...require __DIR__.'/vendor/autoload.php';$app = require_once __DIR__.'/bootstrap/app.php';$app->handleRequest(Request::capture());|
Error
|
|---|
Error:
Class "Laravel\SerializableClosure\Support\ReflectionClosure" not found
at /home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Support/Onceable.php:76
at Illuminate\Support\Onceable::hashFromTrace()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Support/Onceable.php:34)
at Illuminate\Support\Onceable::tryFromTrace()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Support/helpers.php:250)
at once()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Renderer/Mappers/BladeMapper.php:110)
at Illuminate\Foundation\Exceptions\Renderer\Mappers\BladeMapper->findCompiledView()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Renderer/Mappers/BladeMapper.php:91)
at Illuminate\Foundation\Exceptions\Renderer\Mappers\BladeMapper->{closure:Illuminate\Foundation\Exceptions\Renderer\Mappers\BladeMapper::map():90}()
at array_map()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Collections/Arr.php:788)
at Illuminate\Support\Arr::map()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Collections/Collection.php:814)
at Illuminate\Support\Collection->map()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Renderer/Mappers/BladeMapper.php:90)
at Illuminate\Foundation\Exceptions\Renderer\Mappers\BladeMapper->map()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Renderer/Renderer.php:87)
at Illuminate\Foundation\Exceptions\Renderer\Renderer->render()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:879)
at Illuminate\Foundation\Exceptions\Handler->renderExceptionContent()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:860)
at Illuminate\Foundation\Exceptions\Handler->convertExceptionToResponse()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:839)
at Illuminate\Foundation\Exceptions\Handler->prepareResponse()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:738)
at Illuminate\Foundation\Exceptions\Handler->renderExceptionResponse()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:626)
at Illuminate\Foundation\Exceptions\Handler->render()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:51)
at Illuminate\Routing\Pipeline->handleException()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:182)
at Illuminate\Pipeline\Pipeline->{closure:Illuminate\Pipeline\Pipeline::prepareDestination():178}()
(/home/srv83227/domains/asted.cloud/public_html/app/Http/Middleware/SetLocaleFromUserPreference.php:21)
at App\Http\Middleware\SetLocaleFromUserPreference->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/app/Http/Middleware/SetLocaleFromSubdomain.php:23)
at App\Http\Middleware\SetLocaleFromSubdomain->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/app/Http/Middleware/UpdateUserLastSeenAt.php:45)
at App\Http\Middleware\UpdateUserLastSeenAt->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php:50)
at Illuminate\Routing\Middleware\SubstituteBindings->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php:87)
at Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php:48)
at Illuminate\View\Middleware\ShareErrorsFromSession->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:120)
at Illuminate\Session\Middleware\StartSession->handleStatefulRequest()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:63)
at Illuminate\Session\Middleware\StartSession->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php:36)
at Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:74)
at Illuminate\Cookie\Middleware\EncryptCookies->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:137)
at Illuminate\Pipeline\Pipeline->then()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php:821)
at Illuminate\Routing\Router->runRouteWithinStack()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php:800)
at Illuminate\Routing\Router->runRoute()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php:764)
at Illuminate\Routing\Router->dispatchToRoute()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php:753)
at Illuminate\Routing\Router->dispatch()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:200)
at Illuminate\Foundation\Http\Kernel->{closure:Illuminate\Foundation\Http\Kernel::dispatchToRouter():197}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)
at Illuminate\Pipeline\Pipeline->{closure:Illuminate\Pipeline\Pipeline::prepareDestination():178}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21)
at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php:31)
at Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21)
at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php:51)
at Illuminate\Foundation\Http\Middleware\TrimStrings->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php:27)
at Illuminate\Http\Middleware\ValidatePostSize->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php:109)
at Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php:48)
at Illuminate\Http\Middleware\HandleCors->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php:58)
at Illuminate\Http\Middleware\TrustProxies->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/InvokeDeferredCallbacks.php:22)
at Illuminate\Foundation\Http\Middleware\InvokeDeferredCallbacks->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePathEncoding.php:26)
at Illuminate\Http\Middleware\ValidatePathEncoding->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/app/Http/Middleware/NormalizeRequestPath.php:50)
at App\Http\Middleware\NormalizeRequestPath->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:219)
at Illuminate\Pipeline\Pipeline->{closure:{closure:Illuminate\Pipeline\Pipeline::carry():194}:195}()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:137)
at Illuminate\Pipeline\Pipeline->then()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:175)
at Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:144)
at Illuminate\Foundation\Http\Kernel->handle()
(/home/srv83227/domains/asted.cloud/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:1220)
at Illuminate\Foundation\Application->handleRequest()
(/home/srv83227/domains/asted.cloud/public_html/index.php:18)
|