Skip to content

The code seems to use the I18n::locale() if the param lang is empty, but the ConfigValidator doesn't allow us to set an empty string #2

Description

@Xety

The code seems to use the I18n::locale() https://github.com/cakephp-fr/recaptcha/blob/master/src/View/Helper/RecaptchaHelper.php#L64-L67 if the param lang is empty (btw it's really a good idea), but the ConfigValidator doesn't like when we don't specify any lang option : https://github.com/cakephp-fr/recaptcha/blob/master/src/Validation/ConfigValidator.php#L93-L98

Also, maybe set the lang param to be empty by default or to use the I18n::locale()? https://github.com/cakephp-fr/recaptcha/blob/master/src/View/Helper/RecaptchaHelper.php#L40

Also, we probably should do a substr(I18n::locale(), 0, 2)) to get the I18n::locale() value because the locale value with I18n::locale() can also be full named such as fr_FR, en_US etc.

Edit :
After some more tests, by removing the lang option in the config, the validator pass, but the option is defined to en : https://github.com/cakephp-fr/recaptcha/blob/master/src/View/Helper/RecaptchaHelper.php#L40 so the condition :

$lang = $this->config('lang');
if (empty($lang)) {
        $this->config('lang', I18n::locale());
}

is always false.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions