excelwebzone / EWZRecaptchaBundle

This bundle provides easy reCAPTCHA form field for Symfony.
MIT License
395 stars 160 forks source link

Twig template falis to render in strict_variables mode #242

Open GKFX opened 4 years ago

GKFX commented 4 years ago

https://github.com/excelwebzone/EWZRecaptchaBundle/blob/21fea6daaa8b9a4782b2144a63a1e16da25ac519/src/Resources/views/Form/ewz_recaptcha_widget.html.twig#L5

contains a reference to attr.options.size which is not necessarily defined. If running Twig with strict_variables set to true this causes a crash. It should read

{% if attr.options.size ?? null == 'invisible' and attr.options.callback is not defined %}

and line 38:

<div class="g-recaptcha" data-theme="{{ attr.options.theme ?? ''}}" data-size="{{ attr.options.size ?? ''}}" data-type="{{ attr.options.type ?? ''}}" data-sitekey="{{ form.vars.public_key }}"

in order to function in this environment.