Made message signing in Cryptography use SHA512 as the message content for... #1

Closed
netkas wants to merge 421 commits from master into dev
Showing only changes of commit ef9336ca54 - Show all commits

View file

@ -74,37 +74,37 @@
* Checks if the parameter exists within the RPC request * Checks if the parameter exists within the RPC request
* *
* @param string $parameter The parameter to check * @param string $parameter The parameter to check
* @param bool $nullAllowed True if the parameter value can be null, False otherwise. * @param bool $strict True if the parameter value cannot be null (or empty), False otherwise.
* @return bool True if the parameter exists, False otherwise. * @return bool True if the parameter exists, False otherwise.
*/ */
public function containsParameter(string $parameter, bool $nullAllowed=false): bool public function containsParameter(string $parameter, bool $strict=true): bool
{ {
if(!$nullAllowed) if($strict)
{ {
return isset($this->parameters[$parameter]) && $this->parameters[$parameter] !== null; if(!isset($this->parameters[$parameter]))
}
return isset($this->parameters[$parameter]);
}
/**
* Checks if the parameters exist within the RPC request
*
* @param array $parameters The parameters to check
* @param bool $nullAllowed True if the parameter value can be null, False otherwise.
* @return bool True if the parameters exist, False otherwise.
*/
public function containsParameters(array $parameters, bool $nullAllowed=false): bool
{
foreach($parameters as $parameter)
{
if(!$this->containsParameter($parameter, $nullAllowed))
{ {
return false; return false;
} }
if(is_string($this->parameters[$parameter]) && strlen($this->parameters[$parameter]) == 0)
{
return false;
}
if(is_array($this->parameters[$parameter]) && count($this->parameters[$parameter]) == 0)
{
return false;
}
if(is_null($this->parameters[$parameter]))
{
return false;
}
return true;
} }
return true; return isset($this->parameters[$parameter]);
} }
/** /**