Skip to content
Permalink
Browse files Browse the repository at this point in the history
fix: check captcha length correctly and fix type error
  • Loading branch information
thorsten committed Dec 15, 2022
1 parent 3872e7e commit fe6e9f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions phpmyfaq/src/phpMyFAQ/Captcha.php
Expand Up @@ -434,7 +434,7 @@ private function drawText()
$codeLength = Strings::strlen($this->code);
$numFonts = count($this->fonts);
$w1 = 15;
$w2 = $this->width / ($codeLength + 1);
$w2 = floor($this->width / ($codeLength + 1));

for ($p = 0; $p < $codeLength; ++$p) {
$letter = $this->code[$p];
Expand Down Expand Up @@ -515,7 +515,7 @@ public function checkCaptchaCode(string $code): bool
public function validateCaptchaCode(string $captchaCode): bool
{
// Sanity check
if (0 === Strings::strlen($captchaCode)) {
if (Strings::strlen($captchaCode) !== $this->captchaLength) {
return false;
}

Expand Down

0 comments on commit fe6e9f0

Please sign in to comment.