Refactor SettingsUpdateInformationField and PeerInformationManager to enhance UUID validation and improve error handling for property values
https://github.com/nosial/Socialbox-PHP/issues/68
This commit is contained in:
parent
2967c87990
commit
d47251c251
2 changed files with 22 additions and 7 deletions
|
@ -27,7 +27,8 @@
|
|||
{
|
||||
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');
|
||||
|
@ -38,11 +39,7 @@
|
|||
{
|
||||
throw new MissingRpcArgumentException('value');
|
||||
}
|
||||
$value = $rpcRequest->getParameter('value');
|
||||
if(!$fieldName->validate($value))
|
||||
{
|
||||
throw new InvalidRpcArgumentException('value');
|
||||
}
|
||||
$value = (string)$rpcRequest->getParameter('value');
|
||||
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue