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

Bug: delete_cookie() helper function not working #3433

Closed
mail2bapi opened this issue Jul 31, 2020 · 1 comment
Closed

Bug: delete_cookie() helper function not working #3433

mail2bapi opened this issue Jul 31, 2020 · 1 comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@mail2bapi
Copy link

Describe the bug
I am having an issue with deleting cookies by name. I am using helper function delete_cookie('cookie_name');
But the helper is not deleting the named cookie. Though cookie can be deleted by vanilla PHP.

I am in development mode and using localhost

CodeIgniter 4 version
CI4 Version v4.0.4

Affected module(s)

Expected behavior, and steps to reproduce if appropriate
Created a session using
helper('cookie'); set_cookie([ 'name' => 'cookie_name', 'value' => $encrypter->encrypt($token['token']), 'expire' => '3600', ]);

Tried to remove it using
helper('cookie'); delete_cookie('cookie_name');

My env
app.cookiePrefix = 'dev_' app.cookieDomain = '' app.cookiePath = '/' app.cookieSecure = true app.cookieHTTPOnly = false

Context

  • OS: Ubuntu 20.04
  • Web server: Apache 2.4.43
  • PHP version 7.4.8
@mail2bapi mail2bapi added the bug Verified issues on the current code behavior or pull requests that will fix them label Jul 31, 2020
@InsiteFX
Copy link
Contributor

InsiteFX commented Aug 1, 2020

To delete a cookie you need to give it time in the pass time() - 3600 see the minus 3600

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

No branches or pull requests

2 participants