note 117526 added to function.setcookie

From: Date: Wed, 24 Jun 2015 17:38:23 +0000
Subject: note 117526 added to function.setcookie
Groups: php.notes 
Request: Send a blank email to php-notes+get-202937@lists.php.net to get a copy of this message
Note that at least in PHP 5.5 setcookie() removes previously set cookies with the same name (even if you've set them via header()), so previously fired Set-Cookie headers with e.g. PHPSESSID name are not flushed to the browser. Even headers_list() doesn't see them after session_start(): header("Set-Cookie: PHPSESSID=abc; path=/; domain=.sub.domain.com"); header("Set-Cookie: PHPSESSID=abc; path=/; domain=.domain.com"); print_r(headers_list()); // here you see two Set-Cookie headers with domains for PHPSESSID session_id('abc'); session_start(); print_r(headers_list()); // here you don't; you see only one Set-Cookie produced by session_start() ---- Server IP: 72.52.91.14 Probable Submitter: 77.246.236.206 ---- Manual Page -- http://php.net/manual/en/function.setcookie.php Edit -- https://master.php.net/note/edit/117526 Del: integrated -- https://master.php.net/note/delete/117526/integrated Del: useless -- https://master.php.net/note/delete/117526/useless Del: bad code -- https://master.php.net/note/delete/117526/bad+code Del: spam -- https://master.php.net/note/delete/117526/spam Del: non-english -- https://master.php.net/note/delete/117526/non-english Del: in docs -- https://master.php.net/note/delete/117526/in+docs Del: other reasons-- https://master.php.net/note/delete/117526 Reject -- https://master.php.net/note/reject/117526 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#202937) next »