Skip to content

Commit cc03d34

Browse files
authored
JSON Stack exceeded Test Case
1 parent 05ad24c commit cc03d34

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

tests/system/EntityTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,21 @@ public function testCastAsJSONSyntaxError()
474474
$this->expectException(CastException::class);
475475
$this->expectExceptionMessage('Syntax error, malformed JSON');
476476

477+
$method("{ this is bad string", true);
478+
}
479+
480+
public function testCastAsJSONAnotherErrorDepth()
481+
{
482+
$entity = new Entity();
483+
484+
$method = $this->getPrivateMethodInvoker($entity,'castAsJson');
477485

486+
$this->expectException(CastException::class);
487+
$this->expectExceptionMessage('Maximum stack depth exceeded');
478488

479-
$method("{ this is bad string", true);
489+
$string = '{'.str_repeat('"test":{', 513).'"test":"value"'.str_repeat('}', 513).'}';
490+
491+
$method($string, true);
480492
}
481493
//--------------------------------------------------------------------
482494

0 commit comments

Comments
 (0)