|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-06-20 03:36 UTC] fromphpnet at blaksaga dot com
Description:
------------
The overall jist of the problem is this. I want to be able to set a cookie and specify the domain and path WITHOUT setting an expiration (making the cookie get killed when the browser is closed).
This is what the documentation for setcookie states:
All the arguments except the name argument are optional. You may also replace an argument with an empty string ("") in order to skip that argument. Because the expire and secure arguments are integers, they cannot be skipped with an empty string, use a zero (0) instead.
Unfortunately, using a 0 for expire has different results than when passing nothing. The cookie is not killed at session end when using 0 like it should be.
These statements should produce exactly the same results but do not:
setcookie ( "blaksaga_cookies" , "enabled", 0 );
setcookie ( "blaksaga_cookies2" , "enabled" );
This is either a bug in the setcookie function or in your documentation. None-the-less, there needs to be some way to skip the expire argument while passing domain and path arguments.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 29 14:00:01 2025 UTC |
I'm sorry, but in my eyes this is a bug. If nothing else, it is a documentation bug. ----- All the arguments except the name argument are optional. You may also replace an argument with an empty string ("") in order to skip that argument. Because the expire and secure arguments are integers, they cannot be skipped with an empty string, use a zero (0) instead. ----- Unless I am reading it wrong, the documentation is incorrect. But thank you for your time. I will post a comment on the doc page about this. If you could include/change it in the docs it would be appreciated. Thanks, blaksaga