Refactor SettingsGetInformationField and PeerInformationManager to improve error handling and validate UUID format
https://github.com/nosial/Socialbox-PHP/issues/60
This commit is contained in:
parent
d127393402
commit
f51ea0bd78
2 changed files with 5 additions and 0 deletions
|
@ -25,6 +25,7 @@
|
||||||
{
|
{
|
||||||
throw new MissingRpcArgumentException('field');
|
throw new MissingRpcArgumentException('field');
|
||||||
}
|
}
|
||||||
|
|
||||||
$fieldName = InformationFieldName::tryFrom(strtoupper($rpcRequest->getParameter('field')));
|
$fieldName = InformationFieldName::tryFrom(strtoupper($rpcRequest->getParameter('field')));
|
||||||
if($fieldName === null)
|
if($fieldName === null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -208,6 +208,10 @@
|
||||||
{
|
{
|
||||||
$peerUuid = $peerUuid->getUuid();
|
$peerUuid = $peerUuid->getUuid();
|
||||||
}
|
}
|
||||||
|
elseif(!Validator::validateUuid($peerUuid))
|
||||||
|
{
|
||||||
|
throw new InvalidArgumentException('The given internal peer UUID is not a valid UUID V4');
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue