Skip to content

Magento\Customer\Model\Account\Redirect::setRedirectCookie() not properly working #24547

Closed
@nikoskip

Description

@nikoskip

Preconditions (*)

  1. Magento 2.3.2

Steps to reproduce (*)

Call method Magento\Customer\Model\Account\Redirect::setRedirectCookie()

$this->accountRedirect->setRedirectCookie($this->urlBuilder->getUrl('checkout'));

Expected result (*)

Cookie login_redirect created

Actual result (*)

The cookie is sent to the browser, but not properly. All the cookie params are missing.

image

Additional information

I checked the code and the problem is that the method setPublicCookie needs to include a PublicCookieMetadata instance as third param.

<?php
// vendor/magento/module-customer/Model/Account/Redirect.php:280
/**
     * Save redirect route to cookie for case of successful login/registration
     *
     * @param string $route
     * @return void
     */
    public function setRedirectCookie($route)
    {
        $this->getCookieManager()->setPublicCookie(self::LOGIN_REDIRECT_URL, $route);
    }

Indeed maybe setPublicCookie should require $metadata as mandatory. Why someone would need to create a cookie without params?

Metadata

Metadata

Assignees

Labels

Component: CookieFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions