-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
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
Divide By Zero Error After 11.43.0 Upgrade #54679
Comments
fixes #54679 Signed-off-by: Mior Muhammad Zaki <[email protected]>
same here, hoping for a fix soon |
@damiantw I am the author of PR #54650 which introduced this bug. Sorry for the inconvenience. I even commented that changing the Out of curiosity, could you share the test case which triggered this error? We could use it to add a test case directly to the framework and prevent any regressions in the future. Thanks in advance! |
Hi @rodrigopedra, no problem at all. Our test calls a controller that executes a pagination query along the lines of the following. public function myFunc(Request $request)
{
return Loan::query()
->where('user_id', $request->user()->id)
->paginate($request->integer('perPage'));
} So, if the Arguably, we should provide a default so we're never passing zero, but that was the reason test('paginate with zero per page', function () {
expect(Loan::query()->paginate((int) null)->isEmpty())->toBeTrue();
}); ^ this test fails on 11.43.0 but passes with patch 1af7e22 |
Thanks for sharing, I will try sending a PR to add a test case to prevent future regressions, although I will only be able to do it later this week. If you want to send a PR before, covering this, be my guest. The issue is patched on v11.43.1, thanks for sharing, and please apologize for the inconvenience. Have a nice day =) |
Laravel Version
11.43.0
PHP Version
8.4
Database Driver & Version
PostgreSQL 15
Description
One of our tests started failing after receiving the Shift for Laravel v11.43.0.
We're seeing a divide-by-zero error in the
LengthAwarePaginator
constructor.This commit seems to be the culprit.
If I manually change the line in
src/Illuminate/Database/Eloquent/Builder.php
from...
to
the test passes.
Steps To Reproduce
Call paginate on an Eloquent query without results on 11.43.0.
The text was updated successfully, but these errors were encountered: