/** * @test * @expectedException \LitGroup\Json\Exception\JsonException * @expectedExceptionCode \JSON_ERROR_DEPTH */ public function testMaxDepthException() { $this->config->setMaxDepth(1); // Value with depth > 1 $json = '{"sub_map": {}}'; $this->decoder->decode($json); }
/** * {@inheritDoc} */ public function decode($json) { $result = json_decode($json, $this->config->getUseAssoc(), $this->config->getMaxDepth(), $this->config->getOptionsBitmask()); if (json_last_error() != JSON_ERROR_NONE) { throw new JsonException(json_last_error_msg(), json_last_error()); } return $result; }