if (\PHP_SESSION_ACTIVE === session_status()) { throw new \RuntimeException('Failed to start the session: already started by PHP.'); } if (filter_var(\ini_get('session.use_cookies'), \FILTER_VALIDATE_BOOL) && headers_sent($file, $line)) { throw new \RuntimeException(sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line)); } $sessionId = $_COOKIE[session_name()] ?? null; /* * Explanation of the session ID regular expression: `/^[a-zA-Z0-9,-]{22,250}$/`. } if (!$this->started && $this->saveHandler->isActive()) { $this->loadSession(); } elseif (!$this->started) { $this->start(); } return $this->bags[$name]; } $this->storage->registerBag(new SessionBagProxy($bag, $this->data, $this->usageIndex, $this->usageReporter)); } public function getBag(string $name): SessionBagInterface { $bag = $this->storage->getBag($name); return method_exists($bag, 'getBag') ? $bag->getBag() : $bag; } /** * * Note that this method was added to help with IDE autocompletion. */ private function getAttributeBag(): AttributeBagInterface { return $this->getBag($this->attributeName); }} return $this->storage->start(); } public function has(string $name): bool { return $this->getAttributeBag()->has($name); } public function get(string $name, mixed $default = null): mixed { return $this->getAttributeBag()->get($name, $default); } public function hasForChannel(ChannelInterface $channel): bool { try { return SessionProvider::getSession($this->requestStackOrSession)->has($this->getCartKeyName($channel)); } catch (SessionNotFoundException) { return false; } } } catch (ChannelNotFoundException $exception) { throw new CartNotFoundException(null, $exception); } Assert::isInstanceOf($channel, ChannelInterface::class); if (!$this->cartStorage->hasForChannel($channel)) { throw new CartNotFoundException('Sylius was not able to find the cart in session'); } $cart = $this->cartStorage->getForChannel($channel); if (null === $cart) { public function getCart(): OrderInterface { foreach ($this->cartContexts as $cartContext) { try { return $cartContext->getCart(); } catch (CartNotFoundException) { continue; } } return; } try { /** @var OrderInterface $cart */ $cart = $this->cartContext->getCart(); $itemsData = $cart->getItems()->map(static function (OrderItemInterface $item): array { $variant = $item->getVariant(); $product = $variant->getProduct(); } $response->headers->set('X-Debug-Token', $profile->getToken()); foreach ($this->collectors as $collector) { $collector->collect($request, $response, $exception); // we need to clone for sub-requests $profile->addCollector(clone $collector); } $usageIndexValue = $usageIndexReference = &$session->getUsageIndex(); $usageIndexReference = \PHP_INT_MIN; } try { if (!$profile = $this->profiler->collect($request, $event->getResponse(), $exception)) { return; } } finally { if ($session instanceof Session) { $usageIndexReference = $usageIndexValue; $this->priority ??= $dispatcher->getListenerPriority($eventName, $this->listener); $e = $this->stopwatch->start($this->name, 'event_listener'); try { ($this->optimizedListener ?? $this->listener)($event, $eventName, $dispatcher); } finally { if ($e->isStarted()) { $e->stop(); } } foreach ($listeners as $listener) { if ($stoppable && $event->isPropagationStopped()) { break; } $listener($event, $eventName, $this); } } /** * Sorts the internal list of listeners for the given event by priority. } else { $listeners = $this->getListeners($eventName); } if ($listeners) { $this->callListeners($listeners, $eventName, $event); } return $event; } try { $this->beforeDispatch($eventName, $event); try { $e = $this->stopwatch->start($eventName, 'section'); try { $this->dispatcher->dispatch($event, $eventName); } finally { if ($e->isStarted()) { $e->stop(); } } */ private function filterResponse(Response $response, Request $request, int $type): Response { $event = new ResponseEvent($this, $request, $type, $response); $this->dispatcher->dispatch($event, KernelEvents::RESPONSE); $this->finishRequest($request, $type); return $event->getResponse(); } throw new ControllerDoesNotReturnResponseException($msg, $controller, __FILE__, __LINE__ - 17); } } return $this->filterResponse($response, $request, $type); } /** * Filters a response object. * $request->headers->set('X-Php-Ob-Level', (string) ob_get_level()); $this->requestStack->push($request); $response = null; try { return $response = $this->handleRaw($request, $type); } catch (\Throwable $e) { if ($e instanceof \Error && !$this->handleAllThrowables) { throw $e; } } $request = $this->duplicateRequest($throwable, $event->getRequest()); try { $response = $event->getKernel()->handle($request, HttpKernelInterface::SUB_REQUEST, false); } catch (\Exception $e) { $f = FlattenException::createFromThrowable($e); $this->logException($e, sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', $f->getClass(), $f->getMessage(), basename($e->getFile()), $e->getLine())); public function onKernelException(ExceptionEvent $event, ?string $eventName = null, ?EventDispatcherInterface $eventDispatcher = null): void { try { /** @phpstan-ignore-next-line */ $this->decoratedListener->onKernelException($event, $eventName, $eventDispatcher); } catch (\Throwable $throwable) { $this->breakCircularDependency($throwable); throw $throwable; } $this->priority ??= $dispatcher->getListenerPriority($eventName, $this->listener); $e = $this->stopwatch->start($this->name, 'event_listener'); try { ($this->optimizedListener ?? $this->listener)($event, $eventName, $dispatcher); } finally { if ($e->isStarted()) { $e->stop(); } } foreach ($listeners as $listener) { if ($stoppable && $event->isPropagationStopped()) { break; } $listener($event, $eventName, $this); } } /** * Sorts the internal list of listeners for the given event by priority. } else { $listeners = $this->getListeners($eventName); } if ($listeners) { $this->callListeners($listeners, $eventName, $event); } return $event; } try { $this->beforeDispatch($eventName, $event); try { $e = $this->stopwatch->start($eventName, 'section'); try { $this->dispatcher->dispatch($event, $eventName); } finally { if ($e->isStarted()) { $e->stop(); } } * Handles a throwable by trying to convert it to a Response. */ private function handleThrowable(\Throwable $e, Request $request, int $type): Response { $event = new ExceptionEvent($this, $request, $type, $e); $this->dispatcher->dispatch($event, KernelEvents::EXCEPTION); // a listener might have replaced the exception $e = $event->getThrowable(); if (!$event->hasResponse()) { if ($pop = $request !== $this->requestStack->getMainRequest()) { $this->requestStack->push($request); } try { $response = $this->handleThrowable($exception, $request, self::MAIN_REQUEST); } finally { if ($pop) { $this->requestStack->pop(); } } if ($hasRun) { throw $e; } $hasRun = true; $kernel->terminateWithException($e, $request); }; } } elseif ($event instanceof ConsoleEvent && $app = $event->getCommand()->getApplication()) { $output = $event->getOutput(); if ($output instanceof ConsoleOutputInterface) { $this->exceptionHandler = null; } try { if (null !== $exceptionHandler) { $exceptionHandler($exception); return; } $handlerException ??= $exception; } catch (\Throwable $handlerException) { } try { if (null !== $fatalError) { self::$exitCode = 255; $handler->handleException($fatalError); } } catch (FatalError) { // Ignore this re-throw } if (function_exists('imageantialias')) { imageantialias($resource, true); } $transparent = imagecolorallocatealpha($resource, 255, 255, 255, 127); imagefill($resource, 0, 0, $transparent); imagecolortransparent($resource, $transparent); return $resource; }|
[2/2]
RuntimeException
|
|---|
RuntimeException:
Failed to start the session because headers have already been sent by "/var/lib/data/www/ppsylius/www/vendor/imagine/imagine/src/Gd/Image.php" at line 795.
at /var/lib/data/www/ppsylius/www/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php:132
at Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start()
(/var/lib/data/www/ppsylius/www/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php:311)
at Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->getBag()
(/var/lib/data/www/ppsylius/www/vendor/symfony/http-foundation/Session/Session.php:222)
at Symfony\Component\HttpFoundation\Session\Session->getBag()
(/var/lib/data/www/ppsylius/www/vendor/symfony/http-foundation/Session/Session.php:242)
at Symfony\Component\HttpFoundation\Session\Session->getAttributeBag()
(/var/lib/data/www/ppsylius/www/vendor/symfony/http-foundation/Session/Session.php:64)
at Symfony\Component\HttpFoundation\Session\Session->has()
(/var/lib/data/www/ppsylius/www/vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/Storage/CartSessionStorage.php:48)
at Sylius\Bundle\CoreBundle\Storage\CartSessionStorage->hasForChannel()
(/var/lib/data/www/ppsylius/www/vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/Context/SessionAndChannelBasedCartContext.php:40)
at Sylius\Bundle\CoreBundle\Context\SessionAndChannelBasedCartContext->getCart()
(/var/lib/data/www/ppsylius/www/vendor/sylius/sylius/src/Sylius/Component/Order/Context/CompositeCartContext.php:38)
at Sylius\Component\Order\Context\CompositeCartContext->getCart()
(/var/lib/data/www/ppsylius/www/vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/Collector/CartCollector.php:87)
at Sylius\Bundle\CoreBundle\Collector\CartCollector->collect()
(/var/lib/data/www/ppsylius/www/vendor/symfony/http-kernel/Profiler/Profiler.php:169)
at Symfony\Component\HttpKernel\Profiler\Profiler->collect()
(/var/lib/data/www/ppsylius/www/vendor/symfony/http-kernel/EventListener/ProfilerListener.php:108)
at Symfony\Component\HttpKernel\EventListener\ProfilerListener->onKernelResponse()
(/var/lib/data/www/ppsylius/www/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:116)
at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke()
(/var/lib/data/www/ppsylius/www/vendor/symfony/event-dispatcher/EventDispatcher.php:220)
at Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
(/var/lib/data/www/ppsylius/www/vendor/symfony/event-dispatcher/EventDispatcher.php:56)
at Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
(/var/lib/data/www/ppsylius/www/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:139)
at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch()
(/var/lib/data/www/ppsylius/www/vendor/symfony/http-kernel/HttpKernel.php:214)
at Symfony\Component\HttpKernel\HttpKernel->filterResponse()
(/var/lib/data/www/ppsylius/www/vendor/symfony/http-kernel/HttpKernel.php:202)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
(/var/lib/data/www/ppsylius/www/vendor/symfony/http-kernel/HttpKernel.php:76)
at Symfony\Component\HttpKernel\HttpKernel->handle()
(/var/lib/data/www/ppsylius/www/vendor/symfony/http-kernel/EventListener/ErrorListener.php:117)
at Symfony\Component\HttpKernel\EventListener\ErrorListener->onKernelException()
(/var/lib/data/www/ppsylius/www/vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/EventListener/CircularDependencyBreakingErrorListener.php:63)
at Sylius\Bundle\CoreBundle\EventListener\CircularDependencyBreakingErrorListener->onKernelException()
(/var/lib/data/www/ppsylius/www/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:116)
at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke()
(/var/lib/data/www/ppsylius/www/vendor/symfony/event-dispatcher/EventDispatcher.php:220)
at Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
(/var/lib/data/www/ppsylius/www/vendor/symfony/event-dispatcher/EventDispatcher.php:56)
at Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
(/var/lib/data/www/ppsylius/www/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:139)
at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch()
(/var/lib/data/www/ppsylius/www/vendor/symfony/http-kernel/HttpKernel.php:239)
at Symfony\Component\HttpKernel\HttpKernel->handleThrowable()
(/var/lib/data/www/ppsylius/www/vendor/symfony/http-kernel/HttpKernel.php:132)
at Symfony\Component\HttpKernel\HttpKernel->terminateWithException()
(/var/lib/data/www/ppsylius/www/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php:84)
at Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::Symfony\Component\HttpKernel\EventListener\{closure}()
(/var/lib/data/www/ppsylius/www/vendor/symfony/error-handler/ErrorHandler.php:538)
at Symfony\Component\ErrorHandler\ErrorHandler->handleException()
(/var/lib/data/www/ppsylius/www/vendor/symfony/error-handler/ErrorHandler.php:634)
at Symfony\Component\ErrorHandler\ErrorHandler::handleFatalError()
|
|
[1/2]
OutOfMemoryError
|
|---|
Symfony\Component\ErrorHandler\Error\OutOfMemoryError: Error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 176556561 bytes) at /var/lib/data/www/ppsylius/www/vendor/imagine/imagine/src/Gd/Image.php:795 |