Skip to content

Commit

Permalink
fix: corrected check on null values
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Feb 15, 2023
1 parent 53134f5 commit 27eaaae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions phpmyfaq/ajaxservice.php
Expand Up @@ -116,8 +116,8 @@
$captcha->setUserIsLoggedIn($isLoggedIn);

if (
'savevoting' !== $action && 'saveuserdata' !== $action && 'changepassword' !== $action && !is_null($code) &&
!$captcha->checkCaptchaCode($code)
'savevoting' !== $action && 'saveuserdata' !== $action && 'changepassword' !== $action &&
!$captcha->checkCaptchaCode($code ?? '')
) {
$message = ['error' => $PMF_LANG['msgCaptcha']];
}
Expand Down
2 changes: 1 addition & 1 deletion phpmyfaq/lang/language_de.php
Expand Up @@ -155,7 +155,7 @@
$PMF_LANG['err_noTopTen'] = "Derzeit sind keine beliebten FAQs verfügbar.";
$PMF_LANG['err_nothingFound'] = "Es wurde kein Eintrag gefunden.";
$PMF_LANG['err_SaveEntries'] = "Pflichtfelder sind <strong>Name</strong>, <strong>E-Mail-Adresse</strong>, <strong>Kategorie</strong>, <strong>Frage</strong> und <strong>Antwort</strong>!";
$PMF_LANG['err_SaveComment'] = "Pflichtfelder sind <strong>Name</strong>, <strong>E-Mail-Adresse</strong> und <strong>Kommentar</strong>!";
$PMF_LANG['err_SaveComment'] = "Pflichtfelder sind Name, E-Mail-Adresse und Kommentar!";
$PMF_LANG['err_VoteTooMuch'] = "Leider konnte die Bewertung nicht gespeichert werden, da mit der IP bereits bewertet wurde.";
$PMF_LANG['err_noVote'] = "Es wurde keine Bewertung abgegeben!";
$PMF_LANG['err_noMailAdress'] = "Die angegebene E-Mail-Adresse ist nicht korrekt.";
Expand Down
4 changes: 2 additions & 2 deletions phpmyfaq/src/phpMyFAQ/Captcha.php
Expand Up @@ -491,10 +491,10 @@ private function drawText()
* This function checks the provided captcha code
* if the captcha code spam protection has been activated from the general PMF configuration.
*
* @param string $code Captcha Code
* @param string|null $code Captcha Code
* @return bool
*/
public function checkCaptchaCode(string $code): bool
public function checkCaptchaCode(string $code = null): bool
{
if ($this->isUserIsLoggedIn()) {
return true;
Expand Down

0 comments on commit 27eaaae

Please sign in to comment.