Bug #75628 [Com]: session_set_save_handler() prints warnings in a unit test
| From: | matteo dot scaramuccia at gmail dot com | Date: | Tue, 23 Jan 2018 09:27:03 +0000 |
| Subject: | Bug #75628 [Com]: session_set_save_handler() prints warnings in a unit test | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-213675@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75628&edit=1
ID: 75628
Comment by: matteo dot scaramuccia at gmail dot com
Reported by: damyon at moodle dot com
Summary: session_set_save_handler() prints warnings in a unit
test
Status: Open
Type: Bug
Package: Session related
Operating System: Linux Mint 17.3 Rosa
PHP Version: 7.2.0
Block user comment: N
Private report: N
New Comment:
Hello,
is there any dev progress here?
Still relevant in 7.2.1 too.
TIA,
Matteo
Previous Comments:
------------------------------------------------------------------------
[2017-12-05 08:48:07] damyon at moodle dot com
Sorry the test script has "S>" lines in it (copy / paste problem).
------------------------------------------------------------------------
[2017-12-05 08:38:34] damyon at moodle dot com
Description:
------------
When unit testing session-related code in a CLI environment, appropriate PHP ini settings combined
with passing false to session_cache_limiter should allow the session handler to be changed even if
output has been already sent.
With PHP 7.2.0RC5 calling session_set_save_handler prints warning messages, regardless of php ini
settings.
Very similar previously fixed bug:
https://bugs.php.net/bug.php?id=55267
Very similar (but not the same) bugs with php 7.2
https://bugs.php.net/bug.php?id=74936
https://bugs.php.net/bug.php?id=74514
Test script:
---------------
<?php
S>
S>
ini_set('session.use_cookies', false);
ini_set('session.use_only_cookies', false);
ini_set('session.use_trans_id', 1);
ini_set('session.cache_limiter', false);
session_cache_limiter(false);
echo '.';
class MySessionHandler extends SessionHandler
{
S>
S>
}
$handler = new MySessionHandler();
session_set_save_handler($handler, true);
Expected result:
----------------
One single dot of output
Actual result:
--------------
.PHP Warning: session_set_save_handler(): Cannot change save handler when headers already sent in
[filepath]/test.php on line 17
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75628&edit=1