At the top of the unit test task (or if all functions are affected, then in setUp() or even public static function setUpBeforeClass() ) add this code:
@session_start();
Or in the long run:
$prev = error_reporting(0); session_start(); error_reporting($prev);
It seems like you should never do, but it's fine, because suppressing the error message was exactly what we wanted to do!
As I noticed in a comment on hakre's answer, messing with the ini settings never worked, they didnβt even try to do this combination before calling session_start() :
ini_set("session.use_cookies",0); ini_set("session.use_only_cookies",0); ini_set("session.use_trans_sid",1);
source share