Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.1 Fix cookie deletion behavior #1984

Merged
merged 2 commits into from
Jan 20, 2022
Merged

PHP 8.1 Fix cookie deletion behavior #1984

merged 2 commits into from
Jan 20, 2022

Conversation

Sdfendor
Copy link
Contributor

@Sdfendor Sdfendor commented Jan 20, 2022

Description (*)

As described in the corresponding issue internal function setcookie only excepts string as value parameter and PHP 8.1 emits decription error (if not ignored by OpenMage) in case null is passed.
While the prior way of using null still works (but with deprecation error) the_ correct way to delete the cookie is using an empty string as value. PHP internally changes the value to deleted which is sent in the response header. It's not necessary to pass anything else like a period that lies in the past (using negative value when calling set method of cookie model).

Fixed Issues (if relevant)

  1. Fixes PHP 8.1 Issue with the way deleting cookies is done in Mage_Core_Model_Cookie #1958

Manual testing scenarios (*)

  1. Log into Admin area
  2. Immediately log out and observe the response header
  3. Find a Set-Cookie field with adminhtml=deleted

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)

…lete cookie to comply with type of internal function "setcookie".
@github-actions github-actions bot added the Component: Core Relates to Mage_Core label Jan 20, 2022
elidrissidev
elidrissidev previously approved these changes Jan 20, 2022
Copy link
Member

@elidrissidev elidrissidev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. PHP 8.1 seems to have deprecated passing null to non-nullable parameters for all internal functions, so I guess this error may be occurring in a lot of other areas.

@Sdfendor
Copy link
Contributor Author

Sdfendor commented Jan 20, 2022

@elidrissidev You are right with this assumption. #1812 does a lot of work in this direction and I'm currently working through OpenMage with PHP 8.1 myself.

@Flyingmana Flyingmana merged commit 87a6a56 into OpenMage:1.9.4.x Jan 20, 2022
@github-actions
Copy link
Contributor

Unit Test Results

1 files  ±0  1 suites  ±0   0s ⏱️ ±0s
0 tests ±0  0 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
7 runs  ±0  5 ✔️ ±0  2 💤 ±0  0 ❌ ±0 

Results for commit 87a6a56. ± Comparison against base commit 3486d5a.

@Sdfendor Sdfendor deleted the change_delete_cookie_behavior branch January 28, 2022 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Core Relates to Mage_Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHP 8.1 Issue with the way deleting cookies is done in Mage_Core_Model_Cookie
3 participants