Refactor SettingsDeleteInformationField and PeerInformationManager to improve UUID validation and ensure proper type casting for field parameters
https://github.com/nosial/Socialbox-PHP/issues/55
This commit is contained in:
parent
f51ea0bd78
commit
e1b61e631f
2 changed files with 7 additions and 1 deletions
|
@ -27,7 +27,9 @@
|
|||
{
|
||||
throw new MissingRpcArgumentException('field');
|
||||
}
|
||||
$fieldName = InformationFieldName::tryFrom(strtoupper($rpcRequest->getParameter('field')));
|
||||
|
||||
$fieldName = InformationFieldName::tryFrom(strtoupper((string)$rpcRequest->getParameter('field')));
|
||||
|
||||
if($fieldName === null)
|
||||
{
|
||||
throw new InvalidRpcArgumentException('field');
|
||||
|
|
|
@ -323,6 +323,10 @@
|
|||
{
|
||||
$peerUuid = $peerUuid->getUuid();
|
||||
}
|
||||
elseif(!Validator::validateUuid($peerUuid))
|
||||
{
|
||||
throw new InvalidArgumentException('The given internal peer UUID is not a valid UUID V4');
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue