We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
11.30.0
8.3.13
No response
I recently upgraded from Laravel 10.48.22 to Laravel 11.30.0 and all implementations of
10.48.22
cache()->remember($key, $value, now()->addSecond()) have broke.
cache()->remember($key, $value, now()->addSecond())
However, this works: cache()->remember($key, $value, 1)
cache()->remember($key, $value, 1)
Switching back to Laravel 10 fixed the issue.
I'm not sure if this is intentional or not - but it's undocumented and it caused our app to break.
Both tests for Laravel 10 + 11 using Carbon 2.72.5.
2.72.5
Just run the following:
return [ cache()->put("test_1", true, now()->addSecond()), cache()->put("test_1", true, 1), cache()->put("test_2", true, now()->addSeconds(2)) ];
And it will output:
[ false, true, true, ]
Interestingly, if the order changes, then it will output as true for all values.
return [ cache()->put("test_1", true, 1), cache()->put("test_1", true, now()->addSecond()), cache()->put("test_2", true, now()->addSeconds(2)) ];
will output:
[ true, true, true, ]
The text was updated successfully, but these errors were encountered:
This issue is caused by time progressing during the execution of the PHP script.
You pass through now()->addSecond(), but by the time we actually can extract the time into the future of that value, microseconds have passed.
now()->addSecond()
This results in a value of ~0.9999 seconds, which we cast to an int and it becomes zero.
0.9999
int
I've got a fix that should mostly fix this which I'll PR shortly.
Sorry, something went wrong.
PR up: #53431
No branches or pull requests
Laravel Version
11.30.0
PHP Version
8.3.13
Database Driver & Version
No response
Description
I recently upgraded from Laravel
10.48.22
to Laravel11.30.0
and all implementations ofcache()->remember($key, $value, now()->addSecond())
have broke.However, this works:
cache()->remember($key, $value, 1)
Switching back to Laravel 10 fixed the issue.
I'm not sure if this is intentional or not - but it's undocumented and it caused our app to break.
Both tests for Laravel 10 + 11 using Carbon
2.72.5
.Steps To Reproduce
Just run the following:
And it will output:
Interestingly, if the order changes, then it will output as true for all values.
will output:
The text was updated successfully, but these errors were encountered: