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:
netkas 2025-03-12 15:16:17 -04:00
parent f51ea0bd78
commit e1b61e631f
Signed by: netkas
GPG key ID: 4D8629441B76E4CC
2 changed files with 7 additions and 1 deletions

View file

@ -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');

View file

@ -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
{