Bug #77238 [NEW]: session_set_cookie_params behavior change in PHP 7.2
| From: | john at zerocrates dot org | Date: | Tue, 04 Dec 2018 18:58:22 +0000 |
| Subject: | Bug #77238 [NEW]: session_set_cookie_params behavior change in PHP 7.2 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-218266@lists.php.net to get a copy of this message | ||
From: john at zerocrates dot org
Operating system: Linux
PHP version: 7.2.12
Package: Session related
Bug Type: Bug
Bug description:session_set_cookie_params behavior change in PHP 7.2
Description:
------------
Under PHP 7.1, calling session_set_cookie_params with an active session
will successfully change the cookie sent to the client, IF
session_regenerate_id is called afterward.
In PHP 7.2, calling session_set_cookie_params with an active session
emits a warning:
Warning: session_set_cookie_params(): Cannot change session cookie
parameters when session is active
Additionally, the cookie is _not_ changed.
I've seen this described as a change which merely emits warnings
informing developers of patterns that never worked in the first place
and just failed silently (for example, the comments on #75650), but in
this case presumably the function is bailing out after printing the
warning, and the actual behavior is changed.
I was unable to find any discussion of this change in the migration
documentation for PHP 7.2.
Test script:
---------------
session_start();
$params = session_get_cookie_params();
session_set_cookie_params(100, $params['path'], $params['domain'],
$params['secure']);
session_regenerate_id();
// Under 7.1 this emits a Set-Cookie with the 100-second lifetime
respected
// Under 7.2, it produces a warning and the Set-Cookie does not respect
the new lifetime
--
Edit bug report at https://bugs.php.net/bug.php?id=77238&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77238&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77238&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77238&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77238&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77238&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77238&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77238&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77238&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77238&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77238&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77238&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77238&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77238&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77238&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77238&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77238&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77238&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77238&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77238&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77238&r=mysqlcfg