Commit 4bd31c2a authored by catch's avatar catch

Issue #3086408 by Krzysztof Domański, mglaman, el7cosmos: Error code should be...

Issue #3086408 by Krzysztof Domański, mglaman, el7cosmos: Error code should be string in HttpExceptionNormalizer

(cherry picked from commit 56fd1b60)
parent 03f175b1
......@@ -87,7 +87,7 @@ protected function buildErrorObjects(HttpException $exception) {
// Exceptions thrown without an explicitly defined code get assigned zero by
// default. Since this is no helpful information, omit it.
if ($exception->getCode() !== 0) {
$error['code'] = $exception->getCode();
$error['code'] = (string) $exception->getCode();
}
if ($this->currentUser->hasPermission('access site reports')) {
// The following information may contain sensitive information. Only show
......
......@@ -36,8 +36,8 @@ public function testNormalize() {
$error = $normalized[0];
$this->assertNotEmpty($error['meta']);
$this->assertNotEmpty($error['source']);
$this->assertEquals(13, $error['code']);
$this->assertEquals(403, $error['status']);
$this->assertSame('13', $error['code']);
$this->assertSame('403', $error['status']);
$this->assertEquals('Forbidden', $error['title']);
$this->assertEquals('lorem', $error['detail']);
$this->assertArrayHasKey('trace', $error['meta']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment