Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Added Carbon 3 to the requirements #127

Merged
merged 1 commit into from
Mar 14, 2024
Merged

Conversation

poldixd
Copy link
Contributor

@poldixd poldixd commented Mar 14, 2024

With laravel 11 you can use carbon 2 or 3: https://laravel.com/docs/11.x/upgrade#carbon-3

@freekmurze freekmurze merged commit eaffd65 into spatie:main Mar 14, 2024
18 checks passed
@freekmurze
Copy link
Member

Thanks!

@poldixd poldixd deleted the patch-1 branch March 14, 2024 12:59
@jonathan-bird
Copy link

jonathan-bird commented Mar 25, 2024

@freekmurze I found that with Carbon 3, it throws an Exception if you set HONEYPOT_SECONDS=1 in the .env file as it casts the value to a string. If you publish the config file and set 1 as an integer there, no worries.

Potentially worth casting to an integer when calling $this->config['amount_of_seconds']?

The exception is (essentially saying amount of seconds value is string, rather than int/float):

Carbon\Carbon::rawAddUnit(): Argument #3 ($value) must be of type int|float, string given, called in vendor/nesbot/carbon/src/Carbon/Traits/Units.php on line 324

To solve this, I had to publish the config, and then casted to int:

'amount_of_seconds' => (int) env('HONEYPOT_SECONDS', 3),

@freekmurze
Copy link
Member

Feel free to PR this 👍

@clementmas
Copy link
Contributor

@jonathan-bird this type issue has been fixed in the latest version of this package. See #131

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants