When you construct an instance of \Bullet\Request with params we inject those values into the global space. I'm assuming it is because of these lines in the constructor:
$app = new \Bullet\App();
$app->path("/", function ($request) use ($app) {
$big = $app->run(new \Bullet\Request("GET", "name", array("upper" => 1)));
$little = $app->run(new \Bullet\Request("GET", "name"));
return $big . $little;
});
$app->path("/name", function ($request) use ($app) {
return $request->upper ? "JACOB" : "jacob";
});
echo $app->run("GET", "/");
I would expect the output to be JACOBjacob but instead it's JACOBJACOB because the params from the first request are still around for the second.
I don't know the fix, but if you agree that this is a problem then you can use this test to identify the problem.
public function testRequestsDoNotShareParams()
{
$first_request = new Bullet\Request('GET', '/', array('foo' => 'bar'));
$second_request = new Bullet\Request('GET', '/', array());
$this->assertNull($second_request->foo);
}
When you construct an instance of
\Bullet\Request
with params we inject those values into the global space. I'm assuming it is because of these lines in the constructor:Consider the following code:
I would expect the output to be
JACOBjacob
but instead it'sJACOBJACOB
because the params from the first request are still around for the second.I don't know the fix, but if you agree that this is a problem then you can use this test to identify the problem.