note 99845 added to function.setcookie

From: Date: Fri, 10 Sep 2010 10:20:06 +0000
Subject: note 99845 added to function.setcookie
Groups: php.notes 
Request: Send a blank email to php-notes+get-172439@lists.php.net to get a copy of this message
A period in a cookie name (like user.name) seems to show up in the $_COOKIE array as an underscore (so user_name). This means that for example $_COOKIE["user_name"] must be used to read a cookie that has been set with setcookie("user.name" ...), which is already rather confusing. Furthermore the variable $_COOKIE["user_name"] will retain the value set by setcookie("user.name" ...) and no amount of calling setcookie("user_name" ...) will alter this value. This is rather trivially fixed by clearing the "user.name" cookie, but it can take a while to realize this since there's only "user_name" in $_COOKIE. Hope this saves someone some time. ---- Server IP: 69.147.83.197 Probable Submitter: 77.161.72.147 ---- Manual Page -- http://www.php.net/manual/en/function.setcookie.php Edit -- https://master.php.net/note/edit/99845 Del: integrated -- https://master.php.net/note/delete/99845/integrated Del: useless -- https://master.php.net/note/delete/99845/useless Del: bad code -- https://master.php.net/note/delete/99845/bad+code Del: spam -- https://master.php.net/note/delete/99845/spam Del: non-english -- https://master.php.net/note/delete/99845/non-english Del: in docs -- https://master.php.net/note/delete/99845/in+docs Del: other reasons-- https://master.php.net/note/delete/99845 Reject -- https://master.php.net/note/reject/99845 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#172439) next »