Harden JsonMapper defaults in general

This commit is contained in:
Dylan K. Taylor 2024-02-23 14:10:24 +00:00
parent 6872661fd0
commit db665fefdb
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
4 changed files with 8 additions and 0 deletions

View File

@ -389,6 +389,9 @@ final class BlockStateUpgradeSchemaUtils{
}
$jsonMapper = new \JsonMapper();
$jsonMapper->bExceptionOnMissingData = true;
$jsonMapper->bExceptionOnUndefinedProperty = true;
$jsonMapper->bStrictObjectTypeChecking = true;
try{
$model = $jsonMapper->map($json, new BlockStateUpgradeSchemaModel());
}catch(\JsonMapper_Exception $e){

View File

@ -88,6 +88,9 @@ final class ItemIdMetaUpgradeSchemaUtils{
}
$jsonMapper = new \JsonMapper();
$jsonMapper->bExceptionOnMissingData = true;
$jsonMapper->bExceptionOnUndefinedProperty = true;
$jsonMapper->bStrictObjectTypeChecking = true;
try{
$model = $jsonMapper->map($json, new ItemIdMetaUpgradeSchemaModel());
}catch(\JsonMapper_Exception $e){

View File

@ -108,6 +108,7 @@ class ZippedResourcePack implements ResourcePack{
$mapper = new \JsonMapper();
$mapper->bExceptionOnMissingData = true;
$mapper->bStrictObjectTypeChecking = true;
try{
/** @var Manifest $manifest */

View File

@ -55,6 +55,7 @@ class UpdateCheckTask extends AsyncTask{
}else{
$mapper = new \JsonMapper();
$mapper->bExceptionOnMissingData = true;
$mapper->bStrictObjectTypeChecking = true;
$mapper->bEnforceMapType = false;
try{
/** @var UpdateInfo $responseObj */