php - Internet Explorer fails to set cookies with same name -


i fired vm internet explorer 11 test out. try running following php in internet explorer:

<?php setcookie('mycookie', rand(), 0); setcookie('mycookie', rand(), time() + 60); setcookie('sessioncookie', rand()); setcookie('expirecookie', rand(), time() + 60); 
  1. use inspector inspect resulting response cookies.
  2. refresh page. cookies received on previous request should sent on next request.
  3. internet explorer fails keep record of 'mycookie' cookie. other 2 set fine. seems happen when set session cookie, , set cookie expiry , same name.

i can't seem reproduce in other browser. in http spec, chrome , firefox being lenient about?

here response headers cookies:

set-cookie: mycookie=101636679 set-cookie: mycookie=158533464; expires=tue, 07-jul-2015 17:39:03 gmt; max-age=10 set-cookie: sessioncookie=1777324234 set-cookie: expirecookie=1229727377; expires=tue, 07-jul-2015 17:39:03 gmt; max-age=10 

note works expected if reverse order of first 2 setcookie directives:

<?php setcookie('mycookie', rand(), time() + 60); setcookie('mycookie', 'latest', 0); setcookie('sessioncookie', rand()); setcookie('expirecookie', rand(), time() + 60); 

this set 'mycookie' value 'latest'.

try this, works in internet explorer,

setcookie("mycookie", rand(),time()+5*24*60*60 ); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -