Bug #73140 [NEW]: session_regenerate_id overrides setcookie if names match
| From: | evgeny dot budakov+phpnet at gmail dot com | Date: | Wed, 21 Sep 2016 23:02:29 +0000 |
| Subject: | Bug #73140 [NEW]: session_regenerate_id overrides setcookie if names match | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-204171@lists.php.net to get a copy of this message | ||
From: evgeny dot budakov+phpnet at gmail dot com
Operating system: Ubuntu
PHP version: 7.0Git-2016-09-21 (Git)
Package: HTTP related
Bug Type: Bug
Bug description:session_regenerate_id overrides setcookie if names match
Description:
------------
session_regenerate_id overrides setcookie if names match but domains may
differ. In my case domain names were ('domain.com' vs '.domain.com').
The issue arises when I try to delete cookie via setcookie function (on
domain 'domain.com') and immediately after I have a call to
session_regenerate_id (on domain '.domain.com')
Test script:
---------------
session_name('test');
session_start();
// PHP 5
setcookie('test', '', time()-10000000, '/',
'thrivemarket.com'); //
outputs Set-cookie test = deleted header(thrivemarket.com)
session_regenerate_id(true); // Outputs Set-cookie test = (session id)
header (.thrivemarket.com)
// PHP 7
setcookie('test', '', time()-10000000, '/',
'thrivemarket.com'); //
<--- THIS IS THE BUG, unlike in PHP 5 this call is ignored in PHP 7
session_regenerate_id(true); // Outputs Set-cookie test = (session id)
header (.thrivemarket.com)
Expected result:
----------------
In PHP 7 I expect the "Set-cookie test = deleted" header to be output
just as it does in PHP 5
Actual result:
--------------
"Set-cookie test = deleted" is not output
--
Edit bug report at https://bugs.php.net/bug.php?id=73140&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73140&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73140&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73140&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73140&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73140&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73140&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73140&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73140&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73140&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73140&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73140&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73140&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73140&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73140&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73140&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73140&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73140&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73140&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73140&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73140&r=mysqlcfg