Bug #75628 [Com]: session_set_save_handler() prints warnings in a unit test

From: Date: Fri, 27 Jul 2018 11:37:53 +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-216498@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: jeroen at asystance dot nl 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: I've written a php test case (phpt) for this bug. It fails on a fresh build of 7.2.8 (./configure without any flags). --TEST-- Bug #75628 (session_set_save_handler() prints warnings in a unit test) --SKIPIF-- <?php if (!extension_loaded("session")) die("skip session extension not available"); ?> <?php unlink(__DIR__. '/sess_' .session_id()); ?> --INI-- session.use_cookies=0 session.cache_limiter='' --FILE-- <?php class MySessionHandler extends SessionHandler {} echo ".\n"; $success = session_set_save_handler(new MySessionHandler(), true); echo ($success ? 'set' : 'fail') . "\n"; --EXPECT-- . set This bug is clearly a regression in 7.2 and prevents users from running (PHPUnit) tests against code that sets session handlers. Previous Comments: ------------------------------------------------------------------------ [2018-07-27 11:37:53] jeroen at asystance dot nl Related To: Bug #75628 ------------------------------------------------------------------------ [2018-05-31 15:12:30] jeroen at asystance dot nl Confirmed in version 7.2.5. ------------------------------------------------------------------------ [2018-01-23 09:27:02] matteo dot scaramuccia at gmail dot com Hello, is there any dev progress here? Still relevant in 7.2.1 too. TIA, Matteo ------------------------------------------------------------------------ [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

« previous php.bugs (#216498) next »