Skip to content

Commit

Permalink
clear $_ENV data for security reason
Browse files Browse the repository at this point in the history
  • Loading branch information
recca0120 committed Mar 14, 2018
1 parent d37cedf commit 13ab8c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function render($request, Exception $e)
$response = $this->exceptionHandler->render($request, $e);

if ($this->shouldRenderException($response) === true) {
$_SERVER = $request->server();
$response->setContent(
$this->debuggerManager->exceptionHandler($e)
);
Expand Down
7 changes: 5 additions & 2 deletions tests/Exceptions/HandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Exception;
use Mockery as m;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use PHPUnit\Framework\TestCase;
use Recca0120\LaravelTracy\Exceptions\Handler;
Expand Down Expand Up @@ -170,17 +171,19 @@ public function testRender()
$exceptionHandler->shouldReceive('render')
->once()
->with(
$request = m::mock('Illuminate\Http\Request'),
$request = Request::capture(),
$exception = new Exception()
)->andReturn(
$response = m::mock('Symfony\Component\HttpFoundation\Response')
);
$response->shouldReceive('getContent')->once()->andReturn(null);

$debuggerManager->shouldReceive('exceptionHandler')->once()->with($exception)->andReturn($content = 'foo');
$response->shouldReceive('setContent')->once()->with($content);

$_SERVER['foo'] = 'bar';

$this->assertSame($response, $handler->render($request, $exception));
$this->assertSame($_SERVER, $request->server());
}

public function testRenderForConsoleMethod()
Expand Down

0 comments on commit 13ab8c5

Please sign in to comment.