![]() |
I need to clear sessions between post calls in my test suite and it appears that the best way to do that is to enable resetServices in the $setUpMethods array:
https://github.com/codeigniter4/CodeIgni...-835353623 However, when I do that, I receive the following error: Code: ErrorException: ini_set(): Session ini settings cannot be changed after headers have already been sent Is there a way to set the resetServices to true before the headers have been set? For reference, I have tried enabling resetServices in the setUpMethods: PHP Code: protected $setUpMethods = ["resetServices"]; Enabling it in the setUp function: PHP Code: protected function setUp(): void And enabling it directly in one of my functions just before the $this->post call: PHP Code: $this->resetServices(); And it results in the same error. I have also tried to only reset the single MockSession service in my function: PHP Code: Services::resetSingle("mockSession"); But that doesn't do anything. This was done with CI4.1.9 and since CI4.2 enables resetServices by default, I tried upgrading to that, which corrects the issue; however, I am still running into the same error that I was trying to fix with resetServices. You can see more info on that here: https://stackoverflow.com/q/72539728/1698908 |
Messages In This Thread |
Enabling "resetServices" causes "Session ini settings cannot be changed..." error - by umizoomi - 06-09-2022, 08:02 AM
RE: Enabling "resetServices" causes "Session ini settings cannot be changed..." error - by kenjis - 06-09-2022, 04:47 PM
RE: Enabling "resetServices" causes "Session ini settings cannot be changed..." error - by umizoomi - 06-09-2022, 05:59 PM
RE: Enabling "resetServices" causes "Session ini settings cannot be changed..." error - by umizoomi - 06-11-2022, 08:52 PM
RE: Enabling "resetServices" causes "Session ini settings cannot be changed..." error - by kenjis - 06-11-2022, 09:00 PM
RE: Enabling "resetServices" causes "Session ini settings cannot be changed..." error - by umizoomi - 06-13-2022, 11:31 AM
RE: Enabling "resetServices" causes "Session ini settings cannot be changed..." error - by kenjis - 06-13-2022, 03:58 PM
|