Skip to content

Commit

Permalink
fix:request size check (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
smallsung committed Feb 13, 2022
1 parent a3f603b commit 98b1d9b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/CoreEnforcer.php
Expand Up @@ -614,6 +614,9 @@ protected function enforcing(string $matcher, &$explains = [], ...$rvals): bool
$rTokens = array_values($this->model['r'][$rType]->tokens);
$pTokens = array_values($this->model['p'][$pType]->tokens);

if (\count($rTokens) != \count($rvals)) {
throw new CasbinException(\sprintf('invalid request size: expected %d, got %d', \count($rTokens), \count($rvals)));
}
$rParameters = array_combine($rTokens, $rvals);

if (false == $rParameters) {
Expand All @@ -629,10 +632,6 @@ protected function enforcing(string $matcher, &$explains = [], ...$rvals): bool
$expression = $expressionLanguage->parse($expString, array_merge($rTokens, $pTokens));
}

if (count($this->model['r']['r']->tokens) != count($rvals)) {
throw new CasbinException(sprintf('invalid request size: expected %d, got %d', count($this->model['r']['r']->tokens), count($rvals)));
}

$policyEffects = [];
$matcherResults = [];

Expand Down

0 comments on commit 98b1d9b

Please sign in to comment.