Skip to content

Commit 51abec6

Browse files
committed
Merge remote-tracking branch 'upstream/8.x' into 8.x
2 parents c9c8828 + b77b908 commit 51abec6

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

src/Illuminate/Foundation/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
3333
*
3434
* @var string
3535
*/
36-
const VERSION = '8.83.24';
36+
const VERSION = '8.83.25';
3737

3838
/**
3939
* The base path for the Laravel installation.

src/Illuminate/Routing/Route.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,16 @@ protected function parseControllerCallback()
299299
return Str::parseCallback($this->action['uses']);
300300
}
301301

302+
/**
303+
* Flush the cached container instance on the route.
304+
*
305+
* @return void
306+
*/
307+
public function flushController()
308+
{
309+
$this->controller = null;
310+
}
311+
302312
/**
303313
* Determine if the route matches a given request.
304314
*

tests/Routing/RoutingRouteTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,6 +1763,25 @@ public function testResponseIsReturned()
17631763
$this->assertNotInstanceOf(JsonResponse::class, $response);
17641764
}
17651765

1766+
public function testRouteFlushController()
1767+
{
1768+
$container = new Container;
1769+
$router = $this->getRouter();
1770+
1771+
$router->get('count', ActionCountStub::class);
1772+
$request = Request::create('count', 'GET');
1773+
1774+
$response = $router->dispatch($request);
1775+
$this->assertSame(1, (int) $response->getContent());
1776+
1777+
$response = $router->dispatch($request);
1778+
$this->assertSame(2, (int) $response->getContent());
1779+
1780+
$request->route()->flushController();
1781+
$response = $router->dispatch($request);
1782+
$this->assertSame(1, (int) $response->getContent());
1783+
}
1784+
17661785
public function testJsonResponseIsReturned()
17671786
{
17681787
$router = $this->getRouter();
@@ -2304,6 +2323,18 @@ public function __invoke()
23042323
}
23052324
}
23062325

2326+
class ActionCountStub
2327+
{
2328+
protected $count = 0;
2329+
2330+
public function __invoke()
2331+
{
2332+
$this->count++;
2333+
2334+
return $this->count;
2335+
}
2336+
}
2337+
23072338
interface ExampleMiddlewareContract
23082339
{
23092340
//

0 commit comments

Comments
 (0)