Symfony Exception

InvalidArgumentException

HTTP 500 Internal Server Error

Invalid category parameter

Exception

InvalidArgumentException

in classes/Link.php (line 448)
  1.         } elseif (is_array($category) && isset($category['id_category'])) {
  2.             $params['id'] = $category['id_category'];
  3.         } elseif (is_int($category) || (is_string($category) && ctype_digit($category))) {
  4.             $params['id'] = (int) $category;
  5.         } else {
  6.             throw new \InvalidArgumentException('Invalid category parameter');
  7.         }
  8.         if ((int) $params['id'] === 0) {
  9.             Tools::displayAsDeprecated('Generating URL with id 0 is deprecated');
  10.         }
LinkCore->getCategoryLink() in override/controllers/front/listing/CategoryController.php (line 118)
  1.         return $this->addPageMetaDescription(str_replace("%synonymous%"$synonymousstr_replace("%category%"$category->name$pattern)));
  2.     }
  3.     public function getCanonicalURL()
  4.     {
  5.         $canonicalUrl $this->context->link->getCategoryLink($this->category);
  6.         $parsedUrl parse_url($canonicalUrl);
  7.         if (isset($parsedUrl['query'])) {
  8.             parse_str($parsedUrl['query'], $params);
  9.         } else {
  10.             $params = [];
CategoryController->getCanonicalURL() in classes/controller/FrontController.php (line 1762)
  1.             'page-customer-account' => false,
  2.         ];
  3.         $page = [
  4.             'title' => '',
  5.             'canonical' => $this->getCanonicalURL(),
  6.             'meta' => [
  7.                 'title' => $meta_tags['meta_title'],
  8.                 'description' => $meta_tags['meta_description'],
  9.                 'keywords' => $meta_tags['meta_keywords'],
  10.                 'robots' => 'index',
FrontControllerCore->getTemplateVarPage() in override/classes/controller/FrontController.php (line 707)
  1.         return $shop;
  2.     }
  3.     public function getTemplateVarPage() {
  4.         $page parent::getTemplateVarPage();
  5.         $page['current_controller'] = get_class($this);
  6.         $jsCore$this->getJavascript();
  7.         $this->context->smarty->assign([
  8.             'jsCore' => $jsCore
  9.             ]);
FrontController->getTemplateVarPage() in controllers/front/listing/CategoryController.php (line 271)
  1.         return $this->category;
  2.     }
  3.     public function getTemplateVarPage()
  4.     {
  5.         $page parent::getTemplateVarPage();
  6.         if ($this->notFound) {
  7.             $page['page_name'] = 'pagenotfound';
  8.             $page['body_classes']['pagenotfound'] = true;
  9.             $page['title'] = $this->trans('The page you are looking for was not found.', [], 'Shop.Theme.Global');
CategoryControllerCore->getTemplateVarPage() in override/controllers/front/listing/CategoryController.php (line 58)
  1.         return $this->category->name;
  2.     }
  3.     public function getTemplateVarPage()
  4.     {
  5.         $page parent::getTemplateVarPage();
  6.         if (!Validate::isLoadedObject($this->category)) {
  7.             $this->category = new Category(
  8.                 (int)Tools::getValue('id_category'),
  9.                 $this->context->language->id
CategoryController->getTemplateVarPage() in override/classes/controller/FrontController.php (line 463)
  1.         $templateVars = [
  2.                 'pscheckoutEnabled' => $this->getPsCheckoutEnable(),
  3.             'currency' => $this->getTemplateVarCurrency(),
  4.             'customer' => $this->getTemplateVarCustomer(),
  5.             'language' => $this->objectPresenter->present($this->context->language),
  6.             'page' => $this->getTemplateVarPage(),
  7.             'shop' => $this->getTemplateVarShop(),
  8.             'shop_id'=> $this->context->shop->id,
  9.             'urls' => $this->getTemplateVarUrls(),
  10.             'configuration' => $this->getTemplateVarConfiguration(),
  11.             'field_required' => $this->context->customer->validateFieldsRequiredDatabase(),
FrontController->assignGeneralPurposeVariables() in classes/controller/FrontController.php (line 569)
  1.     /**
  2.      * Initializes common front page content: header, footer and side columns.
  3.      */
  4.     public function initContent()
  5.     {
  6.         $this->assignGeneralPurposeVariables();
  7.         $this->process();
  8.         if (!isset($this->context->cart)) {
  9.             $this->context->cart = new Cart();
  10.         }
FrontControllerCore->initContent() in controllers/front/listing/CategoryController.php (line 128)
  1.     /**
  2.      * {@inheritdoc}
  3.      */
  4.     public function initContent()
  5.     {
  6.         parent::initContent();
  7.         if (
  8.             Validate::isLoadedObject($this->category)
  9.             && $this->category->active
  10.             && $this->category->checkAccess($this->context->customer->id)
CategoryControllerCore->initContent() in classes/controller/Controller.php (line 319)
  1.             if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
  2.                 $this->initHeader();
  3.             }
  4.             if ($this->viewAccess()) {
  5.                 $this->initContent();
  6.             } else {
  7.                 $this->errors[] = $this->trans('Access denied.', [], 'Admin.Notifications.Error');
  8.             }
  9.             if (!$this->content_only && ($this->display_footer || (isset($this->className) && $this->className))) {
ControllerCore->run() in classes/Dispatcher.php (line 510)
  1.             // Execute hook dispatcher
  2.             Hook::exec('actionDispatcher'$params_hook_action_dispatcher);
  3.             // Running controller
  4.             $controller->run();
  5.             // Execute hook dispatcher after
  6.             Hook::exec('actionDispatcherAfter'$params_hook_action_dispatcher);
  7.         } catch (PrestaShopException $e) {
  8.             $e->displayMessage();
DispatcherCore->dispatch() in index.php/ (line 58)
  1.     if (!headers_sent()) {
  2.         header('Content-Type: text/html; charset=utf-8');
  3.     }
  4.     // Prepare and trigger LEGACY admin dispatcher
  5.     Dispatcher::getInstance()->dispatch();
  6. }

Logs 2

Level Channel Message
INFO 08:45:08 php User Deprecated: The "Symfony\Component\Debug\DebugClassLoader" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\DebugClassLoader" instead.
{
    "exception": {}
}
INFO 08:45:08 php User Deprecated: Since api-platform/core 2.7: The service "ApiPlatform\Core\Bridge\Symfony\Routing\IriConverter" is deprecated, use ApiPlatform\Symfony\Routing\IriConverter instead.
{
    "exception": {}
}
INFO 08:45:08 php User Deprecated: The "$name" argument in method "Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector::__construct()" is deprecated since Symfony 4.2.
{
    "exception": {}
}
INFO 08:45:08 php User Deprecated: The "$version" argument in method "Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector::__construct()" is deprecated since Symfony 4.2.
{
    "exception": {}
}
INFO 08:45:08 php User Deprecated: __construct is deprecated since version 8.1 and will be removed in the next major version.
{
    "exception": {}
}
INFO 08:45:08 php User Deprecated: The "Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent::getException()" method is deprecated since Symfony 4.4, use "getThrowable()" instead.
{
    "exception": {}
}
CRITICAL 08:45:08 request Uncaught PHP Exception InvalidArgumentException: "Invalid category parameter" at /var/www/perfumeriajulia.es/classes/Link.php line 448
{
    "exception": {}
}
CRITICAL 08:45:08 php Uncaught Exception: Invalid category parameter
{
    "exception": {}
}

Stack Trace

InvalidArgumentException

InvalidArgumentException:
Invalid category parameter

  at classes/Link.php:448
  at LinkCore->getCategoryLink()
     (override/controllers/front/listing/CategoryController.php:118)
  at CategoryController->getCanonicalURL()
     (classes/controller/FrontController.php:1762)
  at FrontControllerCore->getTemplateVarPage()
     (override/classes/controller/FrontController.php:707)
  at FrontController->getTemplateVarPage()
     (controllers/front/listing/CategoryController.php:271)
  at CategoryControllerCore->getTemplateVarPage()
     (override/controllers/front/listing/CategoryController.php:58)
  at CategoryController->getTemplateVarPage()
     (override/classes/controller/FrontController.php:463)
  at FrontController->assignGeneralPurposeVariables()
     (classes/controller/FrontController.php:569)
  at FrontControllerCore->initContent()
     (controllers/front/listing/CategoryController.php:128)
  at CategoryControllerCore->initContent()
     (classes/controller/Controller.php:319)
  at ControllerCore->run()
     (classes/Dispatcher.php:510)
  at DispatcherCore->dispatch()
     (index.php/:58)