-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Open
Description
Laravel Version
11.46.1
PHP Version
8.2.29
Database Driver & Version
No response
Description
I'm using Laravel Context in my controller via Context::addHidden() and Context::getHidden(). Then in tests I execute HTTP requests multiple times in one test method.
$this->call($method, $url, [], [], [], $server, $xml);
I suppose the issue will be also with post, get and other methods.
And the issue is that context data is not flushed between requests. So, a value added to Context in the first request is accessible in the following ones.
I can workaround that by using Context::flush() before every request made in tests, but I think it might be a bug that needs a fix.
Steps To Reproduce
In a route handler do
use Illuminate\Support\Facades\Context;
echo Context::getHidden('test');
Context::addHidden('test', 'test');
In a test make two HTTP requests to this route. The second request will output 'test', but it should not.
IhorBorivets
Metadata
Metadata
Assignees
Labels
No labels