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_BOOLEAN) && 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]; } /** * {@inheritdoc} */ public function getBag(string $name) { $bag = $this->storage->getBag($name); return method_exists($bag, 'getBag') ? $bag->getBag() : $bag; } /** * @return AttributeBagInterface */ protected function getSessionBag(): AttributeBagInterface { /** @var AttributeBagInterface $sessionBag */ $sessionBag = $this->session->getBag(SessionConfigurator::ATTRIBUTE_BAG_ENVIRONMENT); return $sessionBag; }} //if the session was not explicitly started in cli environment, do nothing if ('cli' === php_sapi_name() && !$this->session->isStarted()) { return; } $sessionBag = $this->getSessionBag(); $this->customItems = $sessionBag->get(self::SESSION_KEY_CUSTOM_ITEMS, []); $this->userId = $sessionBag->get(self::SESSION_KEY_USERID, self::USER_ID_NOT_SET); * * @return string */ public function getCurrentAssortmentTenant() { $this->load(); return $this->currentAssortmentTenant; } /** * @throws WorkerNotFoundException */ protected function resolveTenantWorker(string $tenant = null): WorkerInterface { if (null === $tenant) { $tenant = $this->environment->getCurrentAssortmentTenant(); } if ($tenant) { if (!array_key_exists($tenant, $this->tenantWorkers)) { throw new WorkerNotFoundException(sprintf('Tenant "%s" doesn\'t exist', $tenant)); return $this->getCurrentTenantWorker()->getTenantConfig(); } public function getCurrentTenantWorker(): WorkerInterface { return $this->resolveTenantWorker(); } public function getProductListForCurrentTenant(): ProductListInterface { $tenantWorker = $this->getCurrentTenantWorker(); return $this->resolveTenantWorker(); } public function getProductListForCurrentTenant(): ProductListInterface { $tenantWorker = $this->getCurrentTenantWorker(); return $tenantWorker->getProductList(); } public function getProductListForTenant(string $tenant): ProductListInterface $catId = null;
if(!empty($request->get('url')) && empty($get_param)){
$catId = (string)$this->getCategoryId($request->get('url'));
}
$indexService = $ecommerceFactory->getIndexService();
$productListing = $indexService->getProductListForCurrentTenant();
$productListing->addCondition("o_parentId != 74");
if($query){
$productListing->addCondition("name LIKE '%{$query}%'");
}
if(!empty($request->get('url')) && !empty($brand)){
$this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS); $controller = $event->getController(); $arguments = $event->getArguments(); // call controller $response = $controller(...$arguments); // view if (!$response instanceof Response) { $event = new ViewEvent($this, $request, $type, $response); $this->dispatcher->dispatch($event, KernelEvents::VIEW); { $request->headers->set('X-Php-Ob-Level', (string) ob_get_level()); $this->requestStack->push($request); try { return $this->handleRaw($request, $type); } catch (\Exception $e) { if ($e instanceof RequestExceptionInterface) { $e = new BadRequestHttpException($e->getMessage(), $e); } if (false === $catch) { $this->boot(); ++$this->requestStackSize; $this->resetServices = true; try { return $this->getHttpKernel()->handle($request, $type, $catch); } finally { --$this->requestStackSize; } }$kernel = \Pimcore\Bootstrap::kernel();
// reset current request - will be read from request stack from now on
Tool::setCurrentRequest(null);
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
No log messages
|
RuntimeException
|
|---|
RuntimeException:
Failed to start the session because headers have already been sent by "/var/www/goodycs/src/Controller/Products/categoryController.php" at line 523.
at vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php:145
at Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start()
(vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php:352)
at Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->getBag('ecommerceframework_environment')
(vendor/symfony/http-foundation/Session/Session.php:261)
at Symfony\Component\HttpFoundation\Session\Session->getBag('ecommerceframework_environment')
(vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/SessionEnvironment.php:129)
at Pimcore\Bundle\EcommerceFrameworkBundle\SessionEnvironment->getSessionBag()
(vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/SessionEnvironment.php:67)
at Pimcore\Bundle\EcommerceFrameworkBundle\SessionEnvironment->load()
(vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/Environment.php:241)
at Pimcore\Bundle\EcommerceFrameworkBundle\Environment->getCurrentAssortmentTenant()
(vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/IndexService/IndexService.php:275)
at Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\IndexService->resolveTenantWorker()
(vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/IndexService/IndexService.php:246)
at Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\IndexService->getCurrentTenantWorker()
(vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/IndexService/IndexService.php:251)
at Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\IndexService->getProductListForCurrentTenant()
(src/Controller/Products/categoryController.php:53)
at App\Controller\Products\categoryController->categoryProductAction(object(Request), object(Translator), object(Factory), object(ListHelper), object(Paginator))
(vendor/symfony/http-kernel/HttpKernel.php:163)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor/symfony/http-kernel/HttpKernel.php:75)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor/symfony/http-kernel/Kernel.php:202)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(public/index.php:35)
|