albertcht / invisible-recaptcha

An invisible reCAPTCHA package for Laravel, Lumen, CI or native PHP.
MIT License
603 stars 163 forks source link

Fix blade directives #144

Closed mikemand closed 3 years ago

mikemand commented 3 years ago

125 added the ability to add nonces to the scripts, but the implementation was not correct.

Blade passes all the arguments as a string (for example: "'en', 'nonce-ASDFGHJKL'") to the closure. After Blade compiles the view, the underlying function (app('captcha')->renderFooterJS(...)) receives the arguments as they were passed.

This can be further simplified by using array destructuring, which means dropping support for PHP 5.6 and 7.0.

mikemand commented 3 years ago

I started writing tests and realized I was partially correct, and fatally incorrect at the same time. Fixing now.

mikemand commented 3 years ago

@albertcht How do you feel about dropping support for anything older than Laravel 7 (preferably Laravel 8, but I will settle for 7) and PHP 7.3?

albertcht commented 3 years ago

@albertcht How do you feel about dropping support for anything older than Laravel 7 (preferably Laravel 8, but I will settle for 7) and PHP 7.3?

I would personally prefer keeping support for older Laravel versions and PHP 5.6.

mikemand commented 3 years ago

I would personally prefer keeping support for older Laravel versions and PHP 5.6.

Ok, that's fine. Have you had a chance to review this PR and the problem it fixes? The exception I was receiving is: ArgumentCountError Too few arguments to function AlbertCht\InvisibleReCaptcha\InvisibleReCaptchaServiceProvider::AlbertCht\InvisibleReCaptcha\{closure}(), 1 passed and exactly 2 expected vendor/albertcht/invisible-recaptcha/src/InvisibleReCaptchaServiceProvider.php:84

albertcht commented 3 years ago

I would personally prefer keeping support for older Laravel versions and PHP 5.6.

Ok, that's fine. Have you had a chance to review this PR and the problem it fixes? The exception I was receiving is: ArgumentCountError Too few arguments to function AlbertCht\InvisibleReCaptcha\InvisibleReCaptchaServiceProvider::AlbertCht\InvisibleReCaptcha\{closure}(), 1 passed and exactly 2 expected vendor/albertcht/invisible-recaptcha/src/InvisibleReCaptchaServiceProvider.php:84

Thanks for your pull request, I will review this PR as soon as possible.